Skip to:
Content
Pages
Categories
Search
Top
Bottom

problem with using the home theme as a user theme


  • Kunal17
    Participant

    @kunal17

    Setup: WPMU 2.7.1, BP1.0.2, bbpress 1.0 beta

    Hi, I am running a copy of the default home theme as a user theme for consistency (I pretty much made a copy of the theme). This has retained the default log in form at the top of the page, which suits me fine. However, when I fill in my username and password and try to log in from the user themed blog, it redirects to my dashboard instead of back to the same page with me logged in.

    Please suggest a solution. Thanks.

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

  • Kunal17
    Participant

    @kunal17

    I have hacked this currently to display a message to the unregistered/no logged in user to go back to the home page and log in. Obviously this is far from ideal, unfortunately, that’s the extent of my skills right now :(.

    Would be great if anyone could shed some light as to why the above problem is happening. Thanks!


    Kunal17
    Participant

    @kunal17

    Bump?


    Kunal17
    Participant

    @kunal17

    Hmm, I don’t seem to be able to catch anyone’s attention regarding this topic. Im still looking for help finding a solution for this.

    Another problem is that if anyone logs out from the userbar link from a user theme, they get redirected back to the main blog.


    Korhan Ekinci
    Participant

    @korhanekinci

    Hi Kunal17, I use prologue theme as default user theme and I also wanted to keep the login form on top, so I added this to the header of the prologue theme:

    <div id=”search-login-bar”>

    <?php if ( is_user_logged_in() ) : ?>

    <div id=”logout-link”>

    <?php bp_loggedinuser_avatar_thumbnail( 20, 20 ) ?>  

    <?php bp_loggedinuser_link() ?>

    <?php

    if ( function_exists(‘wp_logout_url’) ) {

    $logout_link = ‘/ root_domain ) . ‘”>’ . __( ‘Log Out’, ‘buddypress’ ) . ‘‘;

    } else {

    $logout_link = ‘/ root_domain . ‘/wp-login.php?action=logout&redirect_to=’ . $bp->root_domain . ‘”>’ . __( ‘Log Out’, ‘buddypress’ ) . ‘‘;

    }

    echo apply_filters( ‘bp_logout_link’, $logout_link );

    ?>

    <?php do_action( ‘bp_login_bar_logged_in’ ) ?>

    </div>

    <?php elseif ( get_option(‘users_can_register’) ) : ?>

    <form name=”login-form” id=”login-form” action=”<?php echo $bp->root_domain . ‘/wp-login.php’ ?>” method=”post”>

    <input type=”text” name=”log” id=”user_login” value=”<?php _e( ‘Username’, ‘buddypress’ ) ?>” onfocus=”if (this.value == ‘<?php _e( ‘Username’, ‘buddypress’ ) ?>’) {this.value = ”;}” onblur=”if (this.value == ”) {this.value = ‘<?php _e( ‘Username’, ‘buddypress’ ) ?>’;}” />

    <input type=”password” name=”pwd” id=”user_pass” class=”input” value=”” />

    <input type=”checkbox” name=”rememberme” id=”rememberme” value=”forever” title=”<?php _e( ‘Remember Me’, ‘buddypress’ ) ?>” />

    <input type=”submit” name=”wp-submit” id=”wp-submit” value=”<?php _e( ‘Log In’, ‘buddypress’ ) ?>”/>

    <input type=”button” name=”signup-submit” id=”signup-submit” value=”<?php _e( ‘Sign Up’, ‘buddypress’ ) ?>” onclick=”location.href='<?php echo bp_signup_page() ?>'” />

    <input type=”hidden” name=”redirect_to” value=”http://&lt;?php echo $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’] ?>” />

    <input type=”hidden” name=”testcookie” value=”1″ />

    <?php do_action( ‘bp_login_bar_logged_out’ ) ?>

    </form>

    <?php endif // get_option(‘users_can_register’) ?>

    <div class=”clear”></div>

    </div>

    You can maybe replace the

    <div id=”search-login-bar”>

    <?php bp_login_bar() ?>

    <div class=”clear”></div>

    </div>

    part of your header.php file with the first code and I hope it will work for you.


    Korhan Ekinci
    Participant

    @korhanekinci

    For some how the code above did not go through correcty, I will paste the first part again:

    <div id="search-login-bar">

    <?php if ( is_user_logged_in() ) : ?>

    <div id="logout-link">
    <?php bp_loggedinuser_avatar_thumbnail( 20, 20 ) ?> &nbsp;
    <?php bp_loggedinuser_link() ?>
    <?php
    if ( function_exists('wp_logout_url') ) {
    $logout_link = '/ <a href="' . wp_logout_url( $bp->root_domain ) . '">' . __( 'Log Out', 'buddypress' ) . '</a>';
    } else {
    $logout_link = '/ <a href="' . $bp->root_domain . '/wp-login.php?action=logout&redirect_to=' . $bp->root_domain . '">' . __( 'Log Out', 'buddypress' ) . '</a>';
    }

    echo apply_filters( 'bp_logout_link', $logout_link );
    ?>

    <?php do_action( 'bp_login_bar_logged_in' ) ?>
    </div>

    <?php elseif ( get_option('users_can_register') ) : ?>

    <form name="login-form" id="login-form" action="<?php echo $bp->root_domain . '/wp-login.php' ?>" method="post">
    <input type="text" name="log" id="user_login" value="<?php _e( 'Username', 'buddypress' ) ?>" onfocus="if (this.value == '<?php _e( 'Username', 'buddypress' ) ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Username', 'buddypress' ) ?>';}" />
    <input type="password" name="pwd" id="user_pass" class="input" value="" />

    <input type="checkbox" name="rememberme" id="rememberme" value="forever" title="<?php _e( 'Remember Me', 'buddypress' ) ?>" />

    <input type="submit" name="wp-submit" id="wp-submit" value="<?php _e( 'Log In', 'buddypress' ) ?>"/>
    <input type="button" name="signup-submit" id="signup-submit" value="<?php _e( 'Sign Up', 'buddypress' ) ?>" onclick="location.href='<?php echo bp_signup_page() ?>'" />

    <input type="hidden" name="redirect_to" value="http://<?php echo $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] ?>" />
    <input type="hidden" name="testcookie" value="1" />

    <?php do_action( 'bp_login_bar_logged_out' ) ?>
    </form>
    <?php endif // get_option('users_can_register') ?>

    <div class="clear"></div>
    </div>


    Kunal17
    Participant

    @kunal17

    Korhan,

    Thanks for your help! Ill try this out as soon as possible and get back.


    Kunal17
    Participant

    @kunal17

    Korhan,

    I tried the code you provided:

    If I browse to my p2 user blog while logged out, it does not show me anything in the userbar. I would like to provide the user the option to log in from the user blog itself. Is the code supposed to show the BP log in/signup links in the userbar?

    If I browse to my p2 user blog while logged in, it shows the user avatar, member profile link and logout link. If I click the logout link, it takes me to the standard WP login page with the message ‘you are logged out’. Can you suggest a way to have it redirect to the same page on the userblog frontend except with the user logged out?

    I hope I am being clear about my questions. I am a novice at programming so only have a basic understanding of what the code is doing.

    Thanks again for your help.


    Kunal17
    Participant

    @kunal17

    I was trying to figure out why the log in form was not showing up at all.

    Replacing

    <?php elseif ( get_option(‘users_can_register’) ) : ?>

    with

    <?php else ://if ( get_option(‘users_can_register’) ) : ?>

    seems to do the trick. Not sure why the get_option code does not work. Do I need to have that check?

    Still trying to figure out how to redirect to the same page on logout.


    Korhan Ekinci
    Participant

    @korhanekinci

    Ok Kunal replace this part:

    <?php
    if ( function_exists('wp_logout_url') ) {
    $logout_link = '/ <a href="' . wp_logout_url( $bp->root_domain ) . '">' . __( 'Log Out', 'buddypress' ) . '</a>';
    } else {
    $logout_link = '/ <a href="' . $bp->root_domain . '/wp-login.php?action=logout&redirect_to=' . $bp->root_domain . '">' . __( 'Log Out', 'buddypress' ) . '</a>';
    }

    echo apply_filters( 'bp_logout_link', $logout_link );
    ?>

    With This:

    <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a>

    And that should solve the logout issue.


    Kunal17
    Participant

    @kunal17

    Korhan, that worked perfectly. Thanks so much, I have been looking for this solution for days!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘problem with using the home theme as a user theme’ is closed to new replies.
Skip to toolbar