The MU forums have moved to WordPress.org

get logged on user site url or check for mu version (5 posts)

  1. teamplaylotto
    Member
    Posted 15 years ago #

    I want to make my plugin compatible with logged on users of an MU site.
    I need to add a hidden field to the comment form with the user's blog url

    I can do a query on the wpdb with the id of the user to construct their site domain but I can't run the query on a non-mu blog because it wont exist.

    is there a way to get the site url of the logged on user?

    or

    is there a check or tag that I can use to detect if the plugin is running on MU so I can add an if to do the work?

  2. teamplaylotto
    Member
    Posted 15 years ago #

    sorry, all my searching turned up nothing but when I searched for something different I found the answer!
    it turned out to be
    if( function_exists( 'is_site_admin' ) )
    if it exists, it's mu , not if not.

    oh and my plugin works!

  3. MrBrian
    Member
    Posted 15 years ago #

    I dont entirely understand (non-mu blog?), so i will post some functions that may help:

    is_logged_in
    get_blogs_of_user

    Recognize that users can have more than 1 blog, so a hidden field with the user's blog url may not make the most sense. Try to take a step back and explain what you need in short.

  4. MrBrian
    Member
    Posted 15 years ago #

    Ah, yes. For plugin compatibility between normal wordpress and MU, checking if is_site_admin is defined is the most common way to check for WPMU :).

  5. teamplaylotto
    Member
    Posted 15 years ago #

    thanks for the reply, get_blogs_of_user is what I'm after as well as is_site_admin

About this Topic

  • Started 15 years ago by teamplaylotto
  • Latest reply from teamplaylotto