BuddyDev

Search

[Resolved] How do I check if user profile is complete?

  • Participant
    Level: Enlightened
    Posts: 88
    Torben Heikel Vinther on #32098

    Hi

    I use (and love) the plugin BuddyPress Profile Completion. Is it possible to check if a user profile is completed using a function in a custom plugin?

    I could create a manual call to the database and check for the meta key “_has_complete_profile” for the specific user id in the usermeta table, but I if there’s a built-in solution I’ll not do it 🙂

    Among other things I need to check if a user has set his birth date in his profile, and if he hasn’t then write a message etc.

    Thanks
    Torben

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #32103

    Hi Torben,
    Thank you for the question.

    You may use this

    
    
    if ( function_exists( 'bpprocn_has_incomplete_profile' ) && ! bpprocn_has_incomplete_profile( $user_id ) ) {
    
    }
    
    

    Please replace the $user_id with the desired id.

    We do not have any specific API for field data since BuddyPress already provides that.

    You may use either ‘xprofile_get_field_data’ or ‘BP_XProfile_ProfileData::get_value_byid’ to check if the field has data(2nd should be preferred if checking for data availability, 1st for display).

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 88
    Torben Heikel Vinther on #32107

    Awesome, thanks! I managed to write a custom function using xprofile_get_field_data to check for both birthdate and another setting. It works 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #32118

    Thank you for the reply.

    I am glad you were able to solve it 🙂

    Regards
    Brajesh

The topic ‘ [Resolved] How do I check if user profile is complete?’ is closed to new replies.

This topic is: resolved