Beispiel #1
0
/**
 * 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, WPUM will display the first name + last name,
 * if the option is enabled into the last name field, WPUM 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 wpum_adjust_name_meta_output($value, $field)
{
    if (wpum_is_single_profile()) {
        if ($field->meta == 'first_name' && wpum_get_field_option($field->id, 'display_full_name')) {
            $value = $value . ' ' . wpum_get_user_lname(wpum_get_displayed_user_id());
        } elseif ($field->meta == 'last_name' && wpum_get_field_option($field->id, 'display_full_name')) {
            $value = $value . ' ' . wpum_get_user_fname(wpum_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' => wpum_get_field_option($this->field->id, 'display_full_name') ? true : false, 'label' => esc_html__('Display full name', 'wpum'), 'desc' => esc_html__('Enable to display the user full name instead.', 'wpum'));
     echo WPUM()->html->checkbox($args);
 }