• Resolved finnsk3

    (@finnsk3)


    Hi,

    I have a production and dev site. On my dev site all roles are editable but on my production site I can only edit administrator, editor and subscriber. This also means I can only assign these 3 roles to users.

    Looking at get_editable_roles() it only returns those 3 but $wp_roles() gives me all of my roles. This means there must be a filter applied to editable_roles hook so I had a look at $wp_filter[‘editable_roles’] and compared between dev and production.

    Dev:
    [callbacks] => Array ( [10] => Array ( [000000007529fe0300000000234a5239fltHideRoles] => Array ( [function] => Array ( [0] => PublishPress\Permissions\Triggers Object ( [users_to_sync:PublishPress\Permissions\Triggers:private] => Array ( ) [revision_publication:PublishPress\Permissions\Triggers:private] => ) [1] => fltHideRoles ) [accepted_args] => 1 ) ) [99] => Array ( [000000007529fe3900000000234a5239fltEditableRoles] => Array ( [function] => Array ( [0] => PublishPress\Permissions\Collab\AdminFilters Object ( [inserting_post:PublishPress\Permissions\Collab\AdminFilters:private] => ) [1] => fltEditableRoles ) [accepted_args] => 1 ) ) )


    Production:
    [callbacks] => Array ( [10] => Array ( [000000005620f26d00000000314d8f89] => Array ( [function] => Closure Object ( [parameter] => Array ( [$all_roles] => ) ) [accepted_args] => 1 ) [00000000562084a600000000314d8f89fltHideRoles] => Array ( [function] => Array ( [0] => PublishPress\Permissions\Triggers Object ( [users_to_sync:PublishPress\Permissions\Triggers:private] => Array ( ) [revision_publication:PublishPress\Permissions\Triggers:private] => ) [1] => fltHideRoles ) [accepted_args] => 1 ) ) [99] => Array ( [00000000562084db00000000314d8f89fltEditableRoles] => Array ( [function] => Array ( [0] => PublishPress\Permissions\Collab\AdminFilters Object ( [inserting_post:PublishPress\Permissions\Collab\AdminFilters:private] => ) [1] => fltEditableRoles ) [accepted_args] => 1 ) ) )

    Note the additional callback on production which I assume is filtering out all of my roles. Dev is a clone of production but it’s a few months old. The interesting thing is, production has been like this ever since I built the site last year and I just assumed it was an issue with PP Capabilities and didn’t look in to it any further. Dev is literaly a clone of the prod database, fresh WP install with wp_content from Prod. wp_config.php is identical (db settings etc are all env variables)

    I have searched for ‘editable_roles’ through every plugin, through my theme etc and nothing stands out as adding this filter. Has anyone seen this before? have any ideas what could be causing it? The only thing I can think of is I only have my PP licences activated on prod but after reading through most of the code behind pp capabilities I can’t see anything that would filter editable_roles.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author PublishPress

    (@publishpress)

    Hi @finnsk3

    Many thanks for using PublishPress and the Pro versions of the plugins. Can I ask you to submit a support ticket on our site, please?

    We’re not allowed to support the commercial versions of our plugins here: https://www.ads-software.com/support/guidelines/#do-not-post-about-commercial-products

    Thread Starter finnsk3

    (@finnsk3)

    I don’t think it’s an issue with your plugin which is why I didn’t log a ticket. I just have a wierd filter applied to the editable_roles hook and I have no idea what is adding it. Just asking if anyone else has seen this kind of filter attached to the editable_roles hook.

    Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    @finnsk3

    The class output appears to be from the PublishPress Permission filter, not PublishPress Capabilities. Both PublishPress Permission and PublishPress Capabilities filter editable_roles, but the PublishPress Capabilities filter is mainly used to prevent an admin user from creating other users with higher capabilities. There’s no reason it should filter out other roles for administrators.

    Could you try deactivating PublishPress Capabilities and check the output for confirmation if the plugin is responsible for it? If the issue persists even without PublishPress Capabilities, try deactivating PublishPress Permissions to confirm.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Wierd editable_roles filter’ is closed to new replies.