Jump to content


Photo
- - - - -

Add login/register in Branding with Hook

Hook Branding Login

Best Answer mdcryan , 27 May 2013 - 01:20 AM

Sure

I had all sorts of problems with the CSS styling correctly when I used "pagelines_branding_icons_start" so I switched to "Pagelines_after+branding_wrap"

Action Map plugin very helpful in working out which one to use.

I didnt end up using "hooker", just updated the Functions.php file in the "wp-Content>plugins>Pagelines-customisation>" folder

See the working code below. It also includes Welcome back, edit profile and logout options

 
/*
// ===========================================================================
// LoginLogout  = Flips between whether Login/register or Edit Profile/Logout
// Placed in hook Pagelines_after_branding_wrap and then positioned using 
// absolute positioning in front of the Social icons
//
// I am also using UPME WP plugin to bring all WP registration to frontend and hence 
// using pages (ffh-Login & ffh-Registration & Edit-profile)) that calls the 
// UPME shortcode in pages of that name. You could just use the standard WP pages
// ===========================================================================
*/


add_action('pagelines_after_branding_wrap', 'loginlogout');
function loginlogout() { ?>

<div class="header-login">
  <?php if(is_user_logged_in()): 
  	$user = wp_get_current_user();?>
	Welcome back <span style="color:#FFAA33"><?php echo $user->display_name; ?> </span>
  	<a href="http://www.your URL.org/edit-profile/">Edit Profile</a>&nbsp;|&nbsp;<a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a>
 	 <?php endif; ?>
  <?php if(!is_user_logged_in()): ?>
  	<a href="http://www.yourURL.org/ffh-login/">Login</a>&nbsp;|&nbsp;<a href="http://www.yourURL/ffh-registration/">Register</a>
  <?php endif; ?>

 <div style="clear:both"></div>
 </div>
<?php 
}

Go to the full post


  • Please log in to reply
7 replies to this topic

#1 mdcryan

mdcryan

    Newbie

  • Members
  • 9 posts
  • LocationSingapore
  • Country: Country Flag

Posted 25 May 2013 - 01:46 AM

I have added the following function to  pagelines-customize/functions.php. I want to add conditional Login/out and register to the left of the social icons in branding.
I have then styled the "header-login" class with Css in style.less

ISSUE: It is not showing up at all. It is my firstt-time using Hooks and I thought I had followed all the FAQS etc closely, but what am I doing wrong?

Please Login or Register to see this Hidden Content



#2 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 25 May 2013 - 01:33 PM

Try this hook: pagelines_branding_icons_start

 

And I'd recommend renaming the function from add_loginlogout  to just loginlogout. 

 

Did you use our Action Map plugin (free in our Store > Plugins > Top Free)?  Have you considered using our Hooker plugin?  It's a fantastic way of adding a hook without writing the code to functions.php. You just select the hook and drop in the code for the function.



#3 mdcryan

mdcryan

    Newbie

  • Members
  • 9 posts
  • LocationSingapore
  • Country: Country Flag

Posted 26 May 2013 - 01:04 AM

THanks - i've made the changes you suggested but nothing (ie my login/Logout/register) at all appears in the Branding section still



#4 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 26 May 2013 - 01:57 PM

When you used the Action Map, did it point you to the correct hook? If so, which one is it?

 

When using hooker, what did you add to that hook, exactly? Can you paste the code added?  Thanks.



#5 mdcryan

mdcryan

    Newbie

  • Members
  • 9 posts
  • LocationSingapore
  • Country: Country Flag

Posted 27 May 2013 - 01:20 AM   Best Answer

Sure

I had all sorts of problems with the CSS styling correctly when I used "pagelines_branding_icons_start" so I switched to "Pagelines_after+branding_wrap"

Action Map plugin very helpful in working out which one to use.

I didnt end up using "hooker", just updated the Functions.php file in the "wp-Content>plugins>Pagelines-customisation>" folder

See the working code below. It also includes Welcome back, edit profile and logout options

Please Login or Register to see this Hidden Content



#6 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 27 May 2013 - 01:18 PM

So you got it working then?



#7 mdcryan

mdcryan

    Newbie

  • Members
  • 9 posts
  • LocationSingapore
  • Country: Country Flag

Posted 27 May 2013 - 01:23 PM

Yes - thanks 

Please Login or Register to see this Hidden Content

  (Home page, iconography and images are still just placeholders, but focused on functionality at the moment which is coming along nicely. Put all of this together over 3 days using page lines . I'm impressed!)

 

 

Now playing around with other plugins to jazz up user registration, custom fields, integration with gravity forms etc... but the page lines is working fine....except for responsive design....when I view on mobile the positioning of the login/register is screwed up (Tackle that battle another day unless you have a suggestion)



#8 James B

James B

    Advocate

  • Moderators
  • 4979 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 27 May 2013 - 08:55 PM

Excellent, thats great news.

 

You can ajust the mobile position of the login/register using @media commands in the css, or by using browser specific css via our plugin, which adds a class for each browser. 

 

See

Please Login or Register to see this Hidden Content

to download the plugin and

Please Login or Register to see this Hidden Content

for instructions and a list of the classes which can be used. If you get stuck or need further help, open a new topic as once a topic gets marked resolved/answered the moderator team don't see it as a new question in the queue. I clikced on this one by chance when catching up with the days topics etc, just to make sure your question isn't missed if you try to respond to this etc :-)


  • mdcryan likes this





Also tagged with one or more of these keywords: Hook, Branding, Login