WordPress.org

Ready to get started?Download WordPress

Forums

Locking layout of post write panel metabox per user role (3 posts)

  1. Gaalen Engen
    Member
    Posted 1 year ago #

    Is there a way to set the layout of the write panel and lock it per user role. In short, can you make the write panel metabox layout the same for every Author role?

  2. bcworkz
    Member
    Posted 1 year ago #

    Probably, couldn't say for sure. One issue is the layout is stored per user, not by role, so for every Author user, you would need to set the metabox order in the user options.

    Then you need to stop them from being able to change it somehow. I'm unsure exactly how the layout gets saved, but it ends up in the user option "meta-box-order_$page" where $page is the screen ID from the object returned by get_current_screen();

    This might mean that the function update_metadata() is involved at some point. If so, you could hook the filter "update_user_metadata" and for Author users, cause the desired value to be stored each time, regardless of what the user tries to do. This would likely result in the user being able to move the boxes about, but once the page reloads, the boxes are back to the original configuration. Might be useful to somehow throw an error telling them not to bother.

    Not a real answer, but a direction to investigate, I hope it's useful to you.

  3. Gaalen Engen
    Member
    Posted 1 year ago #

    This gives me some place to start, thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic