8 – Conditional Show/Hide Child Terms on Edit Page

I have a content type with a term reference. The terms have child terms. On the admin editing side, I want to show only top level terms until selected, then show only the child terms for that parent.

This to prevent having a ginormously long field.

Parent 1
  Child 1
  Child 2
Parent 2
  Child 3
  Child 4
Parent 3
...

When a user edits a piece of content, I want to only show the parent terms initially. Then show/hide the child terms when the parent is checked.

Parent 1
Parent 2 (checked)
  Child 3
  Child 4
Parent 3
Parent 4
...

I’ve used conditional fields, state API, and select (other) modules. But this is showing and hiding children on the same field. So it’s a bit different.

Anyone have any advice for this scenario?

9 – Fetch Book field values on child level only once

I’m working on a project where I use the core Book functionality to create my sites structure. I have three content types:

  1. Reader
  2. Issue
  3. Article

Where Issue is a child of Reader, and Article is a child of Issue.

For this project I creates multiple custom modules to:

  • Set books access permissions
  • Change the books frontpage
  • Set the books theme
  • Add custom css settings per book

For all these modules I create a field in the Reader content type. But I want all its child nodes to also be affected by these field settings.

Now to do this I use the following code (example is taken from my custom css module):

if ($node->bundle() == 'reader') {
    //if reader
    $book = $node;
} else if ($node->bundle() == 'edition' || $node->bundle() == 'article') {
    //if edition or article
    //get parent book
    $book = Node::load($node->book('bid'));
}

//get textcolor from book
$textColor = $book->get('field_textcolor')->getValue()(0)('color');

But since I’m doing this in all my module I thought…this is not good for performance because I’m using Node::load multiple times for the same thing. So I want to improve this method, if necessary.

So is there a way to either:

  • Get the parent books field in a better way inside the modules?
  • Or, create global variables from the parent Book field values, so I have to only fetch them once for every website visit/visitor?

Can I reset the `[DisallowMultipleComponent]` attribute in child classes in Unity somehow?

Can I reset the (DisallowMultipleComponent) attribute in child classes in Unity somehow?

I want to create my base class:

(DisallowMultipleComponent)
public class MyCompanyClass : Monobehaviour {}

I want all my component scripts to inherit from the MyCompanyClass. So, I will be able to add only one instance of my component script to a game object at a time. I need it for most of my classes. But for some classes I still want to preserve the ability to add a few class instances to a game object, while still inheriting from the MyCompanyClass (because I am going to put some custom behavior into it, which is going to be used by all my component scripts).

So, I was trying to search for something like (AllowMultipleComponent), but found nothing. Is there maybe another way to achieve what I want?

private key – Can Bitcoin be recovered from a child key alone?

I have a question regarding BIP-32 and keys.

Imagine a scenario in which a user creates a new Bitcoin wallet with a seed phrase. He then generates a new address and sends 1 BTC to this address.

Under the covers, my understanding is that a master private/public key will be created from the seed phrase. Then, a child key is created under the parent key for the address.

Now, suppose this user completely loses their seed phrase / master keys, BUT they somehow have a copy of the child key pair that contains their Bitcoin.

Is it possible to recover their Bitcoin from that child key alone? If so, what is the process? Are individual child keys just the same as normal (non BIP-32) key/pairs?

Thanks!

8 – How to display content tagged with child terms in views?

I have a taxonomy vocabulary general in which I have a reference field to user roles allowed_roles.

I have two taxonomy terms. A and B where A is the parent of B.

Now I selected test_role in the A taxonomy term in allowed roles.

in the views I have added a relationship on Taxonomy term referenced from general.

In the contextual filter, I have added the allowed_roles with the above relationship and provided the test_role as value.

Now when I logged in with the user with role test_role, I can only see those content which are tagged with A. Which is default behaviour of the views and correct.

But I want that I should see all content of A and also those content which are tagged with the children of A.

is it possible with views? or I have to write a custom views relationship? Any idea?

9 – Book node entity to set child nodes access permissions

I’m working on a simple permissions module for books. This module should make a book with its child nodes private. The toplevel content type is called reader than I have a child content type edition and a child content type of edition is article.

In the content type reader I have a boolean field called Private (field_private). This can be turned on to make the node private.

My module is inspired by the Private Content module, this basically covers what I want. The only thing I need is to also set permissions of the child nodes.

