• Resolved chrisplaneta

    (@chrisplaneta)


    Hi,

    I’m setting up a WP Multisite project in which I have to create additional admin pages for each sub site. These pages have to hold data that needs to remain intact after switching themes, e.g. social links, page slogan, address with map, logo and favicon. That’s why I hope to use your options framework.

    And here’s my first question. Am I correct to think that in order to have options “hooked” to the right subsite I will have to make unique keys for options in each site? I’m thinking about passing get_current_blog_id() and passing it to the key of each option. Is it necesssary?

    My second question is something I hope your Framework can do but I haven’t found any documentation on the topic. The thing is that administrators of subsites won’t have the manage_options capability. However, I’ve created for them a manage_subsite_settings custom capability that I would like to use to show them the extra admin pages. However for the life of me I cannot find a place where to put the capability. Is there one?

    Best regards and keep up the great work with your framework. It looks and feels really polished.

    Chris

    https://wordpress.org/plugins/admin-page-framework/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author miunosoft

    (@miunosoft)

    Hi,

    Am I correct to think that in order to have options “hooked” to the right subsite I will have to make unique keys for options in each site?

    No. You should be able to use the same option key in each sub-site.

    I’m thinking about passing get_current_blog_id() and passing it to the key of each option. Is it necesssary?

    It should not be necessary. WordPress Multisite creates a set of database tables for each sub-site that includes the wp_options table. That means each sub-site has a separate options table. The framework inserts a row into the options-table to store submitted form data with the key of your choosing (by default the instantiated class name). And as far as I know, each plugin is performed per sub-site basis on a network. That means the framework is also performed like so when it is included in your plugin. In other words, the framework stores data in each sub-site’s options-table.

    I suggest you create a very simple plugin with a form of a single input field (an example is available in the front page of the framework’s Github page: https://github.com/michaeluno/admin-page-framework). And make it network-activated then see if it stores the data as you expect in each sub-site.

    My second question is something I hope your Framework can do but I haven’t found any documentation on the topic. The thing is that administrators of subsites won’t have the manage_options capability. However, I’ve created for them a manage_subsite_settings custom capability that I would like to use to show them the extra admin pages. However for the life of me I cannot find a place where to put the capability. Is there one?

    To set an overall capability, you can either pass it to the third parameter of the constructor or use the setCapability() method in the setUp() method.

    To set individual capability per page bases, you can set it with the capability option in the parameter of the addSubMenuItems() method.

    Hope it helps!

    Thread Starter chrisplaneta

    (@chrisplaneta)

    Thank you for your quick reply and good news! I’m getting to work then:)

    Thread Starter chrisplaneta

    (@chrisplaneta)

    Oh. And I’m marking this post as resolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Creating admin pages for WP Multisite Subsites’ is closed to new replies.