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.

In most cases, this action fires during the point payout / deduction process. For this reason, you can not use any function that adds or deducts points from a users account e.g. mycred_add or mycred()->add_creds(). If you do, you will create an infinite loop!

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.

$results obj No

The database requests that caused this action to fire. (Added in 1.7).

Available details:

  • rank_id – The new rank ID the user has reached
  • current_id – The ID of the users current rank that they will lose
  • minimum – The new ranks set minimum balance requirement
  • maximum – The new ranks set maximum balance requirement

Used By

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

Examples

Example 1: When a user is demoted to a lower rank, we penalize them by deducting 10 points from their account.