/** * Fires after the 'About Yourself' settings table on the 'Your Profile' editing screen. * * The action only fires if the current user is editing their own profile. * * @since WP 2.0.0 * * @param WP_User $profileuser The current WP_User object. */ public function show_user_profile($profileuser) { echo '<br clear="all" /><a name="wpdk"></a>'; $message = __('This view <strong>is enhanced</strong> by wpXtreme and WPDK framework. Please, have a look below for additional information.', WPDK_TEXTDOMAIN); $alert = new WPDKUIAlert('wpdk-alert-show_user_profile', $message, WPDKUIAlertType::INFORMATION); $alert->dismissPermanent = true; $alert->display(); // Only the administrator can edit this extra information $disabled = !current_user_can('manage_options'); // Sanitize values $last_time_success_login = $profileuser->get(WPDKUserMeta::LAST_TIME_SUCCESS_LOGIN); $last_time_wrong_login = $profileuser->get(WPDKUserMeta::LAST_TIME_WRONG_LOGIN); $last_time_logout = $profileuser->get(WPDKUserMeta::LAST_TIME_LOGOUT); $status_description = $profileuser->get(WPDKUserMeta::STATUS_DESCRIPTION); // Display WPDK user extends information $fields = array(__('Login information', WPDK_TEXTDOMAIN) => array(array(array('type' => WPDKUIControlType::DATETIME, 'name' => WPDKUserMeta::LAST_TIME_SUCCESS_LOGIN, 'label' => __('Last success login', WPDK_TEXTDOMAIN), 'value' => empty($last_time_success_login) ? '' : WPDKDateTime::format($last_time_success_login, WPDKDateTime::DATETIME_SECONDS_LESS_FORMAT_PHP), 'disabled' => $disabled), array('type' => WPDKUIControlType::NUMBER, 'name' => WPDKUserMeta::COUNT_SUCCESS_LOGIN, 'label' => __('# success login', WPDK_TEXTDOMAIN), 'value' => $profileuser->get(WPDKUserMeta::COUNT_SUCCESS_LOGIN), 'disabled' => true)), array(array('type' => WPDKUIControlType::DATETIME, 'name' => WPDKUserMeta::LAST_TIME_WRONG_LOGIN, 'label' => __('Last wrong login', WPDK_TEXTDOMAIN), 'value' => empty($last_time_wrong_login) ? '' : WPDKDateTime::format($last_time_wrong_login, WPDKDateTime::DATETIME_SECONDS_LESS_FORMAT_PHP), 'disabled' => $disabled), array('type' => WPDKUIControlType::NUMBER, 'name' => WPDKUserMeta::COUNT_WRONG_LOGIN, 'label' => __('# wrong login', WPDK_TEXTDOMAIN), 'value' => $profileuser->get(WPDKUserMeta::COUNT_WRONG_LOGIN), 'disabled' => $disabled))), __('Logout information', WPDK_TEXTDOMAIN) => array(array(array('type' => WPDKUIControlType::DATETIME, 'name' => WPDKUserMeta::LAST_TIME_LOGOUT, 'label' => __('Last logout', WPDK_TEXTDOMAIN), 'value' => empty($last_time_logout) ? '' : WPDKDateTime::format($last_time_logout, WPDKDateTime::DATETIME_SECONDS_LESS_FORMAT_PHP), 'disabled' => $disabled))), __('Status', WPDK_TEXTDOMAIN) => array(array(array('type' => WPDKUIControlType::SELECT, 'name' => WPDKUserMeta::STATUS, 'label' => __('Status', WPDK_TEXTDOMAIN), 'value' => $profileuser->get(WPDKUserMeta::STATUS), 'options' => WPDKUserStatus::statuses(), 'disabled' => $disabled)), array(array('type' => WPDKUIControlType::TEXTAREA, 'name' => WPDKUserMeta::STATUS_DESCRIPTION, 'rows' => 3, 'cols' => 40, 'label' => __('Description', WPDK_TEXTDOMAIN), 'placeholder' => __('eg: this user is disabled because...', WPDK_TEXTDOMAIN), 'value' => $status_description, 'disabled' => $disabled)))); /** * Filter the layout control array with the extra WPDK fields. * * You can use this filter or `wpdk_users_show_user_profile` action to modify the default layout control array. * * @param array $fields Layout array fields. * @param WP_User $profileuser The current WP_User object. */ $fields = apply_filters('wpdk_users_fields_profile', $fields, $profileuser); $layout = new WPDKUIControlsLayout($fields); /** * Fires after display the layout controls. * * You can use this action or `wpdk_users_fields_profile` filter to modify the default layout control array. * * @deprecated since 1.7.2 - Use `wpdk_user_profile_tabs` filter instead * * @param WP_User $profileuser The current WP_User object. */ do_action('wpdk_users_show_user_profile', $profileuser); // Defaults $tabs = array(); if (current_user_can('edit_users')) { // WPDK tabs $tabs = array(new WPDKjQueryTab('wpdk-user-profile', __('WPDK'), '<div id="wpdk-user-profile">' . $layout->html() . '</div>')); } /** * Filter the tabs list used to extends user profile edit. * * @since 1.7.2 * * @param array $tabs The array tabs list. * @param WP_User $profileuser The current WP_User object. */ $tabs = apply_filters('wpdk_user_profile_tabs', $tabs, $profileuser); $jquery_tabs = new WPDKjQueryTabsView('wpdk-users', $tabs, true); $jquery_tabs->display(); }