The MU forums have moved to WordPress.org

How to determine if the platform is MU (9 posts)

  1. YellowSwordfish
    Member
    Posted 16 years ago #

    I am the author of a forum plugin for WP which has a few MU users as well. I am trying, in the next version, to ensure that it will install correctly within MU as currently users have to make a small handful of edits with each upgrade. Sadly, I am unable to install MU at the moment to check this myself. I have four simple questions the answers to which would enable me to achieve this.

    1: As I understand it the $wpdb-> prefix returns the correct prefix for all except the ‘users’ and ‘usermeta’ tables. I have been informed by users that these two tables are always simply prefixed ‘wp_’. Is this correct?

    2: Part of the install is to create a WP ‘page’ record. In standard WP the table data changed for this between versions 2.0 and 2.1 so I have to branch the code dependent upon version. is there a method of determining the current version of MU in relation to the original WP version? Or, failing that, do all versions of MU use the later, 2.1 codebase?

    3: This only becomes relevant if there is a foolproof method of determining if the host system is MU or not. I assume there must be a method of doing this. Does anyone know how this is done?

    4: Finally the forthcoming WP 2.3 is making sweeping changes to the category sub-system and I do need to make some changes to support that. This ties in a little with question 2 - i.e., how does one tell if MU is built on the WP2.3 codebase?

    I would be very grateful if anyone is able to answer these questions. It would be nice to enable my users not to have to make hacks to the code with every upgrade or new install of the plugin. Thanks.

  2. DragonFlyEye
    Member
    Posted 16 years ago #

    I can't claim to be an authority, here, but I'll chime in on what I can:

    1. this is just like plain-vanilla WP, in that you can set the prefix for the tables however you'd like in the config.php file.

  3. andrea_r
    Moderator
    Posted 16 years ago #

    #3 check for is_site_admin. That's an MU-specific basic hook.

  4. drmiketemp
    Member
    Posted 16 years ago #

    Hi Mark. (I think it's Mark) Sorry I never got back to you. Get over a hundred emails a day and my inbox is fairly full. I no longer have a wpmu install myself so I really couldn't go through the code for you.

    I (and Andrea also as well I believe) was using a special plugin from http://premium.wpmudev.org that allowed for multiple databases to contain the different sets of blogs allong with a global database that contained the sitewide tables. I raised the issue with Andrew as well as I had another plugin that wasn't seeing the correct database either. $wpdb->prefix shoudl ahve worked but for some reason, it didn't with your plugin or the other. It did work for some though. Damn if I know why....

    #2, yup. Using the 2.1+ code. The page got created fine except for hte issue we previously discussed with $wp_verion not being the same as in regular wordpress. Still not sure why those two fields didn;t get filled in though and have no way to test any longer.

    Andrew, maybe dropped Mark a copy of the multiple database plugin might do some good here. :)

    #3: is_site_admin isn't a global though unless it's declaired.

    Do a check within $wp_version for 'wordpress-mu'. It's set in the version.php file

    #4 We know nothing about #4 I'm afraid.

    Regards and thanks,
    -drmike

  5. lunabyte
    Member
    Posted 16 years ago #

    4:

    For MU, in /wp-includes/version.php the version is listed as:

    "wordpress-mu-1.2.3-2.2.1"

    for example.

    Which would be the version of MU, followed by the version of WP which it's built on. You could explode that by the dash, and grab array key 3.

  6. drmiketemp
    Member
    Posted 16 years ago #

    Actually that got changed recently, Luke.

    http://trac.mu.wordpress.org/changeset/1038

  7. lunabyte
    Member
    Posted 16 years ago #

    Works for me then.
    Being able to check a var like that would be easier.

    See Doc, you did know something about #4. ;)

  8. YellowSwordfish
    Member
    Posted 16 years ago #

    Sorry to be late replying - I have been moving hosts which is always a trauma! Thanks everyone for their help. Also thanks to xiando who emailed me some information and has been helping.

    I've got the determination that the host is MU licked I think and the version dealt with. I am still having a little problem with the table prefix and I think I understand now why. As far as I can tell my users on MU do not install this for their own blog but as a forum for all blogs on their MU setup. Thus the users and usermeta tables are shared. At least I think that's the setup! I need now to talk to some of them I think.

    Thank you all for the help. I think I best have another go at installing it when I can get a chance to clean up a spare box!

  9. omry
    Member
    Posted 16 years ago #

About this Topic

  • Started 16 years ago by YellowSwordfish
  • Latest reply from omry