Skip to:
Content
Pages
Categories
Search
Top
Bottom

redirect to activity after login?

  • Avatar of onyx808
    onyx808
    Participant

    @onyx808

    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!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Avatar of edinchez
    edinchez
    Participant

    @edinchez

    Avatar of onyx808
    onyx808
    Participant

    @onyx808

    it didnt work at all…

    I actually was able to get this done by modifying the login form redirect! pretty simple ;)

    Avatar of chrisreg1
    chrisreg1
    Member

    @chrisreg1

    onyx808 – Where did you do this: wp-login.php? Where and what did you change it to? Thanks.

    Avatar of onyx808
    onyx808
    Participant

    @onyx808

    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

    Avatar of Sofian J. Anom
    Sofian J. Anom
    Participant

    @lightcapturer

    Avatar of shanebpdev
    shanebp
    Participant

    @shanebp

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

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    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.

    Avatar of shanebpdev
    shanebp
    Participant

    @shanebp

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

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    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):

    http://buddydev.com/buddypress/buddypress-trick-redirect-users-to-their-profile-on-login/

    Avatar of chrisreg1
    chrisreg1
    Member

    @chrisreg1

    R-a-y – that doesn’t work for me unfortunately.

    I am using the:
    - latest version of WordPress 3.1.2
    - Child theme of Suffusion

    And the latest plugins for Suffusion BP Pack (1.02), BuddyPress (1.2.8), 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!

    Avatar of Jigesh
    Jigesh
    Participant

    @jigesh

    Hello, i have got another way to redirect user to show all activity
    1) Install BP-PROFILE-AS-HOMEPAGE plugin

    2) 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

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

You must be logged in to reply to this topic.