BuddyDev

Search

[Resolved] BP Auto Activate Autologin Redirect To Profile On Signup

  • Participant
    Level: Initiated
    Posts: 3
    TacticalPedia srl on #2934

    Hi,
    is there a way to redirect to a custom page instead of the personal profile after auto activation/login?
    Thanks,
    Francesco

  • Keymaster
    (BuddyDev Team)
    Posts: 24231
    Brajesh Singh on #2935

    Hi Francesco,
    Thank you for asking.
    yes, you can do that easily.

    
    add_filter( 'bpdev_autoactivate_redirect_url', 'redirect_to_edit_profile', 10, 2 );
    
    function redirect_to_edit_profile( $profile_url, $user_id  ) {
    	return  "http://yoursite.com/yourcustomurl";
    
    	//or you may use the $user_id to build a dynamic url
    }
    
    

    Please put the above code and change the url to anything.

    That will work.

  • Participant
    Level: Initiated
    Posts: 3
    TacticalPedia srl on #2938

    May I put the code in the bp-custom.php file?
    Thanks.

  • Keymaster
    (BuddyDev Team)
    Posts: 24231
    Brajesh Singh on #2942

    Yes, Please put it in bp-custom.php

  • Participant
    Level: Initiated
    Posts: 3
    TacticalPedia srl on #3339

    Hi, I created bp-custom.php as you suggested but at the end of the registration process, the website returns this error:

    add_filter( ‘bpdev_autoactivate_redirect_url’, ‘redirect_to_edit_profile’, 10, 2 ); function redirect_to_edit_profile( $profile_url, $user_id ) { return “http://instantcoach.me/welcome-instantcoach-community/”; }
    Warning: session_start(): Cannot send session cache limiter – headers already sent (output started at /home/admin/public_html/instantcoach.me/wp-content/plugins/bp-custom.php:6) in /home/admin/public_html/instantcoach.me/wp-content/plugins/wise-chat/src/dao/user/WiseChatUserSessionDAO.php on line 95

  • Keymaster
    (BuddyDev Team)
    Posts: 24231
    Brajesh Singh on #3340

    Hi Francesco,
    Are you using closing php tags in your bp-custom.php like this?

    
    ?>
    

    If yes, Please delete that. That will fix the issue. It is happening becuse there are some spaces getting sent to the browser from your bp-custom.php
    If no, Please post the complete code from your bp-custom.php(including php tags) on the pastebin and I can quickly assist.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 3
    TacticalPedia srl on #3344

    Perfect, it works now.
    Thanks,
    Francesco

  • Keymaster
    (BuddyDev Team)
    Posts: 24231
    Brajesh Singh on #3363

    Thank you for confirming.

    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved