Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 1 replies (of 1 total)

  • modzirra
    Participant

    @modzirra

    So, I’ve been combing these forums for weeks for a very similar problem, and being that this is the closest solution post, I thought I would ask here, extending the support for this problem.

    I would like to redirect users during login in the following manner:

    If logging in from the front page (site, not user): redirect to user profile
    If logging in from anywhere else: redirect to original url (where original url is the url where the login process was initiated)

    Currently I am forced to run the following for backwards compatibility reasons:
    WP: 3.7.3
    php: 5.3.10
    bbPress: 2.5.3
    BuddyPress: 1.9.2 +5 complimentary plugins

    Active Plugins
    45+ with the most relevant being:
    BadgeOS: 1.3.5 +4 complimentary plugins
    Bowe Codes: 2.1
    BP My Home: 2.0
    BP RedirecttoProfileforBuddypress: 1.2
    BP Simple Front End Post: 1.1.4
    BuddyBlog: 1.0.4

    I’ve tried to edit the redirect plugin mentioned often here as well as with no luck.

    Here is a sample of one of my latest attempts (a modification on redirect to profile plugin):

    add_filter("login_redirect","bpme_redirect_to_profile",100,3);
    
    function bpme_redirect_to_profile( $redirect_to_calculated, $redirect_url_specified, $user ){
    	/* if no redirect was specified,let us think we want the current page */
    	if( empty( $redirect_to_calculated ) )
    		$redirect_to_calculated=$redirect_url_specified;
    	
    	/* if the user is site admin or not and it's the front page,redirect to his/her profile */
    	if( is_super_admin( $user->ID ) && is_front_page() )
    		return bp_core_get_user_domain( $user->ID ) . 'profile/';
    	if( !is_super_admin( $user->ID ) && is_front_page() )
    		return bp_core_get_user_domain( $user->ID ) . 'profile/';
    	else
    		return $redirect_to_calculated; /*if site admin or not logged in,do not do anything much*/
    
    }

    (I recognize that the admin user check is redundant, that was part of some debugging I was doing)

    I find that every time I try to check for the front page, something happens to interrupt the redirect process. Without a check for front page: Working great! With the check for front page: No Bueno! I’ve been using several debugging plugins and if I understand them correctly, most of the issue has to do with the sidebar login location (it seems to ignore wp_login and login_redirect hooks/filters) and checking for the front page.

    I tried many other plugins and most of the code (with minor adjustments for my needs) that was offered on the forums here, including the Ajax one, but most of our login process is done through the sidebar and they just don’t ever get called or triggered during the sidebar login process.

    I would love some advice on how to adjust what I have and get it working properly.

    Your help is appreciated, thanks!

Viewing 1 replies (of 1 total)
Skip to toolbar