Forum Replies Created
-
AuthorPosts
-
mobiousdesignMember
Wow…you seriously rock! Have another question…but I’ll start a new thread! Cheers!
mobiousdesignMemberOk, I’m getting closer…but my oop skills are non-existent,
so, if I update umEmailNotificationController userActivate to:
function userActivate( $userID ){
global $wpdb;
$user = new WP_User( $userID );
$new_pass = wp_generate_password(12, false);
$data = array(
'user_pass' => md5($new_pass),
'user_activation_key' => '',
);
$where = array(
'ID' => $user->ID,
);
update_user_meta( $user->ID, 'show_admin_bar_front', 'false' );
$wpdb->update($wpdb->users, $data, $where, array('%s', '%s'), array('%d'));
wp_cache_delete($user->ID, 'users');
wp_cache_delete($user->user_login, 'userlogins');
$user->password = $new_pass;
$this->_sendEmail( 'activation', $user );
}
It works great…BUT I’d prefer to use the hooks you’ve built instead…So if I want to remove your action and add my own:
remove_action( 'user_meta_user_activate', array( '$userMeta:umEmailNotificationController', 'userActivate' ));
is what I thought would do it…but your userActivate is still getting called…
add_action( 'user_meta_user_activate', 'user_meta_new_password');
function user_meta_new_password($userID){
global $wpdb;
$user = new WP_User( $userID );
$new_pass = wp_generate_password(12, false);
$data = array(
'user_pass' => md5($new_pass),
'user_activation_key' => '',
);
$where = array(
'ID' => $user->ID,
);
update_user_meta( $user->ID, 'show_admin_bar_front', 'false' );
$wpdb->update($wpdb->users, $data, $where, array('%s', '%s'), array('%d'));
wp_cache_delete($user->ID, 'users');
wp_cache_delete($user->user_login, 'userlogins');
$user->password = $new_pass;
//umEmailNotificationController::$this->_sendEmail( 'activation', $user );
}
I’ve commented out the last line because it throws an error…basically I haven’t written or messed with classes before, so no idea how to get in and out of them…any guidance would be great!
BTW, this is an AMAZING plugin!
- This reply was modified 12 years, 5 months ago by mobiousdesign.
- This reply was modified 12 years, 5 months ago by mobiousdesign.
mobiousdesignMemberthe pitfalls of trying to figure out new stuff at midnight! Kinda figured that out about 9am today…BUT, leads to another question…would it be possible to generate a new password on admin activation…to then send THAT password with the activation email? wp_generate_password again possibly?
-
AuthorPosts