Function Forum_driver_smf2->install_edit_custom_field

Definitions

sources/forum/smf2.php

  • Edit the specified custom field in the forum (some forums implemented this using proper Custom Profile Fields, others through adding a new field).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: bool

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$old_name string No No required parameter N/A N/A The name of the existing custom field to edit
$name string No No required parameter N/A N/A The new name of the custom field
$length integer No No required parameter N/A N/A The length of the custom field (ignored for Conversr, $type used instead)
$locked BINARY No No 1 N/A N/A Whether the field is locked, e.g. cannot be deleted
$viewable BINARY No No 0 N/A N/A Whether the field is for viewing by the owner and the public (0: cannot be viewed unless the viewing member has view_any_profile_field privilege)
$settable BINARY No No 0 N/A N/A Whether the field is for setting by the owner
$required BINARY No No 0 N/A N/A Whether the field is required
$description string No No Blank (empty string) N/A N/A Description
$type string No No long_text N/A N/A The field type (it's the same as the software's field types, although we only expect forum drivers to specifically support short_text/long_text/integer/float and for the rest to be mapped to long_text)
$encrypted BINARY No No 0 N/A N/A Whether the field is encrypted
$default ?string No No Null N/A N/A Default field value (null: standard for field type)
$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.
$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

  • Whether the custom field was edited successfully
  • Type: boolean
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Edit the specified custom field in the forum (some forums implemented this using proper Custom Profile Fields, others through adding a new field).
 *
 * @param  string $old_name The name of the existing custom field to edit
 * @param  string $name The new name of the custom field
 * @param  integer $length The length of the custom field (ignored for Conversr, $type used instead)
 * @param  BINARY $locked Whether the field is locked, e.g. cannot be deleted
 * @param  BINARY $viewable Whether the field is for viewing by the owner and the public (0: cannot be viewed unless the viewing member has view_any_profile_field privilege)
 * @param  BINARY $settable Whether the field is for setting by the owner
 * @param  BINARY $required Whether the field is required
 * @param  string $description Description
 * @param  string $type The field type (it's the same as the software's field types, although we only expect forum drivers to specifically support short_text/long_text/integer/float and for the rest to be mapped to long_text)
 * @param  BINARY $encrypted Whether the field is encrypted
 * @param  ?string $default Default field value (null: standard for field type)
 * @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  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 boolean Whether the custom field was edited successfully
 */

public function install_edit_custom_field(string $old_name, string $name, int $length, int $locked = 1, int $viewable = 0, int $settable = 0, int $required = 0, string $description = '', string $type = 'long_text', int $encrypted = 0, ?string $default = null, string $options = '', int $include_in_main_search = 0, int $allow_template_search = 0, string $icon = '', string $section = '', string $tempcode = '', string $autofill_type = '', string $autofill_hint = '') : bool