PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

S2member user custom field

s2Member Plugin. A Membership plugin for WordPress®.

S2member user custom field

Postby jeansuhas » August 1st, 2011, 12:27 pm

Hi there,
I have purchased the S2member pro. Sounds awesome.

I have a question:
- user custom field generated by S2member are meta?
- does it means that i can display them somewhere on my theme using this type of code:
<?php echo esc_attr( get_the_author_meta( 'contact_number' ) ); ?>

I have tried. it is not working.

How can i do it?

regards
User avatar
jeansuhas
Registered User
Registered User
 
Posts: 9
Joined: August 1, 2011

Re: S2member user custom field

Postby Cristián Lávaque » August 1st, 2011, 10:14 pm

This may help you with that viewtopic.php?f=4&t=6546&p=16582#p16582

Read the whole thread to understand it better. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: S2member user custom field

Postby jeansuhas » August 4th, 2011, 12:55 pm

ok thank you. BUT
the code works when a connected user want to see the information of another user (custom field). Unfortunately a visitor (unregistered) won't be able to see the information.

I used this peace of code in my theme for the field "adress2":
<span>
<?php echo get_user_field("adress2"); ?>
</span>

To you know any hacks to allow custom fiel diplaying for unregistered users?

Regards
User avatar
jeansuhas
Registered User
Registered User
 
Posts: 9
Joined: August 1, 2011

Re: S2member user custom field

Postby Cristián Lávaque » August 4th, 2011, 11:35 pm

I don't understand... You want to see the custom field of an account that doesn't exist because the person hasn't registered?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: S2member user custom field

Postby jeansuhas » August 5th, 2011, 5:34 am

If i am not registered or logged in, i want to be able to see the custom field of a registered user.
User avatar
jeansuhas
Registered User
Registered User
 
Posts: 9
Joined: August 1, 2011

Re: S2member user custom field

Postby Cristián Lávaque » August 5th, 2011, 10:26 pm

Ah, that's fine, you can do that. :)

viewtopic.php?f=4&t=6546&p=16582#p16582
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: S2member user custom field

Postby jeansuhas » August 7th, 2011, 12:29 pm

Please I couldn't find the answer. I already used the stated function it is not showing for unregistered users.
why?
User avatar
jeansuhas
Registered User
Registered User
 
Posts: 9
Joined: August 1, 2011

Re: S2member user custom field

Postby Cristián Lávaque » August 8th, 2011, 1:25 pm

Could you please show me the code you're using and how you're using it?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: S2member user custom field

Postby jeansuhas » August 8th, 2011, 2:02 pm

Code: Select all
<?php } ?>
   
          <div class="contact">
          
             <span class="button" ><?php echo $woo_options['woo_label_contact_agent_button']; ?></span>
          
             <div class="agent-popup">
                
                <?php the_commenter_avatar(array('avatar_size'=>'56')) ?>
             
 
                               
                <div class="details">
                   <?php $first_name = esc_attr( get_the_author_meta( 'first_name' ) ); ?>
                   <?php $last_name = esc_attr( get_the_author_meta( 'last_name' ) ); ?>
                   <?php if ( ($first_name != '') && ($last_name != '') ) { $display_name = $first_name.' '.$last_name; } else { $display_name = esc_attr( get_the_author_meta( 'display_name' ) ); } ?>
                   <span class="name"><?php echo $display_name; ?></span>
                   <span>
                      <?php echo esc_attr( get_the_author_meta( 'contact_number' ) ); ?>
                   </span>
                                         <span>
                                                <?php echo get_user_field("agency"); ?>
                                         </span>
                   <span>
                      <?php $author_email = esc_attr( get_the_author_meta( 'user_email' ) ); ?>
                      <input type="text" style="display:none;" value="<?php echo $author_email; ?>" id="email" name="email" />
                      <?php if ($woo_options['woo_contact_form_link'] == 'true') { ?>
                      <a href="<?php bloginfo('url'); ?>/<?php echo $woo_options['woo_contact_form_page']; ?>/?propertyid=<?php echo $post->ID; ?>&agentid=<?php echo get_the_author_meta( 'ID' ); ?>" title="<?php echo $author_email; ?>"><?php echo $woo_options['woo_label_agent_email_link']; ?></a><?php } else { ?>
                      <a href="mailto:<?php echo $author_email; ?>" title="<?php echo $author_email; ?>"><?php echo $woo_options['woo_label_agent_email_link']; ?></a><?php } ?>
                      
                   </span>
                   
User avatar
jeansuhas
Registered User
Registered User
 
Posts: 9
Joined: August 1, 2011

Re: S2member user custom field

Postby Cristián Lávaque » August 8th, 2011, 3:53 pm

I see what you're doing. The problem is that you're not telling get_user_field the ID of the user. It should be like this:

Code: Select all
echo get_user_field('agency', $author_id); 


I should see the code that comes before what you quoted to have a better idea of how to get the author's ID, but maybe this would work:

Code: Select all
$author_id = get_the_author_meta('ID'); 


So

Code: Select all
<?php echo get_user_field('agency', get_the_author_meta('ID')); ?>


I hope that helps.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 1 guest

cron