Skip to:
Content
Pages
Categories
Search
Top
Bottom

how to skip ‘activate’ after clicking activation link from email


  • corporateslave
    Participant

    @corporateslave

    — CASE: —
    as the title says…
    here’s basically what a new user have to do after registration until accessing their profile page:
    1. click activation link from email
    2. directed to /activate/blabla_somesortofcode_blabla
    3. click ‘activate’
    4. login per usual + some navigation until…
    5. arrived at profile page at /active/username

    — PROBLEM: —
    I’m hoping to skip step 3 and 4.
    So by doing some backstage abracadabra during step 2, people could magically arrive at their profile page (step 5).

    Any idea how to do it?

    — ADDITIONAL NOTES: —
    I’m currently using this ‘Bp Auto Login On Activation’ plugin which basically automate step 4. But I’m still hoping I could skip step 3 too, I mean… it’s basically just clicking a button, right?

    Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)

  • Prashant Singh
    Participant

    @prashantvatsh


    Mike Straw
    Participant

    @mikestraw

    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.


    manucomanuco
    Participant

    @manucomanuco

    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


    pmdferreira
    Participant

    @pmdferreira

    Struggling with the same issue, skipping the ‘activate’ button clicking and auto-login the user. Can anybody help?


    Wayn
    Participant

    @shnactor1

    Does anyone have a solution to this?


    VibeThemes
    Participant

    @vibethemes

    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
       }
    });

    Wayn
    Participant

    @shnactor1

    Unfortunately this creates an error”

    There has been a critical error on your website.”

    when used


    HU ist Sebastian
    Participant

    @kuchenundkakao

    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!

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar