Skip Navigation

[Resolved] Toolset Access breaks site if updating after 2.7.2

This thread is resolved. Here is a description of the problem and solution.

Problem: I am trying to update Toolset Access but I get two errors:

PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in /home/xxx/public_html/wp-includes/class-wp-user.php on line 739

PHP Warning: array_key_exists(): The first argument should be either a string or an integer in /home/xxx/public_html/wp-content/plugins/types-access/application/controllers/permissions_post_types.php on line 447

Solution: In this particular case, it appears that there is a conflict with the site's theme. Activating a default theme during the update prevented the error, and then switching back to the custom theme was possible without errors.

This support ticket is created 5 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by lindsayH 5 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1356421

When I tried to update I was getting (after activating the plugin):

PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in /home/xxx/public_html/wp-includes/class-wp-user.php on line 739

And also PHP Warning: array_key_exists(): The first argument should be either a string or an integer in /home/xxx/public_html/wp-content/plugins/types-access/application/controllers/permissions_post_types.php on line 447 in the error_log

Using Duplicator I had to download as a DupArchive (i.e. creates a custom archive format - archive.daf). I then also managed to create an ordinary archive by ticking the Attempt Network Keep Alive in Duplicator - so you will also have a zip file.

Please do NOT work on my live site unless just browsing/looking because it's being constantly used during the week. Thank you.

#1356531

In my local tests, I was able to install this Duplicator clone and update Access to the latest version successfully. I will keep working on this and give you an update tomorrow, perhaps it's a PHP version or MySQL version difference.

#1357227

Hello again, I was running a few more tests today and found that the Dynamik-Gen child theme seems to a contributing factor in my local instance. If I activate the parent Genesis theme, then I can update and activate Access successfully. Then I am able to switch back to Dynamik-Gen without triggering any errors. Do you have a staging environment available to test this temporary workaround? If not, could you try the fix on the live site?

#1357379

I tried the fix on the live website and it appears to have worked. Many thanks.

Just a quick question, do you know how I could remove 'I want to add more roles to this user' from the profile. I want them to be able to change roles, but don't want this additional link to show.

I've tried using in a function I've used to remove other unnecessary profile headings etc but can't seem to get this to work
For example this works:

function remove_personal_options(){

if ( current_user_can('my_admin') ) {

    echo '<script type="text/javascript">jQuery(document).ready(function($) {

$(\'h2:contains("User Permissions"), h2:contains("Author Archive Settings"), h2:contains("Layout Settings") \').remove(); // remove the "User Permissions", "Author Archive Settings", "Layout Settings" 
});</script>';}
 
}
add_action('admin_head','remove_personal_options');

So I tried targeting a.js-taccess-show-additionl-roles but this doesn't work.
and also in the above function:

$( "#profile-page table" ).eq( -2 ).css( "display", "none" );

But of course in this case targeting the class js-taccess-show-additionl-roles (again doesn't work).

I've also tried calling a css file to make changes to the back end (which works for other things)
.js-taccess-show-additionl-roles {
display: none;
}
But again doesn't work.

Could you advise or if you can't can I put in a request that we could hide this new option if not required - even if they have the promote_users capability.

#1357997
Screen Shot 2019-10-08 at 10.18.37 AM.png

I don't know of a way to disable that link using any options or plugin settings, but the pure CSS solution should work while you file a feature request - https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

How exactly have you added the CSS? This code works for me:

.js-taccess-show-additionl-roles {
  display: none;
}

I added that to a CSS file called admin-style.css, in my child theme directory. Then in functions.php I registered and enqueued that admin stylesheet:

function load_custom_wp_admin_style() {
        wp_register_style( 'custom_wp_admin_css', get_stylesheet_directory_uri() . '/admin-style.css', false, '1.0.0' );
        wp_enqueue_style( 'custom_wp_admin_css' );
}
add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );

You can see in the inspector screenshot here the stylesheet is loaded, the CSS rule is applied to the link, and the link is hidden as expected.

#1358255

My issue is resolved now. Thank you!