Support » Multisite » [Resolved] Custom meta not imported into Multisite registration

[Resolved] Custom meta not imported into Multisite registration

  • I’ve created a custom plugin for my network, and part of its functionality is to customize the registration. I’ve chosen this route because many of the plugins that I have seen for multisite registration customization don’t quite fit my needs.

    The problem that I’m having seems to be due to the two-step registration process. While I’m able to add extra fields to the registration form, and capture the data into the meta column of the wp_signups table, I’m finding that the meta data is not being processed when the new user actually goes on and uses the link in the email they’re sent to activate. Here’s the bit of code I currently have that is supposed to process the meta data I capture earlier:

    add_action( 'wpmu_activate_user', 'jp_add_user_meta', 10, 3 );
    function jp_add_user_meta( $user_id, $password, $meta ) {
        foreach ( $meta as $key => $value ) {
            if ( $key == 'first_name' || $key == 'last_name' ) {
                update_user_meta( $user_id, $key, $value );
            } else {
                add_user_meta( $user_id, $key, $value );
        // Make sure all users are added to the main site
        add_user_to_blog( '1', $user_id, 'subscriber' );
        return $user_id;

    I feel that I’m missing something obvious somewhere, but I haven’t been able to figure out exactly what yet, and so I would appreciate any guidance that anyone has.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Ipstenu (Mika Epstein)


    Is $meta an array?

    It should be an array, based on what I can see in the wpmu_activate_signup() function.

    It is stored in the DB as a serialized array, and then line 846 of ms-functions.php seems to indicate that $meta is an array.

    I had a thought earlier: Is it possible that my code isn’t executing at all, due to define( 'WP_INSTALLING', true ); on line 2 of wp-activate.php? Am I correct that that prevents plugins from loading?

    Moderator Ipstenu (Mika Epstein)


    … Wow. THAT is a blast from the past. Yeah, that would logically impact mu-plugins as well as everything esle 😀

    Do you have any suggestions for how to get around the wp-activation.php file? Is there any way to insert code in there without hacking the core (which I refuse to do)?

    Moderator Ipstenu (Mika Epstein)



    I know you can hook into activation, I mean, I do it all the time. Is the user getting added to the site and it’s just the meta not happening?

    It appears that none of my own code is happening, including adding to the primary blog as a Subscriber. So the user is indeed happening, but my code doesn’t appear to be executed at the time of activation.

    Moderator Ipstenu (Mika Epstein)


    I was actually working on this (and some other similar aspects) earlier last month. For reference: http://halfelf.org/2012/multisite-registration/

    This is what I came up with to add users to the site:

    global $blog_id;
    if ( $blog_id == 1 ) {
      function helf_activate_user( $user_id, $password, $meta )
      {add_user_to_blog( '1', $user_id, get_site_option( 'default_user_role', 'subscriber' ) );}
      add_action( 'wpmu_activate_user', 'helf_activate_user', 10, 3 );

    So if you take out the meta part you’re adding in, does that work? I had it running as an mu-plugin with some other hoops and ladders, but it worked fine.

    Yes!! I finally got it!

    I needed a plugin in /wp-content/mu-plugins/ instead of a “normal” plugin. Thanks for the guidance, I appreciate it!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Custom meta not imported into Multisite registration’ is closed to new replies.