Change WordPress user roles and capabilities Forums Bug Reports Admin profile lost some of the Categories after latest update

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #4409
    sami.niemi
    Participant

    Hi!

    After the latest update users with admin account lost some of the Post Categories in the admin panel. Categories are shown normally if you open the categories page, but they are not shown on any of the listing (like list all posts) or in the dropdown menus (in widgets) or select menus (in selecting a category for a new post).
    Some Categories are shown, but not all.

    Categories are shown normally if you log in using other roles.

    Any idea what could be causing this?

    #4410
    Vladimir
    Keymaster

    Hi,

    Do those users has a custom role with administrator privileges or do you write about about users with ‘administrator’ role?

    Do you use Edit restrictions add-on? If ‘Yes’, try to deactivate it. Will it help? If Yes, activate this add-on back and re-check if role(s) granted to user is restricted by add-on or user itself has restricted access to posts editing.

    #4412
    sami.niemi
    Participant

    Hi

    When logged in as a Administrator (role), some of the categories are missing.

    Yes, we have edit restrictions on, but naturally Administrator is set to “allow”. With all the fields left empty.

    Administrator should have and full rights, and so it would seem when I check the role’s permissions from the settings.

    De-activating edit restrictions didn’t help.

    #4413
    Vladimir
    Keymaster

    User Role Editor (URE) does not set any restrictions for administrator role.
    Check if URE deactivation will help to understand that problem is related exactly to URE.

    #4417
    sami.niemi
    Participant

    Hi

    Deactivating User role editor pro did help. It solved the issue.

    Unfortunately after turning it back on, I have the same issue.

    And as I said, I can see the Categories in the Categories page and can even edit them. Issue is that that some of the categories are not shown for display or select.

    Below there are two sreencaps from the All posts view to demonstrate my point:
    – Categories when User role editor pro is disabled and when I’m logged in as an administrator or
    when logged in as a editor when user role editor pro is enabled:

    View post on imgur.com

    -Categories when User role editor is enabled and I’m logged in as an Administrator:
    https://i.imgur.com/86B5VzR.jpg’
    At the same time I can see and edit the categories on the categories page

    View post on imgur.com

    #4418
    Vladimir
    Keymaster

    Thanks for the additional details. I meet a such issue the 1st time.
    Is it possible to look at your site with ‘administrator’ privileges? If ‘Yes’, send login credentials to support [at-sign] role-editor.com

    #4433

    I am seeing the same error with custom post type taxonomies. this is seen even in the super admin role on a multisite

    #4434

    Going back to 4.37 pro fixes the issue

    #4435
    Vladimir
    Keymaster

    Hi,

    Thanks for this information. It seems I could introduce a bug. Can you try a quick workaround?
    Open v. 4.38 wp-content/plugins/user-role-editor-pro/pro/includes/classes/post-edit-access.php, go to line #470, where function exclude_terms() is defined. Replace this part

    
            if (!in_array($pagenow, array('edit.php', 'post.php', 'post-new.php'))) {
                return $exclusions;
            }
            
            $terms_list_str = $this->user->get_post_categories_list();
    

    with this version:

    
            if (!in_array($pagenow, array('edit.php', 'post.php', 'post-new.php'))) {
                return $exclusions;
            }
            
            if (!$this->user->is_restriction_applicable()) {
                return;
            }
            
            $terms_list_str = $this->user->get_post_categories_list();
    

    Updated version will not apply this restriction to a user with superadmin privileges.
    I included this fix to the code and it will be available with the next update. Just wish to test it with your help to be sure, that I identified a problem correctly.

    #4436

    Will do, unfortunately we are on holiday here in the states until the 27th. As always thanks for the awesome support

    #4437
    sami.niemi
    Participant

    Hi

    This workaround fixed the issue! Thank you!

    I still somehow get Category ID 12 as the default category instead of category ID 1 when making a new post, but as category 12 is not in use, that is not an issue for me.

    Br Sami Niemi

    #4438
    Vladimir
    Keymaster

    Thanks for the help with isolating this issue and testing a fix for it.

    Sami, default category is assigned to the post created by super-admin for the same reason. I removed the early current user permissions checking (which were made for any wp-admin page) in v. 4.38, but did not re-check that the same permissions check is done later for the all used hooks.

    If there will be a need to fix it before the next update become available, open the same v. 4.38 wp-content/plugins/user-role-editor-pro/pro/includes/classes/post-edit-access.php file, find auto_assign_term() function declaration and add current user permissions checking, like on the image below:

    fix bug with auto assign term for admin


    public function auto_assign_term($post_id, $post, $update) {
    if (empty($post_id)) {
    return;
    }
    if ($post->post_type=='revision') { // Do nothing with revisions
    return;
    }
    // do not limit user with Administrator role or the user for whome posts/pages edit restrictions were not set
    if (!$this->user->is_restriction_applicable()) {
    return;
    }
    $terms_list_str = $this->user->get_post_categories_list();

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.