WordPress.org

Ready to get started?Download WordPress

Forums

Manage Widget Capability (5 posts)

  1. rizaldy
    Member
    Posted 4 years ago #

    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-

  2. dojopan
    Member
    Posted 4 years ago #

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

  3. Debwork
    Member
    Posted 4 years ago #

    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.

  4. lerizzle
    Member
    Posted 4 years ago #

    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.

  5. Jeffrey
    Member
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic