• Resolved sharris203

    (@sharris203)


    Hi guys, I know of various plugins to create roles and capabilities, but is it possible to make a user with capability to Edit Pages, but not to create new pages?

Viewing 15 replies - 1 through 15 (of 31 total)
  • Shane G.

    (@shane-g-1)

    Hi,

    Check with this plugin:

    https://www.ads-software.com/extend/plugins/role-scoper/

    Thanks,

    Shane G.

    Thread Starter sharris203

    (@sharris203)

    Here’s all of what I’m trying to do: The only options I want users to have is to be able to upload and delete files, and to be able to edit existing pages. A very limited account.

    Role Scoper does have tons of options, but I can’t figure out how to remove/hide the link to Add New pages. If I had some CSS code to hide all submenus I think that may work.

    Also, how can I allow them to not just upload files, but also to delete files? It seems all the plugins I try allow them to upload but not delete.

    If you’re unable to get the functionality you would like (or require) from the plugins available, then you’re left with pretty much two options.

    1. Modify/hack the code to do what you want.
    2. Employ a developer to write the customisation for you.

    Alternative role management plugin:
    https://www.ads-software.com/extend/plugins/members/

    If you decide to use Role Scoper, start with a user whose WP role is Subscriber, Contributor or Author. Then assign (Roles > Pages) that user a Page Editor role for desired page(s). They will not be able to create new pages unless you also also give them a General Role (Roles > General) of Page Author.

    Thread Starter sharris203

    (@sharris203)

    Worked great! Thanks kevinB

    Know how to hide the Tools menu on the left?

    Remove the tools menu.

    function remove_tools_menu() {
    	global $menu;
    	unset( $menu[75] );
    }
    add_action( 'admin_menu' , 'remove_tools_menu' );

    Thread Starter sharris203

    (@sharris203)

    Great! Thanks t31os_! Hmm, just a couple more things…

    Any plugin to hide the user’s Profile (but not the entire admin area)? And in the header, change Howdy to Hello, and remove Turbo?

    Thread Starter sharris203

    (@sharris203)

    Solved!

    Used WP Hide Dashboard to hide the tools menu, plus various other plugins.

    I was beginning to think this was plugin ground, glad you were able to find something to suit your needs.. ??

    Thread Starter sharris203

    (@sharris203)

    1 more thing: How can i hide/unset a submenu item? I’m using WP Hide Dashboard so all i need is the unset function. I want to remove the submenu item: $submenu[‘edit-pages.php’][10]…

    $menu[20] = array( __('Pages'), 'edit_pages', 'edit-pages.php', '', 'menu-top', 'menu-pages', 'div' );
    	$submenu['edit-pages.php'][5] = array( __('Edit'), 'edit_pages', 'edit-pages.php' );
    	/* translators: add new page */
    	$submenu['edit-pages.php'][10] = array( _x('Add New', 'page'), 'edit_pages', 'page-new.php' );

    The Add New Page submenu does not function for subscribes but they can still see it and I want to remove it from the menu.

    I have tried this but it didn’t work:
    unset($submenu['edit-pages.php'][10]);

    Assuming you’re following the previous example, global the $submenu variable, then unset..

    global $submenu;
    unset( $submenu['edit-pages.php'][10] );

    As i did in the example with the $menu variable..

    Thread Starter sharris203

    (@sharris203)

    Thanks. Well, one more small customization that shouldn’t be too hard. I want to use CSS to hide “Add New” buttons on the admin pages.

    This specifically
    <a href="page-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'page'); ?></a>
    and for the code I tried
    button add-new-h2 { visibility:hidden; } in wp-admin.css
    but it didn’t work. Any thoughts?

    Classes are denoted by a period(dot/fullstop) in CSS, and mutliple classes on the same element do not have a space(well not in the CSS at least)..

    Try the following..

    .button.add-new-h2 {
    	visibility:hidden;
    	display:none;
    }

    Thread Starter sharris203

    (@sharris203)

    Tried that but it didnt work. Found this: https://www.maxdesign.com.au/articles/multiple-classes/ so your code should be correct. Maybe there’s a different CSS file I need to use. None of these work

    .button.add-new-h2 {
    	visibility:hidden;
    	display:none;
    }
    .button add-new-h2 {
    	visibility:hidden;
    	display:none;
    }
    button.add-new-h2 {
    	visibility:hidden;
    	display:none;
    }
    .add-new-h2 {
    	visibility:hidden;
    	display:none;
    }
    a.button.add-new-h2 {
    	visibility:hidden;
    	display:none;
    }
    a.button add-new-h2 {
    	visibility:hidden;
    	display:none;
    }
    a.button:add-new-h2 {
    	visibility:hidden;
    	display:none;
    }
    a.add-new-h2 {
    	visibility:hidden;
    	display:none;
    }

    Try the CSS definitions with !important..

    eg.

    .button.add-new-h2 {
    	visibility:hidden!important;
    	display:none!important;
    }

    Is there a particular reason you can’t just unset this one, like with the others?

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘Possible to make user Capability to Edit Pages, but not to create new pages?’ is closed to new replies.