Function __global->set_member_group_timeout

Definitions

sources/group_member_timeouts.php

  • Put a member into a usergroup temporarily. Note that if people are subsequently removed from the usergroup they won't be put back in; this allows the admin to essentially cancel the subscription - however, if it is then extended, they do keep the time they had before too.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$member_id MEMBER No No required parameter N/A N/A The member going in the usergroup
$group_id GROUP No No required parameter N/A N/A The usergroup
$timestamp TIME No No required parameter N/A N/A The expiry timestamp
$prefer_for_primary_group boolean No No False N/A N/A Whether to put the member into as a primary group if this is a new temporary membership (it is recommended to NOT use this, since we don't track the source group and hence on expiry the member is put back to the first default group - but also generally you probably don't want to box yourself in with moving people's primary group, it ties your future flexibility down a lot)

Preview

Code (PHP)

/**
 * Put a member into a usergroup temporarily. Note that if people are subsequently removed from the usergroup they won't be put back in; this allows the admin to essentially cancel the subscription - however, if it is then extended, they do keep the time they had before too.
 *
 * @param  MEMBER $member_id The member going in the usergroup
 * @param  GROUP $group_id The usergroup
 * @param  TIME $timestamp The expiry timestamp
 * @param  boolean $prefer_for_primary_group Whether to put the member into as a primary group if this is a new temporary membership (it is recommended to NOT use this, since we don't track the source group and hence on expiry the member is put back to the first default group - but also generally you probably don't want to box yourself in with moving people's primary group, it ties your future flexibility down a lot)
 */

function set_member_group_timeout(int $member_id, int $group_id, int $timestamp, bool $prefer_for_primary_group = false)