I’d like to be able to do the same thing. I don’t want to skip the activation email, but when the user clicks the link in the email it should activate their account and log them in rather than forcing them to click “Activate”, then click “Log In”, then log in.
Hi Mike, did you find a way to implement the feature that you were talking about on this topic, i’m having the same issue as you had
Hope you read this message
Struggling with the same issue, skipping the ‘activate’ button clicking and auto-login the user. Can anybody help?
Does anyone have a solution to this?
You can probably add something like this. Note, I have not tested it, so this will send a curl request to the same activation page with the activation parameter, in turn the user is activated.
add_action('bp_before_activation_page',function(){
if ( !bp_account_was_activated() ){
$pages=get_option('bp-pages');
if(empty($pages['activate'])){return;}
wp_remote_post(get_permalink($pages['activate']),array(
'method' => 'POST',
'timeout' => 45,
'body' => array(
'key' => bp_get_current_activation_key(),
));
//get the response from above and force user login into the site.
// get user_id from the response wp_remote_retrieve_body
// wp_clear_auth_cookie();
//wp_set_current_user( $user_id ); log the user into wordpress
}
});
Unfortunately this creates an error”
There has been a critical error on your website.”
when used
Hey,
you can automate Step 3 like this:
function my_custom_buddypress_activation_autoactivate(){
if($key = bp_get_current_activation_key()){
if($user_id = bp_core_activate_signup($key)){
if(!is_wp_error( $user_id )){
$bp = buddypress();
$bp->activation_complete = true;
}
}
}
}
add_action('bp_before_activation_page','my_custom_buddypress_activation_autoactivate');
I would not recommend auto-login on activation page because it could create a security risk.
Happy Coding!