mycred_user_got_demoted

Codex / mycred/rank / Actions / mycred_user_got_demoted

Description

This action hook fires each time a user has been demoted to a rank that has a lower minimum point requirement set then their previous rank. For promotions, please see the mycred_user_got_promoted 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 demotion.

$rank_id int No

The rank post ID that the user was demoted to.

Used By

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

Examples

Example 1: Deduct 10 points from users that gets demoted as a penalty.

add_action( 'mycred_user_got_demoted', 'mycredpro_penalty_for_lower_rank', 10, 2 );
function mycredpro_penalty_for_lower_rank( $user_id, $rank_id ) {

	mycred_add(
		'penalty',
		$user_id,
		0 - 10,
		'Penalty for rank demotion'
	);

}

Last edited March 5, 2016