WordPress.org

Ready to get started?Download WordPress

Forums

WP Help
[resolved] Used with Adminimize plugin & admin / editor roles (5 posts)

  1. hunnsdon
    Member
    Posted 2 years ago #

    After a long awaited update there was one issue for me that I now cannot get to operate. I need to lockout any user below admin (i.e. editor) from editing / managing or adding topics.

    Contacted Mark on his "markjaquith.wordpress.com" site. Got a good answer. Only I'm not an advanced user and don't know how to accomplish the advice.

    Mark wrote: July 18, 2012 at 2:31 pm
    "You’ll have to hook in and change the roles assigned to the ‘wp-help’ custom post type."

    See orginal post on that site: 2nd post - Two thirds down the page
    http://markjaquith.wordpress.com/2012/07/17/wp-help-one-dot-oh/

    I can quite happily follow step by step instructions in editing files.

  2. jancbeck
    Member
    Posted 2 years ago #

    Hey hunnsdon,

    when you look at the main wp-help.php file you see part where the custom post type is registered around line 100. The part where it sets the capabilities needed to read a post applies a filter

    'read_post' => apply_filters( 'cws_wp_help_view_documents_cap', 'edit_posts' ),

    To change this you would need to create something like this to your themes functions.php:

    <?php add_filter('cws_wp_help_view_documents_cap', function() { return 'manage_options';}) ?>

    This is not tested but should overwrite the default requirements to view the help files so only admins can see them.

  3. Jason Resnick
    Member
    Posted 2 years ago #

    hi jancbeck

    I tried this but getting a 500 error now and the site doesn't load at all until I remove it.

    Any help would be appreciated, thanks. Or if you can guide me in the right direction to get it to work.

  4. hunnsdon
    Member
    Posted 2 years ago #

    Unfortunately I've had to abandon this plugin for the time being as I need a way to hide editing from other users.

    If someone can come up with a solution then great, but until then I'm using 'Dashboard Site Notes' by Ben Irvin.

  5. jancbeck's filter would work on most servers but IIS servers (Windows) don't always play nice with anonymous functions. Using a more traditional filter should do the trick:

    function change_read_cap() {
    	return 'manage_options';
    }
    add_filter( 'cws_wp_help_view_documents_cap', 'change_read_cap' );

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic