/** * Adjust the output of the first name/last name field to display a full name if the option is enabled. * If the option is enabled into the first name field, wpaam will display the first name + last name, * if the option is enabled into the last name field, wpaam will display the last name + first name. * * @param string $value the value of field. * @param string $field field object. * @return string output of this field. * @since 1.2.0 */ function wpaam_adjust_name_meta_output($value, $field) { if (wpaam_is_single_profile()) { if ($field->meta == 'first_name' && wpaam_get_field_option($field->id, 'display_full_name')) { $value = $value . ' ' . wpaam_get_user_lname(wpaam_get_displayed_user_id()); } elseif ($field->meta == 'last_name' && wpaam_get_field_option($field->id, 'display_full_name')) { $value = $value . ' ' . wpaam_get_user_fname(wpaam_get_displayed_user_id()); } } return $value; }
/** * Render the full name setting for the field editor. * * @access public * @return void */ public function name_setting() { $args = array('name' => 'display_full_name', 'current' => wpaam_get_field_option($this->field->id, 'display_full_name') ? true : false, 'label' => esc_html__('Display full name', 'wpaam'), 'desc' => esc_html__('Enable to display the user full name instead.', 'wpaam')); echo wpaam()->html->checkbox($args); }