Skip to:
Content
Pages
Categories
Search
Top
Bottom

Need simple "if" php code for xprofile_get_field_data


  • CC-Cailin
    Participant

    @cc-cailin

    Hi all, I want to display a specific profile field somewhere else on the member profile page. This works perfectly:

    <?php echo xprofile_get_field_data(‘2’); ?>

    BUT, I only want to display it if the user actually entered something into that field. So, I need a simple php if statement. Can anyone help?

Viewing 2 replies - 1 through 2 (of 2 total)

  • bp-help
    Participant

    @bphelp

    @cc-cailin
    By default if the field is not filled out it should not be showing on the profile page unless you introduced some code to alter that behavior.


    CC-Cailin
    Participant

    @cc-cailin

    I am displaying it in link form…. so I needed an “if” condition. I think I found the solution though. Here it is for anyone else who needs it:

    <?php if (xprofile_get_field_data('2')): ?>
    <a href="http://www.twitter.com/<?php echo xprofile_get_field_data('2'); ?>">My Twitter Page</a>
    <?php endif; ?>
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Need simple "if" php code for xprofile_get_field_data’ is closed to new replies.
Skip to toolbar