Frontpage log in doesn't work


I've been trying to fix this myself for a couple of days but it is driving me crazy.

test site:

In the header there is a login form. If you click the log in from facebook link the window pops up, enter facebook username and password and click the button... it begins the login process.

The page refreshes but you are not logged in.

It does however work from the wp-login.php page:

but also - if you go through the login process on the home page, then load wp-login.php and manually refresh it then it automatically logs you in without you doing anything.

So - it appears to me that when you login from the home page a cookie value is set on your machine from facebook. But that cookie value does not trigger the actual login until you go to wp-login.php, at which point it recognises that the session has started and writes and authenticated cookie.

I have followed the process through many php files, but can't yet find the hooks or functions I need to trigger on my homepage to make it all work...

I'm about to pull out my hair. surely it should be simpler than this.

Wordpress and buddypress are both latest versions, as is the facebook plugin.
All other plugins are up to date, deactivating all plugins makes no difference.

Has anyone else worked out how to get the login to work from anywhere other than wp-login?


  • kimedia
    • Flash Drive

    Below is the code.
    It is in my functions.php file. Hooked to the buddypress header to remove the defaults and insert ours

    function new_core_admin_bar() {
    global $bp, $wpdb, $current_blog;
    if ( defined( 'BP_DISABLE_ADMIN_BAR' ) )
    	return false;
    if ( (int)$bp->site_options['hide-loggedout-adminbar'] && !is_user_logged_in() )
    	return false;
    $bp->doing_admin_bar = true;
    echo '<div id="menu">';
    if ( is_user_logged_in() ){ ?>
    	<form action="<?php echo bp_search_form_action() ?>" method="post" id="search-form">
    				<input type="text" id="search-terms" name="search-terms" value="" />
    					<?php echo bp_search_form_type_select() ?>
    				<input type="image" src="<?php bloginfo('stylesheet_directory'); ?>/images/search.gif" name="search-submit" id="search-submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
    				<?php wp_nonce_field( 'bp_search_form' ) ?>
    				<?php do_action( 'bp_search_login_bar' ) ?>
    } else {
    				do_action( 'bp_before_sidebar_login_form' );
    				<form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php echo site_url( 'wp-login.php', 'login_post' ) ?>" method="post">
    					<div class="label">
    						<label><?php _e( 'Username', 'buddypress' ) ?></label>
    						<input type="text" name="log" id="sidebar-user-login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" />
    					<div class="label">
    						<label><?php _e( 'Password', 'buddypress' ) ?></label>
    						<input type="password" name="pwd" id="sidebar-user-pass" class="input" value="" />
    					<div class="label">
    						<input name="rememberme" type="checkbox" id="sidebar-rememberme" value="forever" />
    						<label><?php _e( 'Remember Me', 'buddypress' ) ?></label>
    						<a class="lostpassword" href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
    					<?php do_action( 'bp_sidebar_login_form' ); ?>
    					<input type="image" name="wp-submit" id="login_btn" src="/wp-content/themes/ifanshare/images/login.gif" />
    					<input type="hidden" name="testcookie" value="1" />
    					<input type="hidden" name="redirect_to" value="/activity/" />
    				<?php do_action( 'bp_after_sidebar_login_form' ) ?>
    } //user logged in
    if ( is_user_logged_in() ){
    	echo '<a href="' . wp_logout_url(site_url()) . '"><img id="logout_btn" src="/wp-content/themes/ifanshare/images/logout.gif" alt="Logout"/></a>';
    echo '<ul id="menu_nav">';
    // **** Do bp-adminbar-menus Actions ********
    do_action( 'bp_adminbar_menus' );
    echo '</ul>';
    echo "</div> <!-- /menu -->\n\n";
    $bp->doing_admin_bar = false;
    function addadminbar() {
    	add_action( 'bp_header', 'new_core_admin_bar', 1 );
  • Vladislav
    • Dead Eye Dev


    I'm really sorry about such a long delay on this one, I somehow managed to miss the topic. Having a look at the page, there seems to be two separate FB initialization sections (with div#fb-root), one of them being from UFb, which is bound to create some issues. Also, there are two different FB app IDs in use, which could be the cause of the behavior you're experiencing. If you're using another Facebook plugin on your site, could you please try to temporarily disable it and see if it helps?

  • DavidM
    • DEV MAN’s Mascot

    Hi kimedia,

    Just checking if it was eventually resolved in another thread? Or by yourself separately to us? Or by us over email with you? Or using our live support?

    If so, no need to reply, that's great news.

    If not, could you let us know by re-opening this topic, and we'll get onto it and helping you out asap!

    Otherwise, glad you got it sorted :slight_smile:


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.