WordPress.org

Ready to get started?Download WordPress

Forums

Cimy User Extra Fields
[resolved] Conditional echo of a field (3 posts)

  1. salatfresser
    Member
    Posted 1 year ago #

    Hello! I am building a site including member profiles and i want to show some of the cimy fields in each profile.
    BUT, for instance, when at registration i ask if the user wants his profile to be private through a Cimy field, how can i set that condition on the profile page that if the user selected 'YES' that all his data is hidden?

    These are some fields i'm using:

    $country = get_cimyFieldValue($curauth->ID, 'COUNTRY');
    $birthdate = get_cimyFieldValue($curauth->ID, 'BIRTHDATE');
    $membersince = get_cimyFieldValue($curauth->ID, 'MEMBERSINCE');
    $privacy = get_cimyFieldValue($curauth->ID, 'PRIVACY');

    ...and to echo these values:

    <?php _e('Country'); ?>: <?php echo $country; ?><br />
    <?php _e('Birthday'); ?>: <?php echo $birthdate; ?><br />
    <?php _e('Member since'); ?>: <?php echo $membersince; ?>

    The PRIVACY item mentioned above should set the condition. If its set to 'YES', then it should not show the other data. Maybe this can be done through a specific class? But how? I'm no PHP expert, i hope you can help me with this!

    Thanks in advance for your comments.
    M.

    http://wordpress.org/extend/plugins/cimy-user-extra-fields/

  2. salatfresser
    Member
    Posted 1 year ago #

    Any ideas how to do this? Is is possible at all with Cimy Plugin?

  3. salatfresser
    Member
    Posted 1 year ago #

    I got it.. actually it was easier than expected (i think this is why no one replied, but this was a huge discovery for me) anyway this is what i did, for the case that i want to show or hide Birthday (custom field created with Cimy, being asked at user registration)

    $privacy = get_cimyFieldValue($curauth->ID, 'PRIVACY_BIRTHDAY');
    $birthday = get_cimyFieldValue($curauth->ID, 'BIRTHDAY');
    
    <?php  if((get_cimyFieldValue($curauth->ID, 'PRIVACY_BIRTHDAY', no))) { ?>
    <?php _e('Birthday'); ?>: <?php echo $birthday; ?>
    <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic