Page 1 of 1

Display Client Page Link in Header

PostPosted: February 2nd, 2011, 1:03 pm
by Chris
I must first say that after messing with other "members" and "Client Login" plugins and workarounds for about 2 weeks (part-time) I am sure happy I found you s2Member :D I am currently trying to use this Plugin as a Client login for my photography business. The Client pages are only required to house some galleries. But privacy is an issue as I shoot Boudoir/Bodyscapes

After searching and watching some vidoes I still have one minor problem. I have configured everything so far without much problems. I am just in the process of trying to append a "My Page" link in my header, right near the "Logged in as xxusername / Log Out"
I understand that each template is different, I have identified where it needs to go but a coder I am not. I have tried a few different things but with no luck.

I am about 90% sure the code I have to paste is....
Code: Select all
<?php if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN){ ?>
  <a href="<?php echo S2MEMBER_LOGIN_WELCOME_PAGE_URL; ?>">My Account</a>
  | <a href="<?php echo S2MEMBER_LOGOUT_PAGE_URL; ?>">Logout</a>
<?php } ?>


But for the life of me I cannot find where to paste this into my current header.php, which is attached below
Code: Select all
<?php

/**********************************************************************
* File name:   

*      header.php

* Brief:       

*      Header and navigation code for all theme files

***********************************************************************/ 

?><?php

   ob_start();                         

?> 



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" <?php language_attributes(); ?> >

                       

    <!-- HEAD -->

    <head>

        <meta name="author" content="DigitalCavalry" />

        <meta name="language" content="english" />                     

        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

        <?php 

            if(!GetDCCPInterface()->getIGeneral()->hideWordPressVer())

            {

                echo '<meta name="generator" content="WordPress '.get_bloginfo('version').'" />';

            }

            $dccp = GetDCCPInterface()->printMeta();

        ?>             

       

        <title><?php bloginfo('name'); ?><?php wp_title('-'); ?></title>

        <!-- ICON -->

        <link rel="icon" href="" type="image/x-icon" />       

        <!-- CSS (Cascading Style Sheets) Files -->

        <link type="text/css" rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" />

        <link type="text/css" rel="stylesheet" href="<?php bloginfo("template_url"); ?>/css/sh/shCore.css" />

        <link type="text/css" rel="stylesheet" href="<?php bloginfo("template_url"); ?>/css/sh/shThemeRDark.css" />               

        <!--<link type="text/css" rel="stylesheet" href="/css/slimbox/slimbox2.css" />-->

        <link type="text/css" rel="stylesheet" href="<?php bloginfo("template_url"); ?>/css/pphoto/prettyPhoto.css" /> 

        <link type="text/css" rel="stylesheet" href="<?php bloginfo("template_url"); ?>/css/slider_prestige.css" />

        <link type="text/css" rel="stylesheet" href="<?php bloginfo("template_url"); ?>/css/slider_accordion.css" />

        <link type="text/css" rel="stylesheet" href="<?php bloginfo("template_url"); ?>/css/slider_progress.css" />   

        <link type="text/css" rel="stylesheet" href="<?php bloginfo("template_url"); ?>/css/slider_video.css" />

        <link type="text/css" rel="stylesheet" href="<?php bloginfo("template_url"); ?>/css/addPages.css" />

        <link type="text/css" rel="stylesheet" href="<?php bloginfo("template_url"); ?>/css/tipsy/tipsy.css" />

        <link type="text/css" rel="stylesheet" href="<?php bloginfo("template_url"); ?>/css/tipsy/tipsy-docs.css" />         

        <link type="text/css" rel="stylesheet" href="<?php bloginfo("template_url"); ?>/css/common.css" />

                   

                                                                                                 

        <!-- JavaScript Files -->

        <?php

            if(is_singular())

            {   

                wp_enqueue_script('comment-reply');

            }         

            wp_head();       

            GetDCCPInterface()->getIGeneral()->customCSS();

            GetDCCPInterface()->getIMenu()->customCSS();

            GetDCCPInterface()->getIGeneral()->sliderJavaScript();

                 

        ?> 

     

     

        <script language='javascript'>

        SyntaxHighlighter.config.stripBrs = true;

        SyntaxHighlighter.all();

        </script>     

        <?php GetDCCPInterface()->getIGeneral()->printHeaderTrackingCode(); ?>     

                                   

    </head>

   



    <body>

   

    <?php GetDCCPInterface()->getIGeneral()->renderAnnouncementBar(); ?>

   

    <!-- HEADER CONTAINER & MENU -->

    <?php

        if(GetDCCPInterface()->getIGeneral()->showClientPanel())

        {

            GetDCCPInterface()->getIClientPanel()->renderPanel();

        }

    ?>

   

    <div id="login-popup">

        <form action="<?php bloginfo('url'); ?>/wp-login.php" method="post">

            <div class="close"></div>

            <p class="label">Username:</p>

            <input type="text" value="Username" name="log" />

            <p class="label">Password:</p>

            <input type="password" value="Password" name="pwd" />

            <input type="submit" class="send-btn" value="Login" />

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

            <a href="<?php bloginfo('url'); ?>/wp-login.php?action=lostpassword">Forgot Password?</a> / <a href="#" class="help">Help</a>

        </form>

    </div>   

           

    <div id="header-container">



        <div id="header-search-popup">

            <form action="<?php bloginfo('url'); ?>" method="get">

                <input type="text" value="<?php $search_query = (get_query_var( 's' )) ? get_query_var( 's' ) : 'Search..'; echo $search_query; ?>" name="s" />

            </form>   

        </div>



        <a id="header-search-btn"><img class="unitPng" src="<?php bloginfo('template_url'); ?>/img/common_files/search.png" /></a>

   

        <a name="top-anchor"></a>

        <a class="logo" href="<?php echo get_bloginfo('url'); ?>"></a>                 

                                         

        <?php

            GetDCCPInterface()->getIGeneral()->renderHeaderIcons();

            GetDCCPInterface()->getIMenu()->renderMenu();

        ?>   

       

       

            <?php

                if(GetDCCPInterface()->getIGeneral()->showHeaderLogPanel())

                {

                    $out = '';

                    $out .= '<div id="header-login-panel">';

                    global $current_user;

                    get_currentuserinfo();



                    if($current_user->ID)

                    {

                        $out .= '<span>Logged as</span> <span class="user">'.$current_user->display_name.'</span>';

                        $out .= ' &#47; <a href="'.get_bloginfo('url').'/wp-login.php?action=logout">Log Out</a>';

                       
                    } else

                    {

                       $out .= '<span class="sign-in" >Log In</span>'; 

                    }

                    // $out .= '< / <a href="#" class="help">Register</a>';

                    $out .= '</div>';

                    echo $out;

                }                                               

            ?>           

                         

    </div> <!-- header-container -->





