Skip to content

Instantly share code, notes, and snippets.

@BoweFrankema
Created November 24, 2014 13:37
Show Gist options
  • Save BoweFrankema/78e0c4ee900e9ecfce10 to your computer and use it in GitHub Desktop.
Save BoweFrankema/78e0c4ee900e9ecfce10 to your computer and use it in GitHub Desktop.
Show a message when a certain xProfile field is empty. This is useful when you add new *critical* fields or have an additional sign-up system (Social Logins etc)
<?php
// Profile Edit Message
function cf_profile_field_intro_text() { { ?>
<?php
global $bp;
$user_id = $bp->loggedin_user->id;
$profile_edit_link = bp_loggedin_user_domain() . $bp->profile->slug . 'profile/edit/group/2/';
if ( bp_get_profile_field_data( 'field=Your Relationship with CF&user_id='.$user_id) == FALSE && !bp_is_profile_edit() ) : ?>
<div id="complete-profile-message" class="intro-text important">
<img class='avatar user-2-avatar avatar-80 photo'src='<?php echo home_url(); ?>/wp-content/themes/cfcommunity/assets/img/cfchimp-large.png'/>
<?php printf( __( "Hey there!, you have not completed your profile yet. This is probably because you have created your account through Facebook. Please <a href='%s'>Complete Your Profile</a> and I will go back to eating those calorie rich bananas!", 'cfcommunity' ), bp_loggedin_user_domain() . $bp->profile->slug . '/edit/group/2/' );?>
</div>
<?php endif ?>
<?php }}
add_action('wp_head','cf_profile_field_intro_text');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment