WordPress.org

Support

Support » How-To and Troubleshooting » Manage Widget Capability

Manage Widget Capability

  • rizaldy

    @rizaldy

    hai, can someone help me on this.
    i tried to add “editor” capability to manage widget, just widget without switching_theme capability. but can’t seem to find how to do it.

    i already try some role&capability plugin, but there’s nothing seems mention about managing widget. Is there a way to do it ?

    thanks…
    -Rizaldy-

Viewing 4 replies - 1 through 4 (of 4 total)
  • dojopan

    @dojopan

    I’m having the exact same problem so I’m seconding that question.

    Me too – I have installed SideBlog and I want the editor to be able to add or delete as they wish but I can’t even see anything that mentions widgets.

    Looking at the code I don’t think you can separate the two, theme switching and widget editing that is.

    For just allowing editors to editor widgets I added:

    if(is_admin()){
    $role =& get_role(‘editor’);
    $role->add_cap(‘switch_themes’);
    }

    to functions.php in my theme and it worked. But it also enables theme switching.

    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 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");
    		}
    	}
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Manage Widget Capability’ is closed to new replies.
Skip to toolbar