WordPress.org

Ready to get started?Download WordPress

Forums

Custom Sidebars
[Plugin: Custom sidebars] User Types Other Than Admin Cannot Save Sidebars (4 posts)

  1. Copernicus
    Member
    Posted 2 years ago #

    Hello,

    Thanks so much for this great plugin!

    Everything is working perfectly when editing pages with an admin-level account. However, if I try to set or modify a page's custom sidebar in any other account level (such as an editor), the selected sidebar does not "stick."

    For example, if the drop-down for one of the sidebars is blank, I'll select the desired custom sidebar and then click "update" for the page. As the page is saved & the page's editing interface refreshes, the sidebar is once again blank.

    Performing the same action while logged in as an "admin," everything works great.

    Is there some way to fix this for non-admin-level users so that they can set custom sidebars?

    Thanks again!

    http://wordpress.org/extend/plugins/custom-sidebars/

  2. Copernicus
    Member
    Posted 2 years ago #

    I may have partially answered my own question...

    It seems that this is an issue with the plugin specifying that users must have the capability to "switch themes" (which is usually reserved for admins) in order for them to set/edit the custom sidebars.

    To change this so that other user types can set sidebars, I edited the file "customsidebars.php" (in the "custom-sidebars" plugin folder, of course), in the following manner:

    Around line 27 in v0.8.2, (or, perhaps line 53 if your code has double lines), I changed the following:

    var $cap_required = 'switch_themes';

    to

    var $cap_required = 'edit_pages';

    That means that any user with the capability to "edit pages" will be able to set the custom sidebars.

    There is probably a more elegant (and longer-term) solution to this, but this seems to be a good quick fix.

  3. Carsten Bach
    Member
    Posted 1 year ago #

    I stumbled over the exact same problem.
    Maybe the Plugin-Author could replace this line with soemthing like this:

    var $cap_required = apply_filters( 'custom_sidebars_cap_required', 'switch_themes' );

    Using a filter would give web-developers using the Plugin the freedom to choose what user Level will be able to edit the sidebars, without the need of editing the Plugin core-files.

  4. Carsten Bach
    Member
    Posted 1 year ago #

    I've to go back.
    It is not possible to define a CLASS var with a function return, so my solution won't fix the problem.

    It seems that the only way will be to give your desired role, the capability of "switch_themes".

    Not the best way, I think.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic