Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirect after login


  • Lars Henriksen
    Participant

    @adjunkten

    Hello BP community,

    I would like to redirect my users to the site-wide activity page when they log in?

    Thanks in advance for suggestions.

    Cheers, Lars

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

  • Varun Dubey
    Participant

    @vapvarun

    use the following code snippet

    function redirect_to_activity_page_after_login($user_login, $user) {
        // Redirect to the activity page after login
        wp_redirect( home_url( '/activity' ) );
        exit;
    }
    add_action('wp_login', 'redirect_to_activity_page_after_login', 10, 2);

    Lars Henriksen
    Participant

    @adjunkten

    Thanks Varun.

    With this code I get the message ‘parser error’ . I am using BuddyX pro.

    Thanks for connecting on Mastodon.

    Lars


    Varun Dubey
    Participant

    @vapvarun

    @adjunkten might be some typo error in copy-paste, but the code is fine
    You can use the Code Snippet plugin to use custom snippets.


    thinlizzie
    Participant

    @thinlizzie

    Tested, works great.

    BP 10.6.1
    TwentySixteen theme


    Lars Henriksen
    Participant

    @adjunkten

    Tested again
    If I disable ‘sign-in popup’ in the BuddyX theme I no longer get the parser error.

    Buddypress 12.2

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar