Jump to content
Sign in to follow this  
gilfer911

User Info

Recommended Posts

gilfer911

Hi guys & gals,

 

I wonder is someone could assist me as I ma fairly new to PL and coding php & css.  I am trying to display some user info on a page (ie name, surname and photo) of the user.  I have trawled the net and found the following solution...

 

What I would like to know is are there any easier ways to do this...and if not what is the best solution...also, I have no idea where to put this code in PageLines?

 

Please help

 

Gil

 

 

 

Very simple snippet to display a user’s name when they log in to a premium membership site.
Then, to display their name, all you have to do is use the shortcode
[user_first_name], and their name will appear instead (assuming it has
been entered in their profile).

// DISPLAY USER'S FIRST NAME
function user_first_name() {
    global $current_user;
    get_currentuserinfo();
    $first_name = esc_attr( $current_user->user_firstname );
    return $first_name;
}
add_shortcode( 'user_first_name', 'user_first_name' );

You can
take it a little further and modify this to show other information
instead by taking advantage of the other variables available under
$current_user. Use the following values to show more information:

  • First name: user_firstname
  • Last name: user_lastname
  • Display name: display_name
  • Username: user_login
  • User email address: user_email
  • User ID: ID

Share this post


Link to post
Share on other sites
Danny

Hi,

 

In order to achieve something like this, you will need to probably use a Membership plugin, which can be found on the Wordpress plugin repository and a hook to insert the PHP code to your preferred location.

 

You can find the Wordpress conditional tags - http://codex.wordpress.org/Conditional_Tags

The Wordpress tag for user is logged in, can be found here - http://codex.wordpress.org/Function_Reference/is_user_logged_in

 

You will then need to use a hook to insert your custom code, you can find the a free plugin called Action Map on the PageLines store, which will allow you to find the correct location.

 

 

Unfortunately, we are unable to provide you the custom CSS needed to achieve your layout. If you're not comfortable with custom CSS or code. I recommend you contact one of our Pros for assistance 


http://www.pagelines.com/pros/


Be sure to also check out our CSS Customization section in our documentation to give you a good head start on CSS changes you can make.

 

http://support.pagel...ion/custom-css/


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
gilfer911

Thanks Danny...I have found bits and bobs of code that seem to work on other people's website...but my main issue is how and where do I put the code - you mention hooks?  Is that like the PL plugin for hooks...then just drop the code into that??

 

Sorry - but still learning here

Share this post


Link to post
Share on other sites
Danny

There is a plugin available for free on the PageLines store called ActionMap, this plugin allows you to view all available hooks on your page, when you enable the plugin.

You add hooks to your child themes or the PageLines customize plugins functions.php file.

 

For more information on hooks, see the Wordpress codex article - http://codex.wordpress.org/Plugin_API

The PageLines hooks list can be found here - http://api.pagelines.com/hooks

 

There is also another plugin that is premium, called Hooker and this allows you to add code to your site much easier and I recommend you check it out.

 

http://www.pagelines.com/store/plugins/hooker/


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
gilfer911

Just for the record, I have found a plugin called User meta shortcodes - its free and after installation all you do is put shortcodes in your pages and posts to pull user data! Voila!

 

Thanks for all the help anyway guys

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×