[Support request] Let editor role manage Elements of type Header and be able to manage disp rules

Home Forums Support Let editor role manage Elements of type Header and be able to manage disp rules

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1191008
    José Carlos

    Hi, i would like to let ‘editor’ users to create and update Header elements. I’ve been able to let access to that option following this topic: https://generatepress.com/forums/topic/add-update-elements-for-specific-user-role/
    That thread was useful because i want exactly that. Once i’ve logged in as an editor, i can see the menu option ‘Elements’, and that’s fine, but the problem arrives when i want to create/edit a header. I go to the ‘display rules’ tab and in ‘location’ when i choose for example a page, no dropdown of pages appear at all. If i see the xhr calls at chrome inspector, i can see there is a call to wp-admin/admin-ajax.php with correct id, nonce and action (generate_elements_get_location_posts) values, but the return is always ‘0’. I’ve seen at source code at gp-premium/elements/class-metabox.php:line 1832 that if i comment out:
    /*if ( ! current_user_can( ‘manage_options’ ) ) {
    return;
    }*/
    i can select a page (or wahtever) logged in as editor, exactly what i want.
    So, at this point, i know at least 2 solutions to this:
    – assign manage_options capability to editors: but this.. you know, it will give editors too much control.
    – change source code of your premium plugin: problem with updates, etc.
    But i wonder if there is any other solution to this, any filter?

    Hope i’ve been clear in explanation. Any help is appreciated. Some ideas to get it to work?

    #1191318
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    This is a tough one, as that line is there for security purposes. We could filter it, but that could introduce security-related issues.

    Let me think about it – perhaps a filter which only allows manage_options and edit_posts would do the trick.

    #1191645
    José Carlos

    It seems like a very good idea to allow those two values. I think it’s a good option to add to the plugin.
    I’ll pay attention if you implement it (in the meanwhile i’ve modified the source), thank you very much for your good work

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