mycred_user_got_promoted

Codex / mycred/rank / Actions / mycred_user_got_promoted

Description

This action hook fires each time a user has been promoted to a rank that has a higher minimum point requirement set then their previous rank. For demotions, please see the mycred_user_got_demoted action.

Available since version 1.4

Parameters

Param Type Required Description
$user_id int No

The ID of the user that is affected by this promotion.

$rank_id int No

The rank post ID that the user was promoted to.

Used By

Package Prio. Description
Not used by any built-in package.

Examples

Example 1: Give 10 bonus points to users that reach a rank with the ID 123.

add_action( 'mycred_user_got_promoted', 'mycredpro_bonus_for_new_rank', 10, 2 );
function mycredpro_bonus_for_new_rank( $user_id, $rank_id ) {

	if ( $rank_id !== 123 ) return;

	mycred_add(
		'bonus_points',
		$user_id,
		10,
		'Bonus for reaching "Legend" rank'
	);

}

Last edited March 5, 2016