[Resolved] detecting if buddypress profile field has been completed?
I am attempting to try and display a buddypress profile field I call What makes me tick… using an if/else statement in the content.php file where typically the author description would be displayed.
I am successfully retrieving the field. This part works. However, what I would like to do is display alternate text if the user has not entered anything in this field. The result is both the profile information and the alternate text being displayed.
My background is with Python. This is my first foray into working with php. Any help, pointers and best practices suggestions are greatly appreciated.
Here is the relevant code from the bottom of the content.php file:
<?php $bpProfile_tick = bp_profile_field_data( 'field=What makes me tick...&user_id=' . get_the_author_meta( 'ID' ) ); if ( $bpProfile_tick ) : // If a user has filled out their description ?> <p><?php echo $bpProfile_tick; ?></p> <?php else: ?> <p>Apparently <?php echo get_the_author() ?> does not feel like sharing anything. Isn't this sad?</p> <?php endif; ?>
You must be logged in to reply to this topic.