Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirect for members re entering a community

  • Avatar of YvonneTaylor
    YvonneTaylor
    Participant

    @yvonnetaylor

    WP 3.7.1 and BP 1.8.1 also
    theme my login and BP redirect login plugins

    http://www.thedogsclub.com/testing/

    If someone clicks out of my community (ie) does not logout but just clicks on one of the other navigation pages, then decides to re enter the community, they cannot do it.
    Where I have a page called Community from my normal WP menu at the moment it has info on the community with a link to login, is it possible that if someone is already logged into the site, this page would take the person back to their members activity page.
    I would need 2 sets of code, one to handle the action if user not logged and another to deal with a user previously logged in and wanting to return.

    My only other option that I can see is that if they click on the login again in the header the next screen shows the avatar and the option to log out, is there some way to add a link to the avatar that would redirect back to the members profile again.

    What I have in my testing mode at the moment is the second option but I added Return to Community but it takes me to an overall members page and I still cannot get a user back to their own activity page.

    I have a blue site navigation bar at the moment for testing purposes but I intend to remove that once I have everything working.

    Any help would be much appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of Henry
    Henry
    Participant

    @henrywright-1

    Hi @yvonnetaylor

    So let me see if I understand what you’re trying to do.

    If a user is logged in and visits your community page http://www.thedogsclub.com/testing/community/ you would like them to be redirected to the member’s activity page http://www.thedogsclub.com/members/username/activity

    If a logged out user visits the community page then do nothing. Let them stay and click the login link (if they wish to).

    Is that right?

    Avatar of YvonneTaylor
    YvonneTaylor
    Participant

    @yvonnetaylor

    Hi Henry

    Yes that is correct, the way that I have the site at the moment if the user wants to click out of the community to other parts of my site there is no way back in unless they log out first (which most people probably donĀ“t do).
    What I have at the moment as a work around is using Buddymenmu/Buddylink I have created a link if the user clicks on the login tag again they will see the revisit your activity, but I think this is a bit messy.
    I am new to WP and BP so it is trial and error and a steep learning process at the moment.

    I actually have a couple of other problems still related to BP which I think someone with knowledge can help me fix easily I am just not sure where to find the correct php files and what to change.
    Basically I have lost the Whats New button and the area/icons for typing an update, also if I try to view a friends update the next screen just says Activity but there is nothing there.
    Also the same for the Groups, when I click on membership nothing is there and i have lost the Create a Group button.

    I have switched over to the default bp theme and everything works perfectly well, so it must be in the code that I have messed up. I was trying to follow a tutorial on another site and the end result did not work, I thought I had backtracked carefully but obviously I missed something important.

    Hope you can help
    Many thanks

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    the way that I have the site at the moment if the user wants to click out of the community to other parts of my site there is no way back in unless they log out first

    This isn’t standard behaviour. Does this happen when you’re using the default theme?

    To redirect logged in users away from community page, try adding this snippet to your theme’s functions.php file.

    function bp_redirect_community_page() {
    global $bp;
    	if ( is_page( 'community' ) && is_user_logged_in() ) {
    		wp_redirect( $bp->loggedin_user->domain );
    		exit();
    	}
    }
    add_action( 'template_redirect', 'bp_redirect_community_page' );

    With reference to the rest of the problems you’re facing, I’d suggest opening a new thread for each different problem.

    Avatar of YvonneTaylor
    YvonneTaylor
    Participant

    @yvonnetaylor

    Hi Henry

    Thank you very much for the snippet of code it works just fine.
    I went back into the default BP theme regarding your comment about the behaviour. On my site I am using a full page width template for the pages outwith the community, using the default BP theme there is a sidebar on every page which I can use to click back into the users activity, otherwise there would not be any other place to do it.

    Regarding my other problems, yes I have already opened a separate thread but as yet no replies have been received.

    Again many thanks from a newbie user.

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @yvonnetaylor no problem! I like your site by the way, I have a golden retriever :)

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

You must be logged in to reply to this topic.