I appreciate all your help in these regards, thanks in advance

Re: Display Client Page Link in Header

PostPosted: February 3rd, 2011, 3:38 pm
by FrancescoRizzi
In the last if block, you may want to try the placed marked below with /******* HERE ******/
Code: Select all
            <?php

                if(GetDCCPInterface()->getIGeneral()->showHeaderLogPanel())

                {

                    $out = '';

                    $out .= '<div id="header-login-panel">';

                    global $current_user;

                    get_currentuserinfo();



                    if($current_user->ID)

                    {

                        $out .= '<span>Logged as</span> <span class="user">'.$current_user->display_name.'</span>';
/**** HERE ****/
                        $out .= ' &#47; <a href="'.get_bloginfo('url').'/wp-login.php?action=logout">Log Out</a>';

                       
                    } else

                    {

                       $out .= '<span class="sign-in" >Log In</span>'; 

                    }

                    // $out .= '< / <a href="#" class="help">Register</a>';

                    $out .= '</div>';

                    echo $out;

                }                                               

            ?>           


HTH

Re: Display Client Page Link in Header

PostPosted: February 3rd, 2011, 9:31 pm
by Chris
Thanks for the reply and your efforts to help. I have pasted the code where you suggested, which happens to be where I had suspected it to go. It is functioning as it should, although I still have one issue.
The link is appearing in the upper right corner of the header, which happens to be where my logo is. Now I am sure it can be properly aligned with a few tags of code..... I just don't which ones, since I have no php experience.

I have attached a picture to explain a bit more.
Image

Can you please advise as I would be truly grateful to have my site go live.
Again, thank you for all your help
Chris

Re: Display Client Page Link in Header

