The MU forums have moved to

Confused about MU plugin writing. (6 posts)

  1. ratbastid
    Posted 18 years ago #

    Are there different hooks for MU than for normal wordpress? I'm writing a plugin that requires a configuration screen on the individual blog-owners' admin menu, and the normal set of functions I use for that don't seem to work.

    function dwr_add_menu() {
    add_options_page('Plugin Settings','Plugin Settings', 8, __FILE__, 'dwr_opts_page');

    function dwr_opts_page() {


    The goods represented by "..." never show up as a sub-page of Options the way I'd expect them to. What am I supposed to know here?

    Also (second question)--is there a function to get and and set site meta fields? I see the wp_sitemeta table, which is the perfect place to put the config stuff from this plugin, and I'm not above using $wpdb to get and set it, but if there's already a tag, I'd love to use it.

  2. itdamager
    Posted 18 years ago #

    Everything is the same except wpmu gives some additional commands to save and retrieve sitewide settings (and maybe a couple of hooks too).

    If you are wanting all users to set options for themselves, use get_option and update_option to save options in each users individual options table, but if you are writing a plugin with 'sitewide' settings, use get_site_option and update_site_option which saves 'sitewide' settings in the sitemeta table.

  3. ratbastid
    Posted 18 years ago #

    I found my mistake--I thought that activating the plugin as the main admin user would cascade the activation to the individual blogs. But that's what mu-plugins is for! Got it!

    And I see the behavior of get_ and update_option versus get_site_ and update_site_option. Next question: what table are the individual bloggers' options held in? I would have expected to see them in wp_usermeta, but the fields I'm creating aren't showing up there.

  4. itdamager
    Posted 18 years ago #

    The options are 'blog' options, not 'user' options.

    Each blog will have its own options table named in the format prefix_blogid_options. If you browse the database using a tool like phpmyadmin, you'll see them.

  5. ratbastid
    Posted 18 years ago #

    It certainly seems like they ought to be going in those tables, but I'm not seeing that when I examine the pages with phpmyadmin. Yet the values update appropriately in the form I built, and respond appropriately to get_option when I repopulate those fields on page load.

    In other words, I can get_ and update_ them just great, but they're not showing up in the table I think they ought to be stored in.

    Now, I'm a command-line MySQL guy who's forced to deal with phpmysqladmin for this particular client... Is there something I need to know about refreshing phpmysqladmin or something?

  6. itdamager
    Posted 18 years ago #

    The options are there.

    I merely suggested phpmyadmin, but any client, including cli will work.


    use dbname;
    select * from wp_1_options where meta_key = 'myoptionname';

    That should work from a mysql command line.

About this Topic

  • Started 18 years ago by ratbastid
  • Latest reply from itdamager