bp_xprofile_get_user_progress_data( $profile_groups,  $profile_phototype,  $widget_id )

Function returns user progress data by checking if data already exists in transient first. IF NO then follow checking the progress logic.

Description

Clear transient when 1) Widget form settings update. 2) When Logged user profile updated. 3) When new profile fields added/updated/deleted.

Parameters

$settings

(array) (Required) - set of fieldset selected to show in progress & profile or cover photo selected to show in progress.

Return

(array) $user_progress - user progress to render profile completion

Source

File: bp-core/deprecated/buddyboss/1.5.3.php

function bp_xprofile_get_user_progress_data( $profile_groups, $profile_phototype, $widget_id ) {

	$user_progress = array();

	// Check if data avail in transient.
	$pc_transient_name = bp_xprofile_get_profile_completion_transient_name( bp_core_get_profile_completion_key(), $widget_id );
	$pc_transient_data = get_transient( $pc_transient_name );

	if ( ! empty( $pc_transient_data ) ) {

		$user_progress = $pc_transient_data;

	} else {

		// Get logged in user Progress.
		$user_progress_arr = bp_xprofile_get_user_progress( $profile_groups, $profile_phototype );

		// Format User Progress array to pass on to the template.
		$user_progress = bp_xprofile_get_user_progress_formatted( $user_progress_arr );

		// set Transient here with 3hours expiration.
		set_transient( $pc_transient_name, $user_progress, HOUR_IN_SECONDS * 3 );
	}

	return $user_progress;
}

Changelog

Changelog
Version Description
BuddyBoss 1.4.9 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.