get_user_profile_structure($id) . $attribution_end, $user, $id); } /** * Get the registration structure from the database * * @param int $id * * @return string */ public static function get_user_profile_structure($id) { if (FR::is_drag_drop($id, FR::USER_PROFILE_TYPE)) { $form_instance = FR::dnd_class_instance($id, FR::USER_PROFILE_TYPE); if ( ! $form_instance) return esc_html__('Form class not found. Please check if this user profile actually exist in ProfilePress.', 'wp-user-avatar'); $user_profile_structure = $form_instance->form_structure(); } else { $user_profile_structure = FR::get_form_meta($id, FR::USER_PROFILE_TYPE, FR::FORM_STRUCTURE); } return do_shortcode($user_profile_structure); } /** * Get the CSS stylesheet for the ID registration * * @return mixed */ public static function get_user_profile_css($id) { if (FR::is_drag_drop($id, FR::USER_PROFILE_TYPE)) { $form_instance = FR::dnd_class_instance($id, FR::USER_PROFILE_TYPE); if ( ! $form_instance) return ''; $user_profile_css = $form_instance->minified_form_css(); } else { $user_profile_css = FR::get_form_meta($id, FR::USER_PROFILE_TYPE, FR::FORM_CSS); } return ""; } /** Rewrite the title of the profile */ public function rewrite_profile_title($title) { global $post, $ppress_frontend_profile_user_obj; // if currently viewed page is the page with the front-end profile, rewrite the title accordingly. if (@$post->ID == ppress_get_setting('set_user_profile_shortcode') || has_shortcode('profilepress-user-profile', @$post->post_content) ) { $user_object = $ppress_frontend_profile_user_obj; if (isset($user_object) && is_object($user_object)) { // if first and last name is set, use the combo as title if ( ! empty($user_object->first_name) && ! empty($user_object->last_name)) { $title = "$user_object->first_name {$user_object->last_name}"; } // if either first or last name is set, use either as title elseif ( ! empty($user_object->first_name) || ! empty($user_object->last_name)) { $title = "$user_object->first_name {$user_object->last_name}"; } // else use their username else { $title = $user_object->user_login; } $title = apply_filters('ppress_profile_username_title', self::title_possessiveness($title), $title); } } return $title; } public static function title_possessiveness($string) { $string = trim($string); $lastchar = substr($string, -1); $profile_string = esc_html__('Profile', 'wp-user-avatar'); if ('s' == $lastchar) { $title = ucwords($string) . "' $profile_string"; } else { $title = ucwords($string) . "'s $profile_string"; } return $title; } public static function get_instance() { static $instance = false; if ( ! $instance) { $instance = new self; } return $instance; } }