The code I have written so far seems to work. But what I have to do now is save the toplevel reader and than save all child nodes manually. I’m wondering if it is possible to automatically set the permissions of the child nodes when the toplevel reader (parent) node is saved?

My guess is I have to iterate trough the children and change their views access permission. But how?

My code till now:
In my own private_content module I have a private_content.module file.

In this file I have a hook_node_grants function:

function private_content_node_grants(AccountInterface $account, $op){
  $grants = array();

  if ($op == 'view') {
    if (!$account->isAnonymous()) {
      $grants('private_author') = array($account->id());
    }
    if ($account->hasPermission('access private content')) {
      $grants('private_view') = array(PRIVATE_GRANT_ALL);
    }
  }
  return $grants;
}

And I have a hook_node_access_records function:

function private_content_node_access_records(NodeInterface $node){
  $grants = array();

  //check content type
  if ($node->bundle() == 'reader') {
    //if reader
    $book = $node;
  } else if ($node->bundle() == 'edition' || $node->bundle() == 'article') {
    //if edition or article
    //get parent book
    $book = Node::load($node->book('bid'));
  }

  //get private state from book
  $private = $book->field_private->get(0)->value;

  if ($node->status && $private == 1) {
    // Grant read access to users with 'access private content'.
    $grants() = array(
      'realm' => 'private_view',
      'gid' => PRIVATE_GRANT_ALL,
      'grant_view' => 1,
      'grant_update' => 0,
      'grant_delete' => 0,
      'priority' => 0,
    );

    // Grant read access to the owner, but not ANONYMOUS user.
    if (!$node->getOwner()->isAnonymous()) {
      $grants() = array(
        'realm' => 'private_author',
        'gid' => $node->getOwnerId(),
        'grant_view' => 1,
        'grant_update' => 0,
        'grant_delete' => 0,
        'priority' => 0,
      );
    }

    // Otherwise, deny read access for private nodes.
  }

  return $grants;
}

development strategy – Yet another child theme building question: Frankenchild themes

I’m about to build a new site based on a theme close to what I’m looking for. I understand the concepts around child theming & have read the caveats about overriding php or css files like the one described here.

Using such workarounds and calls from functions.php, is it possible to build a “Frankenchild theme” by taking chunks of a second (would-be parent) theme and patching them into the child theme? I’m not quite asking about creating a child of two parents; the child would only have one “official” parent.

As an example: Start with a Gantry basic theme and add custom taxonomy search capabilities & search results formatting (say a card-based carousel). Is that stepping over the line into plugin development?

filters – remove_action: how to access to a method in an child class?

You can’t. Not how you’ve written it. You need to be able to access the instance of ChildAdminClass somehow, but it only exists within the MainAdminClass class and isn’t exposed in any way.

In your code attempting to remove it you’ve referenced $child_admin as a global variable, but you didn’t create it as a global variable. If you did this:

public function init() {
    global $child_admin;

    $child_admin = new ChildAdminClass();
    $child_admin->init();
}

Now this would work:

global $child_admin;
remove_action('admin_notices', array($child_admin, 'printFoo'));

But global variables aren’t great. A better way to do this might be to store a reference to the instance of the child class as property on the main class:

class MainAdminClass {
    public $child_admin;

    public function init() {
        $this->child_admin = new ChildAdminClass();
        $this->child_admin->init();
    }
}

If you do it that way you can remove it like this:

remove_action('admin_notices', array($main_admin_class->child_admin, 'printFoo'));

That’s assuming that $main_admin_class is available in whichever scope you’re using this code in. This gets to the main issue: To remove an action from a class instance, you need to pass that exact instance. So this all comes down to variable scope and making sure that the class instances are accessible so that they can be used to remove hooks. Ultimately that’s a pure PHP issue, rather than anything specific to WordPress.

oracle – TNS-00534: Failed to grant connection ownership to child

when I tried to connect to my oracle instance with sql developer, I see this error in logs

TNS-12518: TNS:listener could not hand off client connection
 TNS-12560: TNS:protocol adapter error
  TNS-00534: Failed to grant connection ownership to child
   64-bit Windows Error: 10022: Unknown error

Can someone give me a poit how to solve this error. Note I have 64b client installed.

plugin development – how to delete network shared media images from child sites?

plugin development – how to delete network shared media images from child sites? – WordPress Development Stack Exchange

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123