redirect to activity after login?
-
I searched this topic didnt find anything clear enough on how to get this done…
Any help on how to redirect users to the activity page right after they login?
Thank you!
-
it didnt work at all…
I actually was able to get this done by modifying the login form redirect! pretty simple
onyx808 – Where did you do this: wp-login.php? Where and what did you change it to? Thanks.
where ever you have your login code… I have it on a custom home.php
look for input type=”hidden” name=”redirect_to” value=”
and add the activity after like this
input type=”hidden” name=”redirect_to” value=”/activity
Have you tried this plugin: https://wordpress.org/extend/plugins/peters-login-redirect/ ?
Easier and more flexible to add a function to bp-custom.php.
Example:`
function login_intercepts(){if ( is_user_logged_in() ) {
bp_core_redirect( get_option(‘siteurl’).”/activity” );
}}
add_action( ‘wp’, ‘login_intercepts’, 3 );
`shanebp’s solution will always redirect any logged in user to the activity directory. You cannot surf anywhere else on the site!
A better method is hooking into the “login_redirect” filter. Brajesh Singh has a plugin that uses this, but I don’t remember the URL off the top of my head.
Oops – thanks r-a-y.
I chopped down too much the function that I use.
Perhaps this better explains my approach:`
function login_intercepts(){
global $bp_unfiltered_uri;if ( is_user_logged_in() ) {
/* if user logs in at domain name url or logged-out, they are sent to /activity */
if ( ($bp_unfiltered_uri[0] == “”) || ($bp_unfiltered_uri[0] == “logged-out”) ) {
bp_core_redirect( get_option(‘siteurl’).”/activity” );
}/* if user logs in on activate page, they are sent to /welcome */
if ( $bp_unfiltered_uri[0] == “activate” ) {
bp_core_redirect( get_option(‘siteurl’).”/welcome” );
}//etc
}
}add_action( ‘wp’, ‘login_intercepts’, 3 );
`That works too, though I’m not sure how safe it is to use the $bp_unfiltered_uri global in future BP versions like 1.3.
Here’s the “login_redirect” filter method if interested (found the URL):
R-a-y – that doesn’t work for me unfortunately.
I am using the:
– latest version of WordPress 3.1.2
– Child theme of SuffusionAnd the latest plugins for Suffusion BP Pack (1.02), BuddyPress (1.2., and s2Member (3.5.7).
Using the s2Member plugin settings, I have set my site to redirect users to a “Member Home” page upon logging in. This function used to work before I added BuddyPress + Suffusion BP Pack. However, since adding those plugins, I initially could not figure out why it no longer worked upon logging in. Currently, when a user logs in, the site just directs them to the main page (the default WordPress & site address). I disabled the other plugins and determined that it was BuddyPress handling the redirection.
So I made a bp-custom.php and added that code just to see if I can test the redirection function itself and it didn’t work. I even tweaked his code as well to try add_filter(“login_redirect”,”bpdev_redirect_to_profile”,100,3); Did I need to do anything else to activate the plugin or did it automatically run and link to BuddyPress?
Ultimately, it seems like I may have to implement a technique that onyx mentioned or something like http://www.thinkinginwordpress.com/2009/12/tweak-your-buddypress-login-to-redirect-to-the-page-user-was-viewing-while-login/
Does anyone have any thoughts? Thanks!
Hello, i have got another way to redirect user to show all activity
1) Install BP-PROFILE-AS-HOMEPAGE plugin2) INSTALL PLUGIN
3) in admin dashboard where list of plugin is listed you will find BP PROFILE AS HOMEPAGE PLUGIN, under it THERE IS TWO OPTION deactivate & edit
4) click on EDIT
5) Replace following line
wp_redirect( $bp->loggedin_user->domain );
WITH THIS
wp_redirect( bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . ‘/’ . BPCOM_ACTIVITY_SLUG );
6) You are Surely done. It works 100 Percent. i have also used help from this forum i am thank ful about it.
Anyone facing problem mail me on jigesh.raval@gmail.com
- The topic ‘redirect to activity after login?’ is closed to new replies.