Browse: Home / Hooks /

learndash_profile_stats

apply_filters( 'learndash_profile_stats',  array $learndash_profile_stats,  int $user_id )

Filters LearnDash user profile statistics.


Description #


Parameters #

$learndash_profile_stats

(array) An array of profile stats data.

$user_id

(int) User ID.


Source #

File: themes/ld30/templates/shortcodes/profile.php


Examples #

Note: Extended code example below not guaranteed, you may need to consult with a developer

 <?php
/**
 * Example usage for learndash_profile_stats filter.
 */
add_filter(
	'learndash_profile_stats',
	function( $stats = array(), $user_id = 0 ) {
		/**
		 * Here modify the $stats array of columns.
		 * Array(
		 *  [0] => Array (
		 *      [title] => Self Assessment Courses
		 *      [value] => 14
		 *      [class] => ld-profile-stat-courses
		 *  )
		 *  [1] => Array (
		 *      [title] => Completed
		 *      [value] => 1
		 *      [class] => ld-profile-stat-completed
		 *  )
		 *  [2] => Array (
		 *      [title] => Certificates
		 *      [value] => 1
		 *      [class] => ld-profile-stat-certificates
		 *  )
		 *  [3] => Array (
		 *      [title] => Points
		 *      [value] => 0
		 *      [class] => ld-profile-stat-points
		 *  )
		 * )
		 */

		// Always return $stats.
		return $stats;
	},
	30,
	2
);
 

Changelog #

Changelog
Version Description
3.1.0 Introduced.