This function is looking at an Xprofile Field, that is updated automatically as a user enters values into their profile.
When they first login to edit their profile, Popup Maker is used to display a message about completing required fields, when that is saved, then it asks users to kindly fill out any optional fields, to assist them getting the attention they seek.
When a user is considered to have completed their profile, there is no need to ask them to complete.
Below is the condition I added to Popup Maker, along with the function I used to look at an XProfile Field in BuddyPress.
The conditions of my popup were
BP:Is Current Action = Edit
And then used the below, set to Not equal (! highlighted)
This had the popup display when the user was editing in BuddyPress and when it was NOT complete
add_filter( 'pum_get_conditions', 'pum_profile_complete_conditions' );
function pum_profile_complete_conditions( $conditions ) {
return array_merge( $conditions, array(
'password_page_unlocked' => array(
'group' => __( 'Pages' ), // Can match any existing group.
'name' => __( 'Profile Stage: Complete' ), // Label to identify it in the list
'callback' => 'profile_stage_complete', // Where the magic happens
),
) );
}
function profile_stage_complete(){
//This is where we check to see if the profile stage is complete for a user
//
$profile_stage = xprofile_get_field_data('Profile Stage');
if ('complete' == $profile_stage){
//Return True if profile is complete
return TRUE;
} else {
//Return False if not complete, so member gets popup advising to complete profile fields
return FALSE;
}
}
-
This reply was modified 8 years, 4 months ago by
bcanr2d2. Reason: Coding typo