WordPress.org

Ready to get started?Download WordPress

Forums

How do I disabled/hide settings for blog administrators? (11 posts)

  1. Tom Lynch
    Member
    Posted 3 years ago #

    I am looking for a way to selectively hide or disable the settings for blog administrators on by WordPress Multisite Network.

    I don't want to disable whole pages of settings however so I can't simply modify the administrator role to not include those...

    I have thought of a few ideas but with much of this aspect of Core not being pluggable I am out of ideas, please help!

    1. Use ob_start() to parse the output and regex the fields into oblivion however that is a brutal and easily broken hack and there aren't and hooks at the top and bottom of the settings pages.
    2. Use CSS to hide the GUI and filters on update_option() but this isn't really possible because there are no classes or IDs on any of the fields.
    3. Use to select input[name=xxx] but that isn't supported on all browsers and I wouldn't be able prevent editing unless I hid the field which would make it
    4. Use JS to find the input[name=xxx] and navigate backup the DOM to the parent list item, this would work but I am not happy with the JS requirement.

    Any help would be great, it will make its way into a new plugin at some point if anyone has an idea although right now I am sersiously considering speaking with core devs about adding this feature because it seems obvious you might want default settings in Site Admin which are either defaults or locked settings which hide from the blog admins.

  2. Tom Lynch
    Member
    Posted 3 years ago #

    Thanks for the reply but this is not the solution if you read my original post it says I don't simply want to hide menus. I want to disable fields. Also I already have te second plugin but it doesn't do the first thing.

  3. Tom Lynch
    Member
    Posted 3 years ago #

    @ipstenu that unfortunately does the same as the other one, it only disables the whole menu item, I want to be even more specific and disable fields on that page, like for example on the Settings > General page I want to disable Timezone, Date Format, Time Format, Week Starts On, and Site language and use my settings for that.

    I have been playing about with some code to block the update of the setting and post an error message at the top, and I have also managed to find a way to use javascript to disable the field or hide it but I am frustrated that every time I get somewhere I hit another wall and I am not convinced of the value of this code to hide it properly.

  4. You'll have to look at the code on those pages and see if they have any hooks or filters around them that you could use.

  5. Tom Lynch
    Member
    Posted 3 years ago #

    @Andrea_r I already did that which is why I am saying that "much of this aspect of [is] Core not ... pluggable"

    Anyways, looks like this isn't possible there is a ticket open in trac for the core developers to make use of the Settings API which would enable me to write a plugin for WordPress myself.

    Big issue with that is that there is no remove function for removing Settings added with the API... *sigh* I think the WordPress gods are against me, I am just hoping that it makes it into WordPress 3.3 when they do the CSS re-jig.

  6. Jason Lemahieu (MadtownLems)
    Member
    Posted 2 years ago #

    Tom - I feel your pain. Can you link me to the ticket you mentioned?

  7. Tom Lynch
    Member
    Posted 2 years ago #

    @MadtownLems This is a bit of it but it wass scheduled for 3.2, then moved to 3.3 and then moved to 3.4 and its really annoying, they have to rewrite the API and were still making decisions so it got dropped and somewhat forgotten to be honest.

    http://core.trac.wordpress.org/ticket/15865

  8. Jason Lemahieu (MadtownLems)
    Member
    Posted 2 years ago #

    @Tom - Ugh.

    For reference, here's what we've done internally when we need this. Use jQuery and/or CSS to hide the form elements (or replace with a message explaining why they are not available), and also run code to update the options/settings whenever the page is submitted to ensure nobody tries to cheat and bring the form elements back.

    hacky and annoying, but the best we've come up with

  9. Tom Lynch
    Member
    Posted 2 years ago #

    Sure I tried that but it's actually not that easy for what I want to do which is to create a plugin which allows a network administrator for each setting to define a default value and enable, disable or completely hide the setting from the administrator.

Topic Closed

This topic has been closed to new replies.

About this Topic