Function __global->points_credit_member

Definitions

sources/points2.php

  • Credit points to a member from the system (use points_refund for refunds).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$member_id MEMBER No No required parameter N/A N/A The member to credit
$reason SHORT_TEXT No No required parameter N/A N/A The reason for this credit in the logs
$total_points integer No No required parameter N/A N/A The total points to credit (including gift points when applicable)
$anonymous BINARY No No 0 N/A N/A Whether this transaction should be anonymous
$send_notifications ?boolean No No True N/A N/A Whether to send notifications for this transaction (false: only the staff get it) (true: both the member and staff get it) (null: neither the member nor staff get it)
$locked BINARY No No 0 N/A N/A Whether this transaction is irreversible (Ignored / always 1 when $amount_gift_points is > 0)
$t_type ID_TEXT No No Blank (empty string) N/A N/A An identifier to relate this transaction with other transactions of the same $type (e.g. content type)
$t_subtype ID_TEXT No No Blank (empty string) N/A N/A An identifier to relate this transaction with other transactions of the same $type and $subtype (e.g. an action performed on the $type)
$t_type_id ID_TEXT No No Blank (empty string) N/A N/A Some content or row ID of the specified $type
$time ?TIME No No Null N/A N/A The time this transaction occurred (null: now)
$is_ranked boolean No No True N/A N/A Whether the points should also be added to the receiving member's rank points

Returns

  • The ID of the point transaction (null: no transaction took place)
  • Type: ?AUTO_LINK
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Credit points to a member from the system (use points_refund for refunds).
 *
 * @param  MEMBER $member_id The member to credit
 * @param  SHORT_TEXT $reason The reason for this credit in the logs
 * @param  integer $total_points The total points to credit (including gift points when applicable)
 * @param  BINARY $anonymous Whether this transaction should be anonymous
 * @param  ?boolean $send_notifications Whether to send notifications for this transaction (false: only the staff get it) (true: both the member and staff get it) (null: neither the member nor staff get it)
 * @param  BINARY $locked Whether this transaction is irreversible (Ignored / always 1 when $amount_gift_points is > 0)
 * @param  ID_TEXT $t_type An identifier to relate this transaction with other transactions of the same $type (e.g. content type)
 * @param  ID_TEXT $t_subtype An identifier to relate this transaction with other transactions of the same $type and $subtype (e.g. an action performed on the $type)
 * @param  ID_TEXT $t_type_id Some content or row ID of the specified $type
 * @param  ?TIME $time The time this transaction occurred (null: now)
 * @param  boolean $is_ranked Whether the points should also be added to the receiving member's rank points
 * @return ?AUTO_LINK The ID of the point transaction (null: no transaction took place)
 */

function points_credit_member(int $member_id, string $reason, int $total_points, int $anonymous = 0, ?bool $send_notifications = true, int $locked = 0, string $t_type = '', string $t_subtype = '', string $t_type_id = '', ?int $time = null, bool $is_ranked = true) : ?int