PostPosted: February 5th, 2011, 9:48 am
by nhsatomom
Hey, Chris, I may be able to help guide you on this. Can you supply the URL of your site so I can go take a look at your theme?

Re: Display Client Page Link in Header

PostPosted: February 5th, 2011, 5:41 pm
by Chris
Check your PM, I have sent all pertinent information to you.
Thanks for your help

Chris

Re: Display Client Page Link in Header

PostPosted: February 5th, 2011, 5:50 pm
by nhsatomom
Hi, Chris -

I logged in and this is what I saw. The right alignment looks pretty close. What needs nudging?

Tammy

Re: Display Client Page Link in Header

PostPosted: February 5th, 2011, 6:03 pm
by Chris
I am trying to put a link BACK to the actual client page right next to the / Log Out. So I need it to appear as
"Logged as slaprise / Log Out / My Page "

See the attached jpeg above or look to the immediate upper left of my logo once you are logged in on the site.

Chris

Re: Display Client Page Link in Header

PostPosted: February 6th, 2011, 9:41 am
by nhsatomom
Chris, I'm not sure how much I can help with what I can get access to on your site. Did you try putting the link code directly after the code you added as per Francesco's directions above? That's where I would put it in header.php.

Re: Display Client Page Link in Header

PostPosted: February 6th, 2011, 6:29 pm
by Chris
Yes Tammy, I have taken Fracesco's advice and pasted the code where he suggested.

Code: Select all
            <?php

                if(GetDCCPInterface()->getIGeneral()->showHeaderLogPanel())

                {

                    $out = '';

                    $out .= '<div id="header-login-panel">';

                    global $current_user;

                    get_currentuserinfo();



                    if($current_user->ID)

                    {

                        $out .= '<span>Logged as</span> <span class="user">'.$current_user->display_name.'</span>';


                        $out .= ' &#47; <a href="'.get_bloginfo('url').'/wp-login.php?action=logout">Log Out</a>';

*/////////added client page link         
   if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN){ ?>
               <a href="<?php echo S2MEMBER_LOGIN_WELCOME_PAGE_URL; ?>">My Page</a>
 
<?php }
*/////////added client page link                          
                    } else

                    {

                       $out .= '<span class="sign-in" >Log In</span>'; 

                    }

                    // $out .= '< / <a href="#" class="help">Register</a>';

                    $out .= '</div>';

                    echo $out;

                }                                               

            ?>           


Like I said earlier, I think it's just a <div> or 2 that is causing the problem. Any help would be appreciated, as I would like to launch ASAP
Chris

Re: Display Client Page Link in Header

PostPosted: February 7th, 2011, 8:48 am
by nhsatomom
Sorry, Chris -- I'm not able to help. I hope someone else will chime in here.

Re: Display Client Page Link in Header

PostPosted: February 7th, 2011, 12:39 pm
by Cristián Lávaque
Chris, the problem may be that you're not concatenating the string to $out, as the rest is.

So your link should probably go like this:

Code: Select all
// Add s2Member client page link.
if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN)
    $out .= ' &#47; <a href="' . S2MEMBER_LOGIN_WELCOME_PAGE_URL . '">My Page</a>';


Here you can see it with the rest of the code (I formatted it a bit so it's easier to read):

Code: Select all
if(GetDCCPInterface()->getIGeneral()->showHeaderLogPanel())
{
    
    global $current_user
;
    get_currentuserinfo();

    $out = '<div id="header-login-panel">';
    if($current_user->ID) 
    
{
        $out .= '<span>Logged as</span> <span class="user">' . $current_user->display_name . '</span>';
        $out .= ' &#47; <a href="' . get_bloginfo('url') . '/wp-login.php?action=logout">Log Out</a>';
        // Add s2Member client page link.
        if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN)
            $out .= ' &#47; <a href="' . S2MEMBER_LOGIN_WELCOME_PAGE_URL . '">My Page</a>';
    }
    else
        $out 
.= '<span class="sign-in" >Log In</span>';

    // $out .= '< / <a href="#" class="help">Register</a>';
    $out .= '</div>';
    echo $out;
}
 

Re: Display Client Page Link in Header

PostPosted: February 8th, 2011, 2:09 pm
by Chris
Thanks for the help Cristian, I knew it was something simple. And if I was any kind of coder, I would have seen it clearly. It is functioning as I want know. Again a Big Thank You, to all here.

Chris