BP_Xprofile_Profile_Completion_Widget::get_progress_data( type $profile_groups, type $profile_phototype )
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
- $profile_groups
-
(Required)
- $profile_phototype
-
(Required)
Return
(type)
Source
File: bp-xprofile/classes/class-bp-xprofile-profile-completion-widget.php
function get_progress_data( $profile_groups, $profile_phototype ) { $user_progress_formmatted = array(); // Check if data avail in transient. $pc_transient_name = $this->get_pc_transient_name(); $pc_transient_data = get_transient( $pc_transient_name ); if ( ! empty( $pc_transient_data ) ) { $user_progress_formmatted = $pc_transient_data; } else { // Get logged in user Progress. $user_progress_arr = $this->get_user_progress( $profile_groups, $profile_phototype ); // Format User Progress array to pass on to the template. $user_progress_formmatted = $this->get_user_progress_formatted( $user_progress_arr ); // set Transient here with 3hours expiration. set_transient( $pc_transient_name, $user_progress_formmatted, HOUR_IN_SECONDS * 3 ); } return $user_progress_formmatted; }
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.