function hook_privatemsg_recipient_type_info in Privatemsg 7
Same name and namespace in other branches
- 6.2 privatemsg.api.php \hook_privatemsg_recipient_type_info()
- 7.2 privatemsg.api.php \hook_privatemsg_recipient_type_info()
This hook is used to tell privatemsg about the recipient types defined by a module. Each type consists of an array keyed by the internal recipient type name and the following keys must be defined.
- name: Translated name of the recipient type.
- description: A short description of how to send messages to to that recipient type. This is displayed below the To: field when sending a message.
- load: A callback function that can load recipients based on their id, example: privatemsg_roles_load_multiple().
- format: Theme function to format the recipient before displaying. Must be defined with hook_theme(), example: theme_privatemsg_roles_format().
- autocomplete: Function callback to return possible autocomplete matches, example: privatemsg_roles_autocomplete().
- generate recipients: Function callback to return user ids which belong to a recipient type, example: privatemsg_roles_load_recipients().
- max: Function callback to return the highest user id of a recipient type, example: privatemsg_roles_count_recipients().
- write access: Optionally define a permission which controls write access to that recipient type.
- write callback: Optionally define a callback function that returns an access decision (allow = TRUE, deny = FALSE) for whether the current user can write to recipients of the given recipient type.
- view access: Optionally define a permission which controls if the user is able to see the recipient when he is looking at a thread.
- view callback: Optionally define a callback function that returns an access decision (allow = TRUE, deny = FALSE) for whether the current user can see recipients of the given recipient type.
Related topics
2 functions implement hook_privatemsg_recipient_type_info()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- privatemsg_privatemsg_recipient_type_info in ./
privatemsg.module - Implements hook_privatemsg_recipient_type_info().
- privatemsg_roles_privatemsg_recipient_type_info in privatemsg_roles/
privatemsg_roles.module - Implements hook_privatemsg_recipient_type_info().
1 invocation of hook_privatemsg_recipient_type_info()
- privatemsg_recipient_get_types in ./
privatemsg.module - Returns an array of defined recipient types.
File
- ./
privatemsg.api.php, line 485 - Privatemsg API Documentation
Code
function hook_privatemsg_recipient_type_info() {
return array(
'role' => array(
'name' => t('Role'),
'description' => t('Enter the name of a role to write a message to all users which have that role. Example: authenticated user.'),
'load' => 'privatemsg_roles_load_multiple',
'format' => 'privatemsg_roles_format',
'autocomplete' => 'privatemsg_roles_autocomplete',
'generate recipients' => 'privatemsg_roles_load_recipients',
'count' => 'privatemsg_roles_count_recipients',
'write callback' => 'privatemsg_roles_write_access',
'view access' => 'view roles recipients',
),
);
}