Dear @Brajesh,
Im using your old but very awesome plugin:
BP Autologin on Activation1) Still works perfectly! Thank you very much!
2) I tried adding your code from the comment to redirect to /profile/edit (functions.php):
<div id=”highlighter_62467″ class=”syntaxhighlighter php”>
add_fllter(‘bpdev_autoactivate_redirect_url’,’redirect_to_edit_profile’);
function redirect_to_edit_profile($user_id){
return bp_core_get_user_domain($user_id ).”profile/edit/”;
}</div>
But $user_id seems to empty at this time.
I also tried following code:
<div id=”highlighter_62467″ class=”syntaxhighlighter php”>
add_fllter(‘bpdev_autoactivate_redirect_url’,’redirect_to_edit_profile’);
function redirect_to_edit_profile($user_id){
return get_option( ‘home’ ) . ‘/members/’ . bp_core_get_username( $user_id ) . ‘/profile/edit/’;
}</div>
same results.3) My goal: redirect on activation dependant on the member-type.
I wrote the following script for a redirect plugin, which i would like to replace with yours:
<div id=”highlighter_62467″ class=”syntaxhighlighter php”>
$member_type = bp_get_member_type($user->ID);
if( $member_type == ‘Student’ || $member_type == ‘student’ ) {
$redirect_url = ‘/wordpress/members/’.$user->user_login.’/profile/edit/group/6/#edit-personal-li’;
}
else if( $member_type == ‘Teacher’ || $member_type == ‘techer’ ) {
$redirect_url = ‘/wordpress/members/’.$user->user_login.’/profile/edit/group/5/#edit-personal-li’;
}
else {
$redirect_url = ‘/wordpress/members/’.$user->user_login.’/profile/’;
}</div>Perhaps this snippet could be useful to someone 🙂
Gratefully
Bladeoh, cant edit OP. Doublepost for format – sorry all:
Dear Brajesh,
Im using your old but very awesome plugin:
BP Autologin on Activation1) Still works perfectly! Thank you very much!
2) I tried adding your code from the comment to redirect to /profile/edit (functions.php):
add_fllter(‘bpdev_autoactivate_redirect_url’,’redirect_to_edit_profile’); function redirect_to_edit_profile($user_id){ return bp_core_get_user_domain($user_id ).”profile/edit/”; }
But $user_id seems to empty at this time.
I also tried following code:add_fllter(‘bpdev_autoactivate_redirect_url’,’redirect_to_edit_profile’); function redirect_to_edit_profile($user_id){ return get_option( ‘home’ ) . ‘/members/’ . bp_core_get_username( $user_id ) . ‘/profile/edit/’; }
same results.
3) My goal: redirect on activation dependant on the member-type.
I wrote the following script for a redirect plugin, which i would like to replace with yours:$member_type = bp_get_member_type($user->ID); if( $member_type == ‘Student’ || $member_type == ‘student’ ) { $redirect_url = ‘/wordpress/members/’.$user->user_login.’/profile/edit/group/6/#edit-personal-li’; } else if( $member_type == ‘Teacher’ || $member_type == ‘techer’ ) { $redirect_url = ‘/wordpress/members/’.$user->user_login.’/profile/edit/group/5/#edit-personal-li’; } else { $redirect_url = ‘/wordpress/members/’.$user->user_login.’/profile/’; }
Perhaps this snippet could be useful to someone 🙂
Gratefully
BladeHi Blade,
My apologies for the delayed reply.
Please use this code instead.add_filter( 'bpdev_autoactivate_redirect_url','redirect_to_edit_profile', 10, 2 ); function redirect_to_edit_profile( $profile_url, $user_id ) { return $profile_url .'profile/edit/'; }
It will work. Please let me know if that works for you or not?
Thank you
BrajeshHey my master!
I just solved it via trial&error like a stupid xDadd_filter('bpdev_autoactivate_redirect_url','redirect_to_edit_profile'); function redirect_to_edit_profile($user_id){ return $user_id.'profile/edit/'; }
I found out (at least think i did) that $user_id at this specific hook time is already the full url,
thats why bp_core_get_user_domain($user_id) can’t find the “user_id”, thus returning the url without the name.
I dont know if it makes any sense, but that was my noob-logic (and i’m a very beginner in wordpress)Never the less I will test your solution asap, and report back to you.
Million thanks for being like you are Brajesh!!!
GratefullyBlade
Afterwords:
Using my code might be less characters, but i’m using your code, because having the proper $user_id is much better for modifications.
Here are my modifications to your solution to also differentiate between member-types and redirecting to the “detailed” edit profile page. (not the general)
Perhaps someone find this useful:function redirect_to_edit_profile( $profile_url, $user_id ) { if( bp_get_member_type($user_id) == 'your-member-type-1' ) { return $profile_url .'profile/edit/group/2/'; } else if( bp_get_member_type($user_id) == 'your-member-type-2' ) { return $profile_url .'profile/edit/group/5/'; } }
You have to change:
– “your-member-type-1” & “your-member-type-2” to match your membertype-names
– group-number to redirect to [varies with the amount of field-groups you created per member-type]Cheers
Blade- This reply was modified 8 years, 8 months ago by blade.
Hi Blade,
Thank you.I am sure it will help others. Thank you for sharing 🙂
You give us so much l0ve and I just wanted to give some back 🙂
Do you know how to trigger this redirect at click on “edit profile”?
I found a perfect solution ( of course from you, from whom else ):
<?php global $bp; if(bp_get_current_profile_group_id()==1) bp_core_redirect($bp->displayed_user->domain."profile/edit/group/2"); ?>
Sadly its 5 years old, and implementing this gives me following error:
Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\wordpress\wp-includes\class.wp-styles.php:172 in C:\xampp\htdocs\wordpress\wp-includes\pluggable.php on line 1228
I checked everything, there is no newline or space 🙁
Somehow I cant call a redirect at that time.Hi Blade,
Please give it a tryadd_action( 'bp_actions', 'bp_custom_redirect_to_2ndgroup' ); function bp_custom_redirect_to_2ndgroup() { if ( bp_is_user_profile_edit() && bp_get_current_profile_group_id() == 1 ) { bp_core_redirect(bp_displayed_user_domain() . 'profile/edit/group/2' ); } }
Please do let me know if that works for you or not?
Thank you
Brajesh
The topic ‘ [Resolved] BP Autologin on Activation’ is closed to new replies.