Group Accounts - Actions & Filters

Here's a list of some useful actions and filters used within the Group Accounts plugin:

Actions

rcpga_add_member_to_group_after

Runs right after a new user is added to a group.

Parameters:

  • $user_id (int) - ID number of the new member's user account.
  • $args (array) - Arguments used when adding the member to the group. May include:
    • group_id (int) - ID number of the group the user is being added to.
    • user_email (string) - New member's email address.
    • user_login (string) - Optional. New member's email address.
    • first_name (string) - Optional. New member's first name.
    • last_name (string) - Optional. New member's last name.
    • user_pass (string) - Optional. New member's password.
    • send_invite (bool) - Whether or not to send an email invite to the new member.
    • role (string) - New role to be assigned, such as: rcp-invited or member.

rcpga_send_group_invite

Runs right after the group invitation email is sent to a member.

Parameters:

  • $user_id (int) - ID of the user the invite was sent to.
  • $email (string) - Email address the invite was sent to.

rcpga_remove_member

Runs right after a member is removed from a group.

Parameters:

  • $user_id (int) - ID of the member's user account.
  • $group_id (int) - ID of the group they were removed from.

Filters

rcpga_invite_user_args

Filters the arguments used when adding a new member to a group.

Parameters:

  • $args (array) - Arguments used when adding a member to a group. May include:
    • group_id (int) - ID number of the group the user is being added to.
    • user_email (string) - New member's email address.
    • user_login (string) - Optional. New member's email address.
    • first_name (string) - Optional. New member's first name.
    • last_name (string) - Optional. New member's last name.
    • user_pass (string) - Optional. New member's password.
    • send_invite (bool) - Whether or not to send an email invite to the new member.
    • role (string) - New role to be assigned, such as: rcp-invited or member.

rcpga_send_group_invite_args

Allows you to modify the invitation email, including the email address the invite is being sent to, the email subject, and the email message.

Parameters:

  • $email_info (array) - Array containing the following keys:
    • to (string) - Email address the email is being sent to.
    • subject (string) - Email subject.
    • message (string) - Email message.
    • headers (string) - Email headers.
  • $user_id (int) - ID of the user the invite email is being sent to.

rcpga_get_level_group_seats_allowed

Filters the number of group seats allowed for a certain membership level.

Parameters:

  • $number (int) - Number of allowed seats.
  • $level_id (int) - ID number of the membership level.

rcpga_is_level_group_accounts_enabled

Filters whether or not Group Accounts is enabled for a certain membership level.

Parameters:

  • $enabled (bool) - Whether or not the Group Accounts feature is enabled for this level.
  • $level_id (int) - ID number of the membership level.

rcpga_get_member_role_label

Filters the label for a specific role. You'd want to use this filter if you wanted to change the role names ("Owner" "Member", etc.).

Parameters:

  • $label (string) - Label used for display purposes ("Owner", "Admin", "Member", "Invited").
  • $role (string) - Role key being requested ("owner", "admin", "member", "invited").

Example:

This example changes the label "Admin" to "Leader":

function ag_rcpga_get_member_role_label( $label, $role ) { if ( 'owner' == $role ) { $label = __( 'Leader' ); } return $label; } add_filter( 'rcpga_get_member_role_label', 'ag_rcpga_get_member_role_label', 10, 2 );