BuddyDev

Search

Need a way to notify admin of profile completion…

  • Participant
    Level: Initiated
    Posts: 17
    John on #49598

    Hi, I’ve decided to create a kind of holding area on my site for new members. I want to give them access to certain content but limit their community access until they’ve completed their profile.

    I’m using the buddydev profile completion plugin, but I’d prefer to just be able to get an admin notification or email when a user completes their profile.

    Possible?

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2890
    Ravi on #49599

    Hello John,

    Thank you for using BuddyPress Profile Completion plugin, Please use the following code to notify site admin on profile completion.

    
    
    add_action( 'bpprocn_user_profile_completed', function ( $user_id ) {
    
    	if ( ! function_exists( 'buddypress' ) ) {
    		return;
    	}
    
    	$admin_email = get_option( 'admin_email', '' );
    
    	$subject = __( 'New user profile completed' );
    	$message = __( 'User profile completed: ' ) . bp_core_get_user_displayname( $user_id ) . ' (' . bp_core_get_user_domain( $user_id ) . ')';
    
    	@wp_mail( $admin_email, $subject, $message );
    } );
    
    

    Please give it a try.

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 17
    John on #49804

    Hi Ravi, that’s very generous of you to provide this code.

    I’ve tried the code, but all it can do is send an email anytime a user updates any aspect of their profile, which is not what I need. I need just one email sent when ALL aspects of the profile are completed – as measured but the Buddyboss profile completion widget.

    Currently, the BB profile completion widget can be set to disappear when the profile is complete, so there is an existing part of the BB code that knows when a person has completed their profile…

    I have opened a ticket with Buddyboss:

    “Hi, I want to create a function that emails the site admin when a user completes their profile – as measured by the Buddyboss profile completion widget. The widget can be set to disappear when the profile is complete. Is there a way to call on that status?”

    I will follow up here when I get an answer from them.

    Thank you!

  • Participant
    Level: Initiated
    Posts: 17
    John on #49864

    Hi Ravi, the relevant code in the Buddyboss template is found in: /buddyboss-theme/inc/plugins/elementor/widgets/bb-profile-completion.php

    Line 962:

    if ( ( $settings[‘switch_hide_widget’] == ‘yes’ || ! isset( $settings[‘switch_hide_widget’] ) ) && ( $user_progress[‘completion_percentage’] == 100 ) ) { ?>

    It is that $user_progress[‘completion_percentage’] == 100 that I need to trigger the sending of the email.

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2890
    Ravi on #49867

    Hello John,

    Thank you for sharing the code. This piece of code will not help much. But, We need an action when the user profile gets completed so that we can use this action to notify the admin. Please contact BuddyBoss for the same they can help you with this issue.

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 17
    John on #49878

    Update: the code is actually in:

    /buddyboss-platform/bp-xprofile/classes/class-bp-xprofile-profile-completion-widget.php

  • Participant
    Level: Initiated
    Posts: 17
    John on #49879

    Thank you for the replay Ravi, is this an action?

    if ( ( $settings['switch_hide_widget'] == 'yes' || ! isset( $settings['switch_hide_widget'] ) ) && ( $user_progress['completion_percentage'] == 100 ) ) { ?>

  • Participant
    Level: Initiated
    Posts: 17
    John on #49880

    No, it must be this:

    // Hide the widget if "Hide widget once progress hits 100%" selected and progress is 100%
    		if ( 100 === (int) $user_progress['completion_percentage'] && ! empty( $instance['profile_hide_widget'] ) ) {
    			return;
    		}
  • Participant
    Level: Initiated
    Posts: 17
    John on #49881

    Ok, I think I understand now. The function you gave me was designed to work WITH the buddy dev profile completion widget.

    The problem I have is that I’m using an additional profile field group. That breaks the buddy dev profile completion widget:

    Basic Info (collected at registration)
    More About Me (user fills in later)

    So, I need the buddy dev profile completion widget to handle an extra profile field group

    OR

    I need a function based on
    /buddyboss-platform/bp-xprofile/classes/class-bp-xprofile-profile-completion-widget.php

    That can email the admin when a user’s profile reaches 100% as measured by that widget:
    if ( 100 === (int) $user_progress[‘completion_percentage’]

    That widget can handle multiple profile field groups.

    • This reply was modified 8 months, 1 week ago by John.
  • Participant
    Level: Initiated
    Posts: 17
    John on #49884

    Hi Ravi, I found another solution so please disregard my comments. Thank you.

You must be logged in to reply to this topic.

This topic is: not resolved