Title: Custom redirection with short code
Last modified: August 21, 2016

---

# Custom redirection with short code

 *  Resolved [marlonsabala](https://wordpress.org/support/users/marlonsabala/)
 * (@marlonsabala)
 * [13 years ago](https://wordpress.org/support/topic/custom-redirection-with-short-code/)
 * Hi chaps,
 * since the automatic placement of the plugin on the registration page does not
   work I’ve placed it there with do_action(‘oa_social_login’).
 * The problem I have is that is redirects me back to the registration page.
    I 
   know you can globally change where the short code of the plugin takes you. I 
   have set it to “current page” since this makes sense in all the other calls for
   the short code around the site.
 * So my question is: is it possible to add something to the short code to make 
   it redirect some place specific, just for that placement?
 * [http://wordpress.org/extend/plugins/oa-social-login/](http://wordpress.org/extend/plugins/oa-social-login/)

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

 *  Plugin Author [Claude](https://wordpress.org/support/users/claudeschlesser/)
 * (@claudeschlesser)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-redirection-with-short-code/#post-3761787)
 * Hello,
 * the following filters are available to customize the redirection:
 *     ```
       //Redirection for new users
       function oa_social_login_filter_redirect_for_new_users ($url, $user_data)
       {
       	//Force the url to something else
       	$url = 'http://my-website.com/welcome-new-user/';
   
       	//New users will be redirected here
       	return $url;
       }
       add_filter('oa_social_login_filter_registration_redirect_url', 'oa_social_login_filter_redirect_for_new_users', 10, 2);
   
       //Redirection for existing users
       function oa_social_login_filter_redirect_for_existing_users ($url, $user_data)
       {
       	//Force the url to something else
       	$url = 'http://my-website.com/welcome-back/';
   
       	//Returning users will be redirected here
       	return $url;
       }
       add_filter('oa_social_login_filter_login_redirect_url', 'oa_social_login_filter_redirect_for_existing_users', 10, 2);
       ```
   
 * The codes have to be added to the end of the functions.php file of your WordPress
   theme.
 * Regards,
 *  [blatan](https://wordpress.org/support/users/blatan/)
 * (@blatan)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/custom-redirection-with-short-code/#post-3761833)
 * Hi Claude,
    I need a help. I used your above code. It works, but not in my case.
   I’m trying to redirect to user’s profile edition (buddypress) to make him/her
   to fill all required fields. To do it I need to get user name. It works fine 
   when user logs in normal way. But when I login via facebook I get empty `current_user`
   object and `bp_user_id=0` as well. This way I get: [http://websiteurl.com/profile/edit/group/1/](http://websiteurl.com/profile/edit/group/1/)
   from: `$profile_path = $current_user->user_login . "/profile/edit/group/1/";`
   In above `$profile_url` user name is empty. I added your filters. First I added
   with priority 10 as you did it, then I changed to 100 with hope it helps. I hoped
   later call of the filter allows another piece of code to be run first. Of course,
   it didn’t help.
 * What am I doing wrong?
 * Is there any other action to be called right after registration/login?
 * Regards,
    Bernard
 *  [blatan](https://wordpress.org/support/users/blatan/)
 * (@blatan)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/custom-redirection-with-short-code/#post-3761834)
 * There isone more option for me.
    Can I disable the redirecting actions?
 *  [khushboo garg](https://wordpress.org/support/users/khg123/)
 * (@khg123)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/custom-redirection-with-short-code/#post-3761849)
 * [@blatan](https://wordpress.org/support/users/blatan/) : I also wanted to redirect
   to user profile after oneall socila login completed.Please use the below code
   in your current theme function.php file
 *     ```
       /*** Forcing redirect to $_SESSION['specific_referer'] after registration & login in OneAll Social Login ***/
       add_filter('oa_social_login_filter_registration_redirect_url', 'my_login_registration_redirect_filter', 10, 2);
       add_filter('oa_social_login_filter_login_redirect_url', 'my_login_registration_redirect_filter', 10, 2);
       function my_login_registration_redirect_filter ($url, $user_data) {
           $url = site_url()."/members/".$user_data->data->user_nicename;
             return $url;
       }
       ```
   
 * You are done !!! enjoy

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

The topic ‘Custom redirection with short code’ is closed to new replies.

 * ![](https://ps.w.org/oa-social-login/assets/icon-256x256.gif?rev=2680668)
 * [Social Login](https://wordpress.org/plugins/oa-social-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/oa-social-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/oa-social-login/)
 * [Active Topics](https://wordpress.org/support/plugin/oa-social-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/oa-social-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/oa-social-login/reviews/)

 * 4 replies
 * 4 participants
 * Last reply from: [khushboo garg](https://wordpress.org/support/users/khg123/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/custom-redirection-with-short-code/#post-3761849)
 * Status: resolved