Function __global->cns_make_member
Definitions
sources/cns_members_action.php
- Add a member.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: int
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $username | SHORT_TEXT | No | No | required parameter | N/A | N/A | The username |
| $password | SHORT_TEXT | No | No | required parameter | N/A | N/A | The password |
| $email_address | SHORT_TEXT | No | No | Blank (empty string) | N/A | N/A | The e-mail address |
| $primary_group | ?GROUP | No | No | Null | N/A | N/A | The member's primary usergroup. Note there are no security checks, so make sure anything you pass is already available for this user (null: default) |
| $secondary_groups | ?array | No | No | Null | N/A | N/A | A list of secondary usergroups. Note there are no security checks, so make sure anything you pass is already available for this user (null: default/current usergroups) |
| $dob_day | ?integer | No | No | Null | N/A | N/A | Day of date of birth (null: unknown) |
| $dob_month | ?integer | No | No | Null | N/A | N/A | Month of date of birth (null: unknown) |
| $dob_year | ?integer | No | No | Null | N/A | N/A | Year of date of birth (null: unknown) |
| $custom_fields | array | No | No | [] | N/A | N/A | A map of custom field values (fieldID=>value) |
| $timezone | ?ID_TEXT | No | No | Null | N/A | N/A | The member timezone, should not be blank (null: auto-detect) |
| $region | ?ID_TEXT | No | No | Null | N/A | N/A | The member's region (null: auto-detect) (blank: leave empty, and require member to fill this in later if necessary) |
| $language | ?LANGUAGE_NAME | No | No | Null | N/A | N/A | The member's language (null: auto detect) (blank: site default) |
| $theme | ID_TEXT | No | No | Blank (empty string) | N/A | N/A | The member's default theme (blank: default) |
| $title | SHORT_TEXT | No | No | Blank (empty string) | N/A | N/A | The member's title (blank: get from primary) |
| $photo_url | URLPATH | No | No | Blank (empty string) | N/A | N/A | The URL to the member's photo (blank: none) |
| $avatar_url | ?URLPATH | No | No | Null | N/A | N/A | The URL to the member's avatar (blank: none) (null: choose one automatically) |
| $signature | LONG_TEXT | No | No | Blank (empty string) | N/A | N/A | The member's signature (blank: none) |
| $preview_posts | ?BINARY | No | No | Null | N/A | N/A | Whether posts are previewed before they are made (null: global configured default) |
| $reveal_age | BINARY | No | No | 0 | N/A | N/A | Whether the member's age may be shown |
| $views_signatures | BINARY | No | No | 1 | N/A | N/A | Whether the member sees signatures in posts |
| $auto_monitor_contrib_content | ?BINARY | No | No | Null | N/A | N/A | Whether the member automatically is enabled for notifications for content they contribute to (null: get default from config) |
| $smart_topic_notification | ?BINARY | No | No | Null | N/A | N/A | Whether to do smart topic notification [i.e. avoid sending so many notifications] (null: global configured default) |
| $mailing_list_style | ?BINARY | No | No | Null | N/A | N/A | Whether to send mailing-list style notifications (null: global configured default) |
| $auto_mark_read | BINARY | No | No | 1 | N/A | N/A | Mark topics as read automatically |
| $sound_enabled | ?BINARY | No | No | Null | N/A | N/A | Whether sound is enabled (null: global configured default) |
Returns
- The ID of the new member
- Type: AUTO_LINK
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Add a member.
*
* @param SHORT_TEXT $username The username
* @param SHORT_TEXT $password The password
* @param SHORT_TEXT $email_address The e-mail address
* @param ?GROUP $primary_group The member's primary usergroup. Note there are no security checks, so make sure anything you pass is already available for this user (null: default)
* @param ?array $secondary_groups A list of secondary usergroups. Note there are no security checks, so make sure anything you pass is already available for this user (null: default/current usergroups)
* @param ?integer $dob_day Day of date of birth (null: unknown)
* @param ?integer $dob_month Month of date of birth (null: unknown)
* @param ?integer $dob_year Year of date of birth (null: unknown)
* @param array $custom_fields A map of custom field values (fieldID=>value)
* @param ?ID_TEXT $timezone The member timezone, should not be blank (null: auto-detect)
* @param ?ID_TEXT $region The member's region (null: auto-detect) (blank: leave empty, and require member to fill this in later if necessary)
* @param ?LANGUAGE_NAME $language The member's language (null: auto detect) (blank: site default)
* @param ID_TEXT $theme The member's default theme (blank: default)
* @param SHORT_TEXT $title The member's title (blank: get from primary)
* @param URLPATH $photo_url The URL to the member's photo (blank: none)
* @param ?URLPATH $avatar_url The URL to the member's avatar (blank: none) (null: choose one automatically)
* @param LONG_TEXT $signature The member's signature (blank: none)
* @param ?BINARY $preview_posts Whether posts are previewed before they are made (null: global configured default)
* @param BINARY $reveal_age Whether the member's age may be shown
* @param BINARY $views_signatures Whether the member sees signatures in posts
* @param ?BINARY $auto_monitor_contrib_content Whether the member automatically is enabled for notifications for content they contribute to (null: get default from config)
* @param ?BINARY $smart_topic_notification Whether to do smart topic notification [i.e. avoid sending so many notifications] (null: global configured default)
* @param ?BINARY $mailing_list_style Whether to send mailing-list style notifications (null: global configured default)
* @param BINARY $auto_mark_read Mark topics as read automatically
* @param ?BINARY $sound_enabled Whether sound is enabled (null: global configured default)
* @return AUTO_LINK The ID of the new member
*/
function cns_make_member(string $username, string $password, string $email_address = '', ?int $primary_group = null, ?array $secondary_groups = null, ?int $dob_day = null, ?int $dob_month = null, ?int $dob_year = null, array $custom_fields = [], ?string $timezone = null, ?string $region = null, ?string $language = null, string $theme = '', string $title = '', string $photo_url = '', ?string $avatar_url = null, string $signature = '', ?int $preview_posts = null, int $reveal_age = 0, int $views_signatures = 1, ?int $auto_monitor_contrib_content = null, ?int $smart_topic_notification = null, ?int $mailing_list_style = null, int $auto_mark_read = 1, ?int $sound_enabled = null) : int
* Add a member.
*
* @param SHORT_TEXT $username The username
* @param SHORT_TEXT $password The password
* @param SHORT_TEXT $email_address The e-mail address
* @param ?GROUP $primary_group The member's primary usergroup. Note there are no security checks, so make sure anything you pass is already available for this user (null: default)
* @param ?array $secondary_groups A list of secondary usergroups. Note there are no security checks, so make sure anything you pass is already available for this user (null: default/current usergroups)
* @param ?integer $dob_day Day of date of birth (null: unknown)
* @param ?integer $dob_month Month of date of birth (null: unknown)
* @param ?integer $dob_year Year of date of birth (null: unknown)
* @param array $custom_fields A map of custom field values (fieldID=>value)
* @param ?ID_TEXT $timezone The member timezone, should not be blank (null: auto-detect)
* @param ?ID_TEXT $region The member's region (null: auto-detect) (blank: leave empty, and require member to fill this in later if necessary)
* @param ?LANGUAGE_NAME $language The member's language (null: auto detect) (blank: site default)
* @param ID_TEXT $theme The member's default theme (blank: default)
* @param SHORT_TEXT $title The member's title (blank: get from primary)
* @param URLPATH $photo_url The URL to the member's photo (blank: none)
* @param ?URLPATH $avatar_url The URL to the member's avatar (blank: none) (null: choose one automatically)
* @param LONG_TEXT $signature The member's signature (blank: none)
* @param ?BINARY $preview_posts Whether posts are previewed before they are made (null: global configured default)
* @param BINARY $reveal_age Whether the member's age may be shown
* @param BINARY $views_signatures Whether the member sees signatures in posts
* @param ?BINARY $auto_monitor_contrib_content Whether the member automatically is enabled for notifications for content they contribute to (null: get default from config)
* @param ?BINARY $smart_topic_notification Whether to do smart topic notification [i.e. avoid sending so many notifications] (null: global configured default)
* @param ?BINARY $mailing_list_style Whether to send mailing-list style notifications (null: global configured default)
* @param BINARY $auto_mark_read Mark topics as read automatically
* @param ?BINARY $sound_enabled Whether sound is enabled (null: global configured default)
* @return AUTO_LINK The ID of the new member
*/
function cns_make_member(string $username, string $password, string $email_address = '', ?int $primary_group = null, ?array $secondary_groups = null, ?int $dob_day = null, ?int $dob_month = null, ?int $dob_year = null, array $custom_fields = [], ?string $timezone = null, ?string $region = null, ?string $language = null, string $theme = '', string $title = '', string $photo_url = '', ?string $avatar_url = null, string $signature = '', ?int $preview_posts = null, int $reveal_age = 0, int $views_signatures = 1, ?int $auto_monitor_contrib_content = null, ?int $smart_topic_notification = null, ?int $mailing_list_style = null, int $auto_mark_read = 1, ?int $sound_enabled = null) : int
