efc9aee7 by Chris Boden

Update to address user creation on non-multisite blog. refs #784

1 parent 7cbea250
......@@ -169,7 +169,7 @@ function register($username, $email, $password, $meta = Array()) {
* @see wpmu_activate_signup
*/
function activate($key, $password_validation = null) {
global $wpdb, $current_blog;
global $wpdb;
$signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->signups} WHERE activation_key = %s", $key));
if (empty($signup)) {
......@@ -200,14 +200,21 @@ function activate($key, $password_validation = null) {
$wpdb->update($wpdb->signups, Array('active' => 1, 'activated' => current_time('mysql', true)), Array('activation_key' => $key));
// $user_site = get_site_option('dashboard_blog', $current_site->blog_id);
if (function_exists('add_user_to_blog')) {
global $current_blog;
add_user_to_blog($current_blog->blog_id, $id, get_site_option('default_user_role', 'subscriber'));
} else {
$user = new WP_User($id);
$user->add_role(get_site_option('default_role', 'subscriber'));
}
// If use these, fix variables, they're wrong
//add_new_user_to_blog( $id, $user_email, $meta );
//do_action(ACTION_ACTIVATE, $id, $password, $meta);
// If more than the password was sent in meta, have it generate user_meta for each key=>val pair
foreach($meta as $key=>$val) {
foreach($meta as $key => $val) {
update_user_meta($id, $key, $val);
}
......