本文整理匯總了PHP中is_user_admin函數的典型用法代碼示例。如果您正苦於以下問題:PHP is_user_admin函數的具體用法?PHP is_user_admin怎麽用?PHP is_user_admin使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了is_user_admin函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add_js_w_globals
/**
* Enqueues JS file for theme integration.
*
* Be sure s2Member's API Constants are already defined before firing this.
*
* @package s2Member\CSS_JS
* @since 3.5
*
* @attaches-to ``add_action("wp_print_scripts");``
*
* @return null After enqueuing JS for theme integration.
*/
public static function add_js_w_globals()
{
global $pagenow;
/* Need this for comparisons. */
/**/
do_action("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars());
/**/
if (!is_admin() || is_user_admin() && $pagenow === "profile.php" && !current_user_can("edit_users")) {
$s2o = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"];
/**/
if (is_user_logged_in()) {
$md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5;
/* An MD5 hash based on global key => values. */
/* The MD5 hash allows the script to be cached in the browser until the globals happen to change. */
/* For instance, the global variables may change when a User who is logged-in changes their Profile. */
wp_enqueue_script("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=" . urlencode($md5) . "&qcABC=1", array("jquery", "password-strength-meter"), c_ws_plugin__s2member_utilities::ver_checksum());
} else {
/* This essentially creates 2 versions of the script. One while logged in & another when not. */
wp_enqueue_script("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=1&qcABC=1", array("jquery", "password-strength-meter"), c_ws_plugin__s2member_utilities::ver_checksum());
}
/**/
do_action("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars());
}
/**/
do_action("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars());
/**/
return;
/* Return for uniformity. */
}
示例2: admin_bar_menu
/**
* Remove the WordPress comments menu bar item, replacing with a Facebook comments link
* Check if Facebook comments enabled and if the current user might be able to view a comments edit screen on Facebook
*
* @since 1.1
* @see WP_Admin_Bar->add_menus()
*/
public static function admin_bar_menu()
{
global $facebook_loader;
if (is_network_admin() && is_user_admin()) {
return;
}
// use moderate_comments capability as a local proxy for accounts that might be granted moderate comments permissions for the Facebook application if the application administrator fully setup the app
// technically the WordPress menu item is added for users with 'edit_posts' due to the permissions of the destination page but we'll check for the specific comments permission instead
// TODO: check if Facebook data stored for current user, check if Facebook user is moderator
if (!current_user_can('moderate_comments')) {
return;
}
if (!class_exists('Facebook_User')) {
require_once dirname(dirname(__FILE__)) . '/facebook-user.php';
}
$current_user = wp_get_current_user();
$facebook_user_data = Facebook_User::get_user_meta($current_user->ID, 'fb_data', true);
if (!(is_array($facebook_user_data) && isset($facebook_user_data['fb_uid']))) {
return;
}
// swap only. don't add a menu item if none existed
if (remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60)) {
add_action('admin_bar_menu', array('Facebook_Comments', 'admin_bar_add_comments_menu'), 60);
}
}
示例3: is_user_admin
public static function is_user_admin()
{
if (version_compare(get_bloginfo("version"), "3.1-RC", ">=")) {
return is_user_admin();
}
/**/
return is_admin();
}
示例4: redirect_if_user_not_admin
function redirect_if_user_not_admin($email)
{
// Redirect to /e_commerce/index.php.
if (!is_user_admin($email)) {
header('Location: /e_commerce/index.php');
die;
}
}
示例5: wp_admin_header
function wp_admin_header()
{
remove_action('admin_bar_menu', 'wp_admin_bar_updates_menu', 40);
if (!is_network_admin() && !is_user_admin()) {
//評論
remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
}
}
示例6: rwmb_debug_print
/**
* Prints or exports the content of the global debug array at the 'shutdown' hook
*
* @return void
*/
function rwmb_debug_print()
{
global $rwmb_debug;
if (!$rwmb_debug || is_user_logged_in() && is_user_admin()) {
return;
}
$html = '<h3>' . __('RW_Meta_Box Debug:', 'rwmb') . '</h3><pre>';
foreach ($rwmb_debug as $debug) {
$html .= "{$debug}<hr />";
}
$html .= '</pre>';
die($html);
}
示例7: __construct
/**
* Class constructor.
*
* @since 160710 Common utils.
*/
public function __construct()
{
$this->is_multisite = is_multisite();
$this->is_main_site = !$this->is_multisite || is_main_site();
$this->is_admin = is_admin();
$this->is_user_admin = $this->is_admin && is_user_admin();
$this->is_network_admin = $this->is_admin && $this->is_multisite && is_network_admin();
$this->debug = defined('WP_DEBUG') && WP_DEBUG;
$this->debug_edge = $this->debug && defined('WP_DEBUG_EDGE') && WP_DEBUG_EDGE;
$this->debug_log = $this->debug && defined('WP_DEBUG_LOG') && WP_DEBUG_LOG;
$this->debug_display = $this->debug && defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY;
if (!($this->salt = wp_salt())) {
throw new Exception('Failed to acquire WP salt.');
}
if (!($this->tmp_dir = rtrim(get_temp_dir(), '/'))) {
throw new Exception('Failed to acquire a writable tmp dir.');
}
if (!($this->site_url = site_url('/'))) {
throw new Exception('Failed to acquire site URL.');
} elseif (!($this->site_url_parts = parse_url($this->site_url))) {
throw new Exception('Failed to parse site URL parts.');
} elseif (!($this->site_url_host = $this->site_url_parts['host'] ?? '')) {
throw new Exception('Failed to parse site URL host.');
} elseif (!($this->site_url_root_host = implode('.', array_slice(explode('.', $this->site_url_host), -2)))) {
throw new Exception('Failed to parse site URL root host.');
}
if (!($this->site_url_option = get_option('siteurl'))) {
throw new Exception('Failed to acquire site URL option.');
} elseif (!($this->site_url_option_parts = parse_url($this->site_url_option))) {
throw new Exception('Failed to parse site URL option parts.');
} elseif (!($this->site_default_scheme = $this->site_url_option_parts['scheme'] ?? '')) {
throw new Exception('Failed to parse site URL option scheme.');
}
if (!($this->template_directory_url = get_template_directory_uri())) {
throw new Exception('Failed to acquire template directory URL.');
} elseif (!($this->template_directory_url_parts = parse_url($this->template_directory_url))) {
throw new Exception('Failed to parse template directory URL parts.');
}
$this->template = get_template();
$this->stylesheet = get_stylesheet();
$this->is_woocommerce_active = defined('WC_VERSION');
$this->is_woocommerce_product_vendors_active = defined('WC_PRODUCT_VENDORS_VERSION');
$this->is_jetpack_active = defined('JETPACK__VERSION');
}
示例8: bp_admin_bar_remove_nxt_menus
/**
* Unhook the NXTClass core menus.
*
* @since BuddyPress (r4151)
*
* @uses remove_action
* @uses is_network_admin()
* @uses is_user_admin()
*/
function bp_admin_bar_remove_nxt_menus()
{
if ('3.2' == bp_get_major_nxt_version()) {
remove_action('admin_bar_menu', 'nxt_admin_bar_my_account_menu', 10);
remove_action('admin_bar_menu', 'nxt_admin_bar_my_sites_menu', 20);
remove_action('admin_bar_menu', 'nxt_admin_bar_dashboard_view_site_menu', 25);
// Don't show the 'Edit Page' menu on BP pages
if (!bp_is_blog_page()) {
remove_action('admin_bar_menu', 'nxt_admin_bar_edit_menu', 30);
}
remove_action('admin_bar_menu', 'nxt_admin_bar_shortlink_menu', 80);
remove_action('admin_bar_menu', 'nxt_admin_bar_updates_menu', 70);
if (!is_network_admin() && !is_user_admin()) {
remove_action('admin_bar_menu', 'nxt_admin_bar_comments_menu', 50);
remove_action('admin_bar_menu', 'nxt_admin_bar_appearance_menu', 60);
}
remove_action('admin_bar_menu', 'nxt_admin_bar_updates_menu', 70);
}
}
示例9: wp_dashboard_right_now
/**
* Dashboard widget that displays some basic stats about the site.
*
* Formerly 'Right Now'. A streamlined 'At a Glance' as of 3.8.
*
* @since 2.7.0
*/
function wp_dashboard_right_now()
{
?>
<div class="main">
<ul>
<?php
// Posts and Pages
foreach (array('post', 'page') as $post_type) {
$num_posts = wp_count_posts($post_type);
if ($num_posts && $num_posts->publish) {
if ('post' == $post_type) {
$text = _n('%s Post', '%s Posts', $num_posts->publish);
} else {
$text = _n('%s Page', '%s Pages', $num_posts->publish);
}
$text = sprintf($text, number_format_i18n($num_posts->publish));
$post_type_object = get_post_type_object($post_type);
if ($post_type_object && current_user_can($post_type_object->cap->edit_posts)) {
printf('<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text);
} else {
printf('<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text);
}
}
}
// Comments
$num_comm = wp_count_comments();
if ($num_comm && $num_comm->approved) {
$text = sprintf(_n('%s Comment', '%s Comments', $num_comm->approved), number_format_i18n($num_comm->approved));
?>
<li class="comment-count"><a href="edit-comments.php"><?php
echo $text;
?>
</a></li>
<?php
/* translators: Number of comments in moderation */
$text = sprintf(_nx('%s in moderation', '%s in moderation', $num_comm->moderated, 'comments'), number_format_i18n($num_comm->moderated));
?>
<li class="comment-mod-count<?php
if (!$num_comm->moderated) {
echo ' hidden';
}
?>
"><a href="edit-comments.php?comment_status=moderated"><?php
echo $text;
?>
</a></li>
<?php
}
/**
* Filter the array of extra elements to list in the 'At a Glance'
* dashboard widget.
*
* Prior to 3.8.0, the widget was named 'Right Now'. Each element
* is wrapped in list-item tags on output.
*
* @since 3.8.0
*
* @param array $items Array of extra 'At a Glance' widget items.
*/
$elements = apply_filters('dashboard_glance_items', array());
if ($elements) {
echo '<li>' . implode("</li>\n<li>", $elements) . "</li>\n";
}
?>
</ul>
<?php
update_right_now_message();
// Check if search engines are asked not to index this site.
if (!is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public')) {
/**
* Filter the link title attribute for the 'Search Engines Discouraged'
* message displayed in the 'At a Glance' dashboard widget.
*
* Prior to 3.8.0, the widget was named 'Right Now'.
*
* @since 3.0.0
*
* @param string $title Default attribute text.
*/
$title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content'));
/**
* Filter the link label for the 'Search Engines Discouraged' message
* displayed in the 'At a Glance' dashboard widget.
*
* Prior to 3.8.0, the widget was named 'Right Now'.
*
* @since 3.0.0
*
* @param string $content Default text.
*/
$content = apply_filters('privacy_on_link_text', __('Search Engines Discouraged'));
echo "<p><a href='options-reading.php' title='{$title}'>{$content}</a></p>";
}
//.........這裏部分代碼省略.........
示例10: wp_dashboard_right_now
//.........這裏部分代碼省略.........
$num = number_format_i18n($num_tags);
$text = _n('Tag', 'Tags', $num_tags);
if (current_user_can('manage_categories')) {
$num = "<a href='edit-tags.php'>{$num}</a>";
$text = "<a href='edit-tags.php'>{$text}</a>";
}
echo '<td class="first b b-tags">' . $num . '</td>';
echo '<td class="t tags">' . $text . '</td>';
echo "</tr>";
do_action('right_now_content_table_end');
echo "\n\t</table>\n\t</div>";
echo "\n\t" . '<div class="table table_discussion">';
echo "\n\t" . '<p class="sub">' . __('Discussion') . '</p>' . "\n\t" . '<table>';
echo "\n\t" . '<tr class="first">';
// Total Comments
$num = '<span class="total-count">' . number_format_i18n($num_comm->total_comments) . '</span>';
$text = _n('Comment', 'Comments', $num_comm->total_comments);
if (current_user_can('moderate_comments')) {
$num = '<a href="edit-comments.php">' . $num . '</a>';
$text = '<a href="edit-comments.php">' . $text . '</a>';
}
echo '<td class="b b-comments">' . $num . '</td>';
echo '<td class="last t comments">' . $text . '</td>';
echo '</tr><tr>';
// Approved Comments
$num = '<span class="approved-count">' . number_format_i18n($num_comm->approved) . '</span>';
$text = _nx('Approved', 'Approved', $num_comm->approved, 'Right Now');
if (current_user_can('moderate_comments')) {
$num = "<a href='edit-comments.php?comment_status=approved'>{$num}</a>";
$text = "<a class='approved' href='edit-comments.php?comment_status=approved'>{$text}</a>";
}
echo '<td class="b b_approved">' . $num . '</td>';
echo '<td class="last t">' . $text . '</td>';
echo "</tr>\n\t<tr>";
// Pending Comments
$num = '<span class="pending-count">' . number_format_i18n($num_comm->moderated) . '</span>';
$text = _n('Pending', 'Pending', $num_comm->moderated);
if (current_user_can('moderate_comments')) {
$num = "<a href='edit-comments.php?comment_status=moderated'>{$num}</a>";
$text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>{$text}</a>";
}
echo '<td class="b b-waiting">' . $num . '</td>';
echo '<td class="last t">' . $text . '</td>';
echo "</tr>\n\t<tr>";
// Spam Comments
$num = number_format_i18n($num_comm->spam);
$text = _nx('Spam', 'Spam', $num_comm->spam, 'comment');
if (current_user_can('moderate_comments')) {
$num = "<a href='edit-comments.php?comment_status=spam'><span class='spam-count'>{$num}</span></a>";
$text = "<a class='spam' href='edit-comments.php?comment_status=spam'>{$text}</a>";
}
echo '<td class="b b-spam">' . $num . '</td>';
echo '<td class="last t">' . $text . '</td>';
echo "</tr>";
do_action('right_now_table_end');
do_action('right_now_discussion_table_end');
echo "\n\t</table>\n\t</div>";
echo "\n\t" . '<div class="versions">';
$ct = current_theme_info();
echo "\n\t<p>";
if (!empty($wp_registered_sidebars)) {
$sidebars_widgets = wp_get_sidebars_widgets();
$num_widgets = 0;
foreach ((array) $sidebars_widgets as $k => $v) {
if ('wp_inactive_widgets' == $k) {
continue;
}
if (is_array($v)) {
$num_widgets = $num_widgets + count($v);
}
}
$num = number_format_i18n($num_widgets);
$switch_themes = $ct->title;
if (current_user_can('switch_themes')) {
$switch_themes = '<a href="themes.php">' . $switch_themes . '</a>';
}
if (current_user_can('edit_theme_options')) {
printf(_n('Theme <span class="b">%1$s</span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b">%1$s</span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $switch_themes, $num);
} else {
printf(_n('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $switch_themes, $num);
}
} else {
if (current_user_can('switch_themes')) {
printf(__('Theme <span class="b"><a href="themes.php">%1$s</a></span>'), $ct->title);
} else {
printf(__('Theme <span class="b">%1$s</span>'), $ct->title);
}
}
echo '</p>';
// Check if search engines are blocked.
if (!is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public')) {
$title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content'));
$content = apply_filters('privacy_on_link_text', __('Search Engines Blocked'));
echo "<p><a href='options-privacy.php' title='{$title}'>{$content}</a></p>";
}
update_right_now_message();
echo "\n\t" . '<br class="clear" /></div>';
do_action('rightnow_end');
do_action('activity_box_end');
}
示例11: get_edit_profile_url
/**
* Get the URL to the user's profile editor.
*
* @since 3.1.0
*
* @param int $user User ID
* @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
* @return string Dashboard url link with optional path appended
*/
function get_edit_profile_url($user, $scheme = 'admin')
{
$user = (int) $user;
if (is_user_admin()) {
$url = user_admin_url('profile.php', $scheme);
} elseif (is_network_admin()) {
$url = network_admin_url('profile.php', $scheme);
} else {
$url = get_dashboard_url($user, 'profile.php', $scheme);
}
return apply_filters('edit_profile_url', $url, $user, $scheme);
}
示例12: dashboard_right_now
/**
* Custom "Right Now" dashboard widget for Calendar Administrators.
*
* @return void
*/
function dashboard_right_now()
{
global $wp_registered_sidebars;
$num_comm = wp_count_comments();
echo "\n\t" . '<div class="table table_content">';
echo "\n\t" . '<p class="sub">' . __('Content') . '</p>' . "\n\t" . '<table>';
echo "\n\t" . '<tr class="first">';
do_action('right_now_content_table_end');
echo "\n\t</table>\n\t</div>";
echo "\n\t" . '<div class="table table_discussion">';
echo "\n\t" . '<p class="sub">' . __('Discussion') . '</p>' . "\n\t" . '<table>';
echo "\n\t" . '<tr class="first">';
// Total Comments
$num = '<span class="total-count">' . number_format_i18n($num_comm->total_comments) . '</span>';
$text = _n('Comment', 'Comments', $num_comm->total_comments);
if (current_user_can('moderate_comments')) {
$num = '<a href="edit-comments.php">' . $num . '</a>';
$text = '<a href="edit-comments.php">' . $text . '</a>';
}
echo '<td class="b b-comments">' . $num . '</td>';
echo '<td class="last t comments">' . $text . '</td>';
echo '</tr><tr>';
// Approved Comments
$num = '<span class="approved-count">' . number_format_i18n($num_comm->approved) . '</span>';
$text = _nx('Approved', 'Approved', $num_comm->approved, 'Right Now');
if (current_user_can('moderate_comments')) {
$num = "<a href='edit-comments.php?comment_status=approved'>{$num}</a>";
$text = "<a class='approved' href='edit-comments.php?comment_status=approved'>{$text}</a>";
}
echo '<td class="b b_approved">' . $num . '</td>';
echo '<td class="last t">' . $text . '</td>';
echo "</tr>\n\t<tr>";
// Pending Comments
$num = '<span class="pending-count">' . number_format_i18n($num_comm->moderated) . '</span>';
$text = _n('Pending', 'Pending', $num_comm->moderated);
if (current_user_can('moderate_comments')) {
$num = "<a href='edit-comments.php?comment_status=moderated'>{$num}</a>";
$text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>{$text}</a>";
}
echo '<td class="b b-waiting">' . $num . '</td>';
echo '<td class="last t">' . $text . '</td>';
echo "</tr>\n\t<tr>";
// Spam Comments
$num = number_format_i18n($num_comm->spam);
$text = _nx('Spam', 'Spam', $num_comm->spam, 'comment');
if (current_user_can('moderate_comments')) {
$num = "<a href='edit-comments.php?comment_status=spam'><span class='spam-count'>{$num}</span></a>";
$text = "<a class='spam' href='edit-comments.php?comment_status=spam'>{$text}</a>";
}
echo '<td class="b b-spam">' . $num . '</td>';
echo '<td class="last t">' . $text . '</td>';
echo "</tr>";
do_action('right_now_table_end');
do_action('right_now_discussion_table_end');
echo "\n\t</table>\n\t</div>";
echo "\n\t" . '<div class="versions">';
// Check if search engines are blocked.
if (!is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != Ai1ec_Meta::get_option('blog_public')) {
$title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content'));
$content = apply_filters('privacy_on_link_text', __('Search Engines Blocked'));
echo "<p><a href='options-privacy.php' title='{$title}'>{$content}</a></p>";
}
$msg = sprintf(__('You are using <span class="b">All-in-One Event Calendar %s</span>.'), AI1EC_VERSION);
echo "<span id='wp-version-message'>{$msg}</span>";
echo "\n\t" . '<br class="clear" /></div>';
do_action('ai1ec_rightnow_end');
do_action('activity_box_end');
}
示例13: piklist_dashboard_right_now_old
//.........這裏部分代碼省略.........
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="versions">
<p>
<?php
$theme = wp_get_theme();
if ($theme->errors()) {
if (!is_multisite() || is_super_admin()) {
echo '<span class="error-message">' . __('ERROR: The themes directory is either empty or does not exist. Please check your installation.', 'piklist') . '</span>';
}
} elseif (!empty($wp_registered_sidebars)) {
$sidebars_widgets = wp_get_sidebars_widgets();
$num_widgets = 0;
foreach ((array) $sidebars_widgets as $k => $v) {
if ('wp_inactive_widgets' == $k || 'orphaned_widgets' == substr($k, 0, 16)) {
continue;
}
if (is_array($v)) {
$num_widgets = $num_widgets + count($v);
}
}
$num = number_format_i18n($num_widgets);
$switch_themes = $theme->display('Name');
if (current_user_can('switch_themes')) {
$switch_themes = '<a href="themes.php">' . $switch_themes . '</a>';
}
if (current_user_can('edit_theme_options')) {
printf(_n('Theme %1$s with %2$s Widget', 'Theme %1$s with %2$s Widgets', $num_widgets), '<span class="b">' . $switch_themes . '</span>', '<span class="b"><a href="widgets.php">' . $num . '</a></span>');
} else {
printf(_n('Theme %1$s with %2$s Widget', 'Theme %1$s with %2$s Widgets', $num_widgets), '<span class="b">' . $switch_themes . '</span>', '<span class="b">' . $num . '</span>');
}
} else {
if (current_user_can('switch_themes')) {
printf(__('Theme %1$s', 'piklist'), '<span class="b"><a href="themes.php">' . $theme->display('Name') . '</a></span>');
} else {
printf(__('Theme %1$s', 'piklist'), '<span class="b">' . $theme->display('Name') . '</span>');
}
}
?>
</p>
<?php
if (!is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public')) {
?>
<?php
$title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content', 'piklist'));
?>
<?php
$content = apply_filters('privacy_on_link_text', __('Search Engines Discouraged', 'piklist'));
?>
<p>
<a href='options-reading.php' title='<?php
echo $title;
?>
'><?php
echo $content;
?>
</a>
</p>
<?php
}
?>
<?php
update_right_now_message();
?>
<br class="clear" />
</div>
<?php
do_action('rightnow_end');
?>
<?php
do_action('activity_box_end');
?>
<?php
}
示例14: add_menus
public function add_menus()
{
// User related, aligned right.
add_action('admin_bar_menu', 'wp_admin_bar_my_account_menu', 0);
add_action('admin_bar_menu', 'wp_admin_bar_search_menu', 4);
add_action('admin_bar_menu', 'wp_admin_bar_my_account_item', 7);
// Site related.
add_action('admin_bar_menu', 'wp_admin_bar_wp_menu', 10);
add_action('admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20);
add_action('admin_bar_menu', 'wp_admin_bar_site_menu', 30);
add_action('admin_bar_menu', 'wp_admin_bar_updates_menu', 40);
// Content related.
if (!is_network_admin() && !is_user_admin()) {
add_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
add_action('admin_bar_menu', 'wp_admin_bar_new_content_menu', 70);
}
add_action('admin_bar_menu', 'wp_admin_bar_edit_menu', 80);
add_action('admin_bar_menu', 'wp_admin_bar_add_secondary_groups', 200);
do_action('add_admin_bar_menus');
}
示例15: wp_user_profiles_status_metabox
/**
* Render the primary metabox for user profile screen
*
* @since 0.1.0
*
* @param WP_User $user The WP_User object to be edited.
*/
function wp_user_profiles_status_metabox($user = null)
{
// Bail if no user id or if the user has not activated their account yet
if (empty($user->ID)) {
return;
}
?>
<div class="submitbox">
<div id="minor-publishing">
<div id="misc-publishing-actions">
<?php
// Get the spam status once here to compare against below
if (apply_filters('wp_user_profiles_show_status', true) && (current_user_can('edit_user', $user->ID) && !IS_PROFILE_PAGE && !is_user_admin() && !in_array($user->user_login, get_super_admins()))) {
?>
<div class="misc-pub-section" id="comment-status-radio">
<label class="approved"><input type="radio" name="user_status" value="ham" <?php
checked($user->user_status, 0);
?>
><?php
esc_html_e('Active', 'wp-user-profiles');
?>
</label><br>
<label><input type="radio" name="user_status" value="inactive" <?php
checked($user->user_status, 2);
?>
><?php
esc_html_e('Inactive', 'wp-user-profiles');
?>
</label><br>
<label class="spam"><input type="radio" name="user_status" value="spam" <?php
checked($user->user_status, 1);
?>
><?php
esc_html_e('Spammer', 'wp-user-profiles');
?>
</label>
</div>
<?php
}
?>
<div class="misc-pub-section curtime misc-pub-section-last">
<?php
$datef = get_option('date_format') . ' ' . get_option('time_format');
$date = date_i18n($datef, strtotime($user->user_registered));
?>
<span id="timestamp"><?php
printf(esc_html__('Registered on: %1$s', 'wp-user-profiles'), '<strong>' . $date . '</strong>');
?>
</span>
</div>
</div>
<div class="clear"></div>
</div>
<div id="major-publishing-actions">
<div id="publishing-action">
<a class="button" href="<?php
echo esc_url(get_author_posts_url($user->ID));
?>
" target="_blank"><?php
esc_html_e('View User', 'wp-user-profiles');
?>
</a>
<?php
submit_button(esc_html__('Update', 'wp-user-profiles'), 'primary', 'save', false);
?>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="user_id" id="user_id" value="<?php
echo esc_attr($user->ID);
?>
" />
</div>
<div class="clear"></div>
</div>
</div>
<?php
}