Plugin Resource for WordPress and WPMU
WordPress MU Function List

If I’ve been surprised by the sheer lack of documentation in WordPress and especially in WordPress MU, I’ve been equally astounded to find how many really useful functions come native to the software that so few plugins actually employ. This is particularly true of MU plugins, and I’ve seen many a plugin dance around to perform a task which it now appears could as easily been done with one function from the wpmu-functions.php file. I’ve also written a fair number of plugins that suffer from this same lack of knowledge.

So, I GREP’ed the file to get a list of functions, which I then reordered and have displayed on this page. As I learn about those functions, I will update this page with links to discussions of them within posts. They are listed here more or less as the GREP results came out. That gives you the name and the expected parameters for each function, and since the names are fairly intuitive, experienced plugin writers should have no problem referencing them within wpmu-functions.php and figuring it out for themselves.

I reordered them to give them a bit of organization, preferring to group them according to broad-strokes User, Blog, Site and Navigation functions.

–== Site Functions ==–

load_muplugin_textdomain($domain, $path = false)
wpmu_update_blogs_date()
wpmu_checkAvailableSpace($action)
get_sitestats()
get_site_option( $key, $default = false, $use_cache = true )
add_site_option( $key, $value )
update_site_option( $key, $value )

get_last_updated( $display = false )
get_most_active_blogs( $num = 10, $display = true )
get_blog_list( $start = 0, $num = 10, $display = true )
domain_exists($domain, $path, $site_id = 1)
get_current_site()

–== Blog Functions ==–

get_blogaddress_by_id( $blog_id )
get_blogaddress_by_name( $blogname )
get_blogaddress_by_domain( $domain, $path )
get_blog_details( $id, $all = true )
refresh_blog_details( $id )
get_blog_option( $blog_id, $setting, $default=’na’ )
add_blog_option( $id, $key, $value )
delete_blog_option( $id, $key )
update_blog_option( $id, $key, $value, $refresh = true )

is_archived( $id )
update_archived( $id, $archived )
update_blog_status( $id, $pref, $value, $refresh = 1 )
get_blog_status( $id, $pref )
get_blog_count( $id = 0 )
get_blog_post( $blog_id, $post_id )
insert_blog($domain, $path, $site_id)
install_blog($blog_id, $blog_title = ”)
install_blog_defaults($blog_id, $user_id)
wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta = ”)
wpmu_create_blog($domain, $path, $title, $user_id, $meta = ”, $site_id = 1)
wpmu_validate_blog_signup($blog_id, $blog_title, $user = ”)
wpmu_signup_blog($domain, $path, $title, $user, $user_email, $meta = ”)
create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 )
get_blog_permalink( $blog_id, $post_id )

–== User Functions ==–

get_admin_users_for_domain( $sitedomain = ”, $path = ” )
get_user_details( $username )
get_current_user_id()
is_site_admin( $user_login = false )
get_blogs_of_user( $id, $all = false )
get_active_blog_for_user( $user_id )
is_user_member_of_blog( $user_id, $blog_id = 0 )
add_user_to_blog( $blog_id, $user_id, $role )
remove_user_from_blog($user_id, $blog_id = ”)
is_blog_user( $blog_id = 0 )
get_user_id_from_string( $string )
wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta = ”)
wpmu_welcome_user_notification($user_id, $password, $meta = ”)
wpmu_signup_user_notification($user, $user_email, $key, $meta = ”)
wpmu_activate_signup($key)
generate_random_password()
wpmu_create_user( $user_name, $password, $email)
validate_email( $email, $check_domain = true)
is_email_address_unsafe( $user_email )
wpmu_validate_user_signup($user_name, $user_email)
wpmu_signup_user($user, $user_email, $meta = ”)

–== Navigation/Traversing Blogs ==–

switch_to_blog( $new_blog )
restore_current_blog()
wpmu_admin_do_redirect( $url = ” )
wpmu_admin_redirect_add_updated_param( $url = ” )
wpmu_admin_redirect_url()

No tag for this post.

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

6 Responses to “WordPress MU Function List”

  1. April 17th, 2008 | 12:37 pm

    Can you elaborate more or give a PHP example of how I would use the WPMU functions to get a simple list of all my blogs in my site? I’m really having trouble with the variable definitions.

  2. April 17th, 2008 | 3:46 pm

    Stephen,

    Any of the following would work:

    get_last_updated( $display = false )
    get_blog_list( $start = 0, $num = 10, $display = true )
    get_most_active_blogs( $num = 10, $display = true )

    There is only the question of how you would like them ordered and if you want to set the limit of blogs returned. In all cases, the $display variable is set to ‘false’ if you just want a standard array of blogs. If you want to display them without any custom formatting, setting $display to ‘true’ will return an HTML bullet list of blogs.

    get_blog_list() and get_most_active both include a $num variable, meaning that you can set the function to only return 5, 10, 47 blogs as needed. get_blog_list() allows you to set an offset so that you can grab only blogs 5 through 10 in the list of blogs. I believe that if you use get_blog_list(), it orders the blogs by blog_ID in the database.

    Hope that helps. If not, ping me back with your questions.

    For practical examples, you might want to look at my Sitewide Latest Comments plugin, which uses a lot of the API to get it’s results.

  3. February 20th, 2009 | 7:28 pm

    [...] someone from the forums has been hiding their great blog from me. Included is a WordPress MU Function List which will come in handy, as well as a change to the recently included admin bar to make it [...]

  4. May 25th, 2009 | 9:21 pm

    Cheers for that, i have been dealing with wordpressMU for around 2 months now and have been finding the documentation or lack thereof very annoying at times.

  5. May 25th, 2009 | 9:36 pm

    Thanks! Enjoy it, and if you find anything missing you want, don’t hesitate to ask!

  6. July 22nd, 2009 | 2:50 pm

    [...] PerĂ² ho trovato una risorsa interessante, sembra che l’autore abbia avuto lo stesso problema pertanto ha scritto lui una documentazione su wordpress mu. [...]

Leave a reply

'