• Dear support team,

    your great plugin admin page is accessible when a user can ‘create_users’, which could basically be understood as a correct approach.

    One of my users, however, is capable to create and administer other users but should not be able to use your plugin admin page for a number of reasons.

    It would therefore be great if your plugin admin page was only accessible by a new specific acui-capability to have more overall control.

    Would you consider this to be an interesting approach or would you rather think this is a bad idea?

    Thanks and best regards

    Michael

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Javier Carazo

    (@carazo)

    @mitfi,

    Creates a new capability could be a solution, but maybe this can create problems.

    We can try to do it or maybe we can create a filter in order to override this capability.

    What do you think?

    Dear @carazo,

    many thanks for your fast response!

    I understand that you consider an additional capability to be tricky in some cases, hence, a filter would indeed be fine.

    By the way:
    In my functions.php, I tried to use remove_submenu_page(‘tools.php’, ‘acui’) for non-admins without success…
    Therefore, in your plug-in‘s function acui_menu(), I changed the capability directly, which is a rather bad solution – but working.

    Again, thanks for your kind support!

    Best regards

    Michael

    Little add-On:

    I assume, in your file ‘import-users-from-csv-with-meta.php’, you would modify line 172 to something like
    add_submenu_page( ‘tools.php’, __( ‘Import and export users and customers’, ‘import-users-from-csv-with-meta’ ), __( ‘Import and export users and customers’, ‘import-users-from-csv-with-meta’ ), apply_filters( ‘acui_capability’, ‘create_users’ ), ‘acui’, ‘acui_options’ );
    in order to be able to add a filter and returning a different capability.

    Correct?

    Best regards

    Michael

    Plugin Author Javier Carazo

    (@carazo)

    Yes, this is maybe not the best solution but this is the fastest and it solve your problem.

    Creates a new capability surely creates more problems for other users.

    I have just included in new version. Update when you see it available.

    Dear @carazo,

    as you are surely more experienced with WordPress than I am and it is good for me to learn:
    What would you consider a better solution (besides allowing to select the related capability directly from the plugin‘s admin page)?

    Thanks for you outstanding responsiveness and support!

    Kindest regards

    Michael

    Plugin Author Javier Carazo

    (@carazo)

    @mitfi,

    The best solution surely would be create a new capability.

    But yes, the filter is enough.

    @carazo,

    thx!

    In my ’functions.php’, I create a new administrator capability ’manage_acui’ and filter for it thanks to your kind modification.

    Now, I can set any role to this capability.

    Best regards

    Michael

    Plugin Author Javier Carazo

    (@carazo)

    @mitfi,

    Thanks to you for using our plugin!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Show plugin admin page on specific capability only’ is closed to new replies.