WordPress.org

Ready to get started?Download WordPress

Ideas

Separate out the capability for editing widgets

  1. Mark
    Member

    12345

    Currently the capability to edit widgets is subsumed under the 'Switch themes' capability, which by default belongs to the Admin role. This no longer makes sense; widgets have become sufficiently important to any WP-based site to warrant some degree of independence in the roles and capabilities system.

    Consider the common scenario of blogs or sites designed for clients. Very often you don't want your client to be able to mess with changing themes; but of course they should be able to edit and change widgets! Currently there is no reliable way to do this; one has resort to kluges like giving them the capability 'Switch Themes' but hiding the themes page from them.

    Also, since widgets nowadays contain content that should be managed by editors, I would argue that this new widget-related capability should be enabled for the Editor role by default (while the 'Switch themes' capability should remain limited to Admins by default).

    Posted: 4 years ago #
  2. Justin Tadlock
    Member

    12345

    +1 for an additional capability used to edit widgets.

    -100 for giving this to the editor role by default. This is especially so for backwards compatibility.

    Posted: 4 years ago #
  3. Mark
    Member

    12345

    Fair enough, good point about backwards compatibility.

    Posted: 4 years ago #
  4. slee
    Member

    12345

    +1 this is a must!

    it needs to be set with a new capability i think. so we can then set it in the function file for who should see it.

    Posted: 4 years ago #
  5. Justin Tadlock
    Member

    12345

    I would likely name this cap manage_widgets.

    Posted: 4 years ago #
  6. Jeffrey
    Member

    I've been trying to make editors able to change the sidebar...
    And I ended up having the exact same problem, even though the roles and capabilities page says there is an option for it! (edit_theme_options)
    But it doesn't exist...

    So this idea is great untill then I still need it!

    So I've come up with a work around..
    Might not be the best way but it works..
    Hides theme link and if the user clicks the "Appearance" button (which would go to theme.php) it checks wether the user is an editor and then redirects it to widgets.php...

    So for an editor it would look like this:

    if(is_admin()){
    	$role =& get_role('editor');
    	$role->add_cap('switch_themes');
    	if (!current_user_can( 'manage_options' )){
    		echo '<style type="text/css">.wp-first-item { display: none;}</style>';
    		$current_page =  "http://" . $_SERVER['HTTP_HOST']  . $_SERVER['REQUEST_URI'];
    		$dont_visit_this = "http://" . $_SERVER['HTTP_HOST']  . "/wp-admin/themes.php";
    		if ($current_page == $dont_visit_this){
    			header("Location: http://" . $_SERVER['HTTP_HOST']  . "/wp-admin/widgets.php");
    		}
    	}
    }

    EDIT: CHANGE the escaped characters < = < and " = " etcetera

    Posted: 4 years ago #
  7. Andrew Nacin
    WordPress Dev

    The cap is called edit_theme_options in 3.0. Consider this idea implemented.

    Posted: 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    9 Votes
  • Status

    This idea has been implemented