• Resolved salatfresser

    (@salatfresser)


    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/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter salatfresser

    (@salatfresser)

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

    Thread Starter salatfresser

    (@salatfresser)

    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 } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional echo of a field’ is closed to new replies.