Function __global->cns_make_custom_field
Definitions
sources/cns_members_action.php
- Make a Custom Profile Field.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: int
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $name | SHORT_TEXT | No | No | required parameter | N/A | N/A | Name of the field |
| $locked | BINARY | No | No | 0 | N/A | N/A | Whether the field is locked (i.e. cannot be deleted from the system). |
| $description | SHORT_TEXT | No | No | Blank (empty string) | N/A | N/A | Description of the field |
| $default | LONG_TEXT | No | No | Blank (empty string) | N/A | N/A | The default value for the field |
| $public_view | BINARY | No | No | 0 | N/A | N/A | Whether the field is publicly viewable |
| $owner_view | BINARY | No | No | 0 | N/A | N/A | Whether the field is viewable by the owner |
| $owner_set | BINARY | No | No | 0 | N/A | N/A | Whether the field may be set by the owner |
| $encrypted | BINARY | No | No | 0 | N/A | N/A | Whether the field is encrypted |
| $type | ID_TEXT | No | No | long_text | short_text long_text short_trans long_trans integer upload picture url list tick float | N/A | The type of the field |
| $required | BINARY | No | No | 0 | N/A | N/A | Whether it is required that every member have this field filled in |
| $show_in_posts | BINARY | No | No | 0 | N/A | N/A | Whether this field is shown in posts and places where member details are highlighted (such as an image in a member gallery) |
| $show_in_post_previews | BINARY | No | No | 0 | N/A | N/A | Whether this field is shown in preview places, such as in the forum member tooltip |
| $order | ?integer | No | No | Null | N/A | N/A | The order of this field relative to other fields (null: next) |
| $only_group | LONG_TEXT | No | No | Blank (empty string) | N/A | N/A | The usergroups that this field is confined to (comma-separated list) |
| $show_on_join_form | BINARY | No | No | 0 | N/A | N/A | Whether the field is to be shown on the join form |
| $options | SHORT_TEXT | No | No | Blank (empty string) | N/A | N/A | Field options |
| $include_in_main_search | BINARY | No | No | 0 | N/A | N/A | Whether to include in main keyword search |
| $allow_template_search | BINARY | No | No | 0 | N/A | N/A | Whether to allow template search |
| $icon | ID_TEXT | No | No | Blank (empty string) | N/A | N/A | An icon to show the CPF with on the member profiles |
| $section | ID_TEXT | No | No | Blank (empty string) | N/A | N/A | A section to show with on the member-links part of member profiles |
| $tempcode | LONG_TEXT | No | No | Blank (empty string) | N/A | N/A | This is Tempcode that is used for displaying the field. See the DESCRIPTION_CPF_CODE language string. |
| $no_name_dupe | boolean | No | No | False | N/A | N/A | Whether to check that no field has this name already |
| $autofill_type | ID_TEXT | No | No | Blank (empty string) | N/A | N/A | Autofill field name from https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field |
| $autofill_hint | ID_TEXT | No | No | Blank (empty string) | N/A | N/A | Autofill hint: '' or 'shipping' or 'billing' |
Returns
- The ID of the new Custom Profile Field
- Type: AUTO_LINK
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Make a Custom Profile Field.
*
* @param SHORT_TEXT $name Name of the field
* @param BINARY $locked Whether the field is locked (i.e. cannot be deleted from the system).
* @param SHORT_TEXT $description Description of the field
* @param LONG_TEXT $default The default value for the field
* @param BINARY $public_view Whether the field is publicly viewable
* @param BINARY $owner_view Whether the field is viewable by the owner
* @param BINARY $owner_set Whether the field may be set by the owner
* @param BINARY $encrypted Whether the field is encrypted
* @param ID_TEXT $type The type of the field
* @set short_text long_text short_trans long_trans integer upload picture url list tick float
* @param BINARY $required Whether it is required that every member have this field filled in
* @param BINARY $show_in_posts Whether this field is shown in posts and places where member details are highlighted (such as an image in a member gallery)
* @param BINARY $show_in_post_previews Whether this field is shown in preview places, such as in the forum member tooltip
* @param ?integer $order The order of this field relative to other fields (null: next)
* @param LONG_TEXT $only_group The usergroups that this field is confined to (comma-separated list)
* @param BINARY $show_on_join_form Whether the field is to be shown on the join form
* @param SHORT_TEXT $options Field options
* @param BINARY $include_in_main_search Whether to include in main keyword search
* @param BINARY $allow_template_search Whether to allow template search
* @param ID_TEXT $icon An icon to show the CPF with on the member profiles
* @param ID_TEXT $section A section to show with on the member-links part of member profiles
* @param LONG_TEXT $tempcode This is Tempcode that is used for displaying the field. See the DESCRIPTION_CPF_CODE language string.
* @param boolean $no_name_dupe Whether to check that no field has this name already
* @param ID_TEXT $autofill_type Autofill field name from https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field
* @param ID_TEXT $autofill_hint Autofill hint: '' or 'shipping' or 'billing'
* @return AUTO_LINK The ID of the new Custom Profile Field
*/
function cns_make_custom_field(string $name, int $locked = 0, string $description = '', string $default = '', int $public_view = 0, int $owner_view = 0, int $owner_set = 0, int $encrypted = 0, string $type = 'long_text', int $required = 0, int $show_in_posts = 0, int $show_in_post_previews = 0, ?int $order = null, string $only_group = '', int $show_on_join_form = 0, string $options = '', int $include_in_main_search = 0, int $allow_template_search = 0, string $icon = '', string $section = '', string $tempcode = '', bool $no_name_dupe = false, string $autofill_type = '', string $autofill_hint = '') : int
* Make a Custom Profile Field.
*
* @param SHORT_TEXT $name Name of the field
* @param BINARY $locked Whether the field is locked (i.e. cannot be deleted from the system).
* @param SHORT_TEXT $description Description of the field
* @param LONG_TEXT $default The default value for the field
* @param BINARY $public_view Whether the field is publicly viewable
* @param BINARY $owner_view Whether the field is viewable by the owner
* @param BINARY $owner_set Whether the field may be set by the owner
* @param BINARY $encrypted Whether the field is encrypted
* @param ID_TEXT $type The type of the field
* @set short_text long_text short_trans long_trans integer upload picture url list tick float
* @param BINARY $required Whether it is required that every member have this field filled in
* @param BINARY $show_in_posts Whether this field is shown in posts and places where member details are highlighted (such as an image in a member gallery)
* @param BINARY $show_in_post_previews Whether this field is shown in preview places, such as in the forum member tooltip
* @param ?integer $order The order of this field relative to other fields (null: next)
* @param LONG_TEXT $only_group The usergroups that this field is confined to (comma-separated list)
* @param BINARY $show_on_join_form Whether the field is to be shown on the join form
* @param SHORT_TEXT $options Field options
* @param BINARY $include_in_main_search Whether to include in main keyword search
* @param BINARY $allow_template_search Whether to allow template search
* @param ID_TEXT $icon An icon to show the CPF with on the member profiles
* @param ID_TEXT $section A section to show with on the member-links part of member profiles
* @param LONG_TEXT $tempcode This is Tempcode that is used for displaying the field. See the DESCRIPTION_CPF_CODE language string.
* @param boolean $no_name_dupe Whether to check that no field has this name already
* @param ID_TEXT $autofill_type Autofill field name from https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field
* @param ID_TEXT $autofill_hint Autofill hint: '' or 'shipping' or 'billing'
* @return AUTO_LINK The ID of the new Custom Profile Field
*/
function cns_make_custom_field(string $name, int $locked = 0, string $description = '', string $default = '', int $public_view = 0, int $owner_view = 0, int $owner_set = 0, int $encrypted = 0, string $type = 'long_text', int $required = 0, int $show_in_posts = 0, int $show_in_post_previews = 0, ?int $order = null, string $only_group = '', int $show_on_join_form = 0, string $options = '', int $include_in_main_search = 0, int $allow_template_search = 0, string $icon = '', string $section = '', string $tempcode = '', bool $no_name_dupe = false, string $autofill_type = '', string $autofill_hint = '') : int
