1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Login bar on separate page

Discussion in 'XenForo Questions and Support' started by GaryOak, May 27, 2013.

  1. GaryOak

    GaryOak Member

    I would like to take this
    [​IMG]
    and this
    [​IMG]
    and put it on a separate (non-Xenforo) page.

    My knowledge of PHP is minimal, but I have managed to integrate Xenforo's login system and avatars into a separate system. However, now I'd also like to maintain the look and feel by having the actual login bar on an upcoming project.

    Does anyone know how to do this? I'd honestly be willing to pay for the answer.
     
  2. LPH

    LPH Well-Known Member

    I can only give you an example of how to do this in a WordPress child theme. Add the following to the header.php file:

    PHP:
    <fieldset id="header_bar">
        <div class="pageWidth">
            <div class="pageContent">
         
                <?php
                    
    if ( is_user_logged_in() ) {
     
                        global 
    $current_user$XF;
                        
    get_currentuserinfo();
                     
                        echo 
    '
                            <span id="member" class="loggedIn_menu_class"><a href="/community/conversations/">Inbox</a>  <strong class="itemCount">' 
    $XF->visitor->get('conversations_unread') . ' </strong>
                            <a href="/community/account/alerts">Alerts</a> <strong class="itemCount">' 
    $XF->visitor->get('alerts_unread') . ' </strong>
                            <a href="/community/logout">Log Out</a></span>
                            '
    ;
     
                        echo 
    '
                            <span id="member" class="loggedIn_menu_class">
                            '
    ;
                     
                        echo 
    '
                         
                            <a href="/community/members/' 
    strtolower($XF->visitor->get('username')) . '.' $XF->visitor->get('user_id') .'"> '$current_user->display_name .'</a></span>
                            '
    ;
                     
                     
                            if ( 
    $site_admins = array ( 'List the admins') ){
                                echo 
    '
                                    <span id="member" class="admin"><a href="/wp-admin">WordPress Admin Panel</a>
                                    <a href="/wp-admin/post-new.php">WordPress Add New Blog Post</a>
                                    <a href="/community/admin.php">XenForo Admin Panel</a></span>
                                    '
    ;
                            }
                   
                     
                     
                    } else {
     
                        echo 
    '
                            <script>XenForo.LoginBar = function(a){};</script>
                       
                            '
    ;
                         
                            if (
    $_SERVER['HTTP_HOST'] == 'tuxnotes.tuxreportsnetwork.com') {
                             
                                echo 
    '<span id="member" class="logIn_menu_class"><a href="http://www.tuxreportsnetwork.com/community/login" class="OverlayTrigger inner">Log In or Sign Up</a></span>';
                             
                            } else {
                         
                         
                            echo 
    '<span id="member" class="logIn_menu_class"><a href="/community/login" class="OverlayTrigger inner">Log In or Sign Up</a></span>
                        '
    ;
                    } }                
    ?>
            </div>
        </div> 
    </fieldset>
    In turn, add the CSS.

    Hopefully this helps get you started. Thee are things you will not need - such as the if else statements containing the $_SERVER['HTTP_HOST.
     
  3. GaryOak

    GaryOak Member

    @lph

    Thanks. Being able to fetch the alerts/inbox counts does help. I suppose I'll have to style the bar and do the slidedown login form myself. Thanks again for the snippet.
     

Share This Page