Hello
As v3.0 is now out I thought I would post in the right place for a change :)
I have a piece of code (in its own php page in the plugins directory) that adds new users to all blogs listed..
add_action( 'user_register', 'ds_new_user_meta', 10, 2);
function ds_new_user_meta($user_id) {
$blogs = array(1,2,3,4,5,6,7,8,9,10);
foreach ($blogs as $blog) {
add_user_to_blog($blog, $user_id, 'subscriber');
}
// adds every new user to blog_id 1 to 10
}
This works well if I create the user from the admin panel. But if my membership plugin creates the user it doesn't work.
I think this is the function of the plugin that is creating the new user
if (!function_exists('byrd_create_user')){
function byrd_create_user( $username, $email, $password = false ){
$_tbl =& bTable::getInstance('users', 'Table');
if (!$password) $password = byrd_generate_password( 12, false );
//save this to the database
$_tbl->bind( array(
'user_login' => $username,
'user_pass' => byrd_hash_password($password),
'user_nicename' => $username,
'user_email' => $email,
'user_registered' => date('Y-m-d H:i:s'),
'user_status' => 0,
'display_name' => $username
) );
$_tbl->store();
return array('user_id' => $_tbl->ID, 'password' => $password);
}
}
Is it possible to modify the top bit of code to work with the plugin creating the new member??
Is it as simple as changing the first line from
add_action( 'user_register', 'ds_new_user_meta', 10, 2);
to
add_action( 'byrd_create_user', 'ds_new_user_meta', 10, 2);
bit out of my depth here...
Cheers