WordPress.org

Support

Support » Plugins and Hacks » Hacks » Having trouble creating multi-site plugin for use with sub-sites

Having trouble creating multi-site plugin for use with sub-sites

  • I am trying to create a plugin where when I go to My Sites > Network Sites, there is a “Network Options” in Settings, and then when I go to a sub-site, there is a “Site Options” in Settings. Also I only want admins to see these options.

    I tried add_action(‘admin_menu’, ‘options_admin_actions’); but it does nothing (it worked on our 3.5 installation but not on our 3.5.1 installation). I’m not sure if the complicated documentation I’m reading is accurate as they’re all a little different and I’m unfamiliar with most of the functions there.

    Can someone point me in the right direction on this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi

    @esmi

    Forum Moderator

    Have you had a look at the Settings_API?

    This looks really involved… if we want to have a custom page where we just allow someone to modify four settings, is this required? Are there simpler options?

    esmi

    @esmi

    Forum Moderator

    is this required?

    Yep. Have a look at http://ottopress.com/2009/wordpress-settings-api-tutorial/

    Thank you! That’s an excellent tutorial. I was getting lost on how to even initiate some of those things.

    However, what I am actually doing (though it might not be necessary or adequate) is moving a plugin from a 3.5 install (which was configured before me) to a new 3.5.1 install and the code to put the menu item in Settings doesn’t work, and going to the page itself gives a permissions error. I have no idea how to troubleshoot it as a newbie.

    While it might not be the right way, here’s the code if you could give me some advice on it:

    // add feeder options to Settings menu
    function feeder_options_admin_actions() {
    add_submenu_page(“Feeder Options”, “Feeder Options”, ‘manage_network’, ‘feeder-options-admin’, ‘feeder_options_admin’);
    }

    add_action(‘admin_menu’, ‘feeder_options_admin_actions’);

    Moderator bcworkz

    @bcworkz

    Please carefully review the add_submenu_page() documentation. The positioning and usage of each parameter in your example appears to be off. The parameters are NOT the same as for add_memu_page(). Ensure the “Feeder Options” menu page is added before you try to attach a submenu to it. If it does not, you will get strange submenu behavior.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Having trouble creating multi-site plugin for use with sub-sites’ is closed to new replies.
Skip to toolbar