本文整理汇总了PHP中bp_get_notifications_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_notifications_slug函数的具体用法?PHP bp_get_notifications_slug怎么用?PHP bp_get_notifications_slug使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_notifications_slug函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_notifications_toolbar_menu
/**
* Build the "Notifications" dropdown.
*
* @since BuddyPress (1.9.0)
*
* @return bool
*/
function bp_notifications_toolbar_menu()
{
global $wp_admin_bar;
if (!is_user_logged_in()) {
return false;
}
$notifications = bp_notifications_get_notifications_for_user(bp_loggedin_user_id(), 'object');
$count = !empty($notifications) ? count($notifications) : 0;
$alert_class = (int) $count > 0 ? 'pending-count alert' : 'count no-alert';
$menu_title = '<span id="ab-pending-notifications" class="' . $alert_class . '">' . number_format_i18n($count) . '</span>';
$menu_link = trailingslashit(bp_loggedin_user_domain() . bp_get_notifications_slug());
// Add the top-level Notifications button
$wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'bp-notifications', 'title' => $menu_title, 'href' => $menu_link));
if (!empty($notifications)) {
foreach ((array) $notifications as $notification) {
$wp_admin_bar->add_menu(array('parent' => 'bp-notifications', 'id' => 'notification-' . $notification->id, 'title' => $notification->content, 'href' => $notification->href));
}
} else {
$wp_admin_bar->add_menu(array('parent' => 'bp-notifications', 'id' => 'no-notifications', 'title' => __('No new notifications', 'buddypress'), 'href' => $menu_link));
}
return;
}
示例2: bp_get_notifications_read_permalink
/**
* Return the read notifications permalink.
*
* @since BuddyPress (1.9.0)
*
* @return string Read notifications permalink.
*/
function bp_get_notifications_read_permalink()
{
$retval = trailingslashit(bp_loggedin_user_domain() . bp_get_notifications_slug() . '/read');
/**
* Filters the read notifications permalink.
*
* @since BuddyPress (1.9.0)
*
* @param string $retval Permalink for the read notifications.
*/
return apply_filters('bp_get_notifications_unread_permalink', $retval);
}
示例3: bp_notifications_action_bulk_manage
/**
* Handles bulk management (mark as read/unread, delete) of notifications.
*
* @since 2.2.0
*
* @return bool
*/
function bp_notifications_action_bulk_manage()
{
// Bail if not the read or unread screen.
if (!bp_is_notifications_component() || !(bp_is_current_action('read') || bp_is_current_action('unread'))) {
return false;
}
// Get the action.
$action = !empty($_POST['notification_bulk_action']) ? $_POST['notification_bulk_action'] : '';
$nonce = !empty($_POST['notifications_bulk_nonce']) ? $_POST['notifications_bulk_nonce'] : '';
$notifications = !empty($_POST['notifications']) ? $_POST['notifications'] : '';
// Bail if no action or no IDs.
if (!in_array($action, array('delete', 'read', 'unread')) || empty($notifications) || empty($nonce)) {
return false;
}
// Check the nonce.
if (!wp_verify_nonce($nonce, 'notifications_bulk_nonce')) {
bp_core_add_message(__('There was a problem managing your notifications.', 'buddypress'), 'error');
return false;
}
$notifications = wp_parse_id_list($notifications);
// Delete, mark as read or unread depending on the user 'action'.
switch ($action) {
case 'delete':
foreach ($notifications as $notification) {
bp_notifications_delete_notification($notification);
}
bp_core_add_message(__('Notifications deleted.', 'buddypress'));
break;
case 'read':
foreach ($notifications as $notification) {
bp_notifications_mark_notification($notification, false);
}
bp_core_add_message(__('Notifications marked as read', 'buddypress'));
break;
case 'unread':
foreach ($notifications as $notification) {
bp_notifications_mark_notification($notification, true);
}
bp_core_add_message(__('Notifications marked as unread.', 'buddypress'));
break;
}
// Redirect.
bp_core_redirect(bp_displayed_user_domain() . bp_get_notifications_slug() . '/' . bp_current_action() . '/');
}
示例4: setup_admin_bar
/**
* Set up the component entries in the WordPress Admin Bar.
*
* @since 1.9.0
*
* @see BP_Component::setup_nav() for a description of the $wp_admin_nav
* parameter array.
*
* @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a
* description.
*/
public function setup_admin_bar($wp_admin_nav = array())
{
// Menus for logged in user.
if (is_user_logged_in()) {
// Setup the logged in user variables.
$notifications_link = trailingslashit(bp_loggedin_user_domain() . bp_get_notifications_slug());
// Pending notification requests.
$count = bp_notifications_get_unread_notification_count(bp_loggedin_user_id());
if (!empty($count)) {
$title = sprintf(_x('Notifications <span class="count">%s</span>', 'My Account Notification pending', 'buddypress'), bp_core_number_format($count));
$unread = sprintf(_x('Unread <span class="count">%s</span>', 'My Account Notification pending', 'buddypress'), bp_core_number_format($count));
} else {
$title = _x('Notifications', 'My Account Notification', 'buddypress');
$unread = _x('Unread', 'My Account Notification sub nav', 'buddypress');
}
// Add the "My Account" sub menus.
$wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => $notifications_link);
// Unread.
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-unread', 'title' => $unread, 'href' => $notifications_link, 'position' => 10);
// Read.
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-read', 'title' => _x('Read', 'My Account Notification sub nav', 'buddypress'), 'href' => trailingslashit($notifications_link . 'read'), 'position' => 20);
}
parent::setup_admin_bar($wp_admin_nav);
}
示例5: mmm_nav_buddypress
/**
* Include buddypress in menu.
* @return $items
*/
function mmm_nav_buddypress($items, $args)
{
global $mega_main_menu;
$args = (object) $args;
if (isset($args->theme_location)) {
$args->theme_location = str_replace(' ', '-', $args->theme_location);
$mega_menu_locations = is_array($mega_main_menu->get_option('mega_menu_locations')) ? $mega_main_menu->get_option('mega_menu_locations') : array();
if (in_array($args->theme_location, $mega_menu_locations) && is_array($mega_main_menu->get_option($args->theme_location . '_included_components')) && in_array('buddypress', $mega_main_menu->get_option($args->theme_location . '_included_components'))) {
if (class_exists('BuddyPress')) {
global $bp;
$bp_avatar = bp_core_fetch_avatar(array('item_id' => $bp->loggedin_user->id, 'html' => false));
if (strpos($bp_avatar, 'gravatar') !== false) {
$bp_avatar = $bp->avatar->thumb->default;
}
$buddypress_item = '';
$drop_side = $mega_main_menu->get_option('language_direction', 'ltr') == 'ltr' ? 'drop_to_left' : 'drop_to_right';
if (is_user_logged_in()) {
$notifications = bp_notifications_get_notifications_for_user(bp_loggedin_user_id(), 'object');
$count = !empty($notifications) ? count($notifications) : 0;
$menu_link = trailingslashit(bp_loggedin_user_domain() . bp_get_notifications_slug());
$notification_class = (int) $count > 0 ? 'notification-yes' : 'notification-none';
$buddypress_item .= mm_common::ntab(1) . '<li class="menu-item nav_buddypress default_dropdown ' . $drop_side . ' submenu_default_width">';
$buddypress_item .= mm_common::ntab(2) . '<a href="' . $menu_link . '" tabindex="0" class="item_link ">';
$buddypress_item .= mm_common::ntab(3) . '<i class="ci-icon-buddypress-user"><style>.ci-icon-buddypress-user:before{ background-image: url("' . $bp_avatar . '"); }</style><span class="mega_notifications ' . $notification_class . '">' . $count . '</span></i>';
$buddypress_item .= mm_common::ntab(3) . '';
$buddypress_item .= mm_common::ntab(2) . '</a><!-- class="item_link" -->';
$buddypress_item .= mm_common::ntab(2) . '<ul class="mega_dropdown">';
foreach ($bp->bp_nav as $key => $component) {
switch ($component['slug']) {
case 'activity':
$icon = 'health';
break;
case 'profile':
$icon = 'user';
break;
case 'notifications':
$icon = 'notification-2';
break;
case 'messages':
$icon = 'envelop-opened';
break;
case 'friends':
$icon = 'users';
break;
case 'groups':
$icon = 'tree-5';
break;
default:
$icon = 'cog';
break;
}
$buddypress_item .= mm_common::ntab(3) . '<li class="menu-item">';
$buddypress_item .= mm_common::ntab(4) . '<a href="' . $component['link'] . '" tabindex="0" class="item_link with_icon">';
$buddypress_item .= mm_common::ntab(5) . '<i class="im-icon-' . $icon . '"></i>';
$buddypress_item .= mm_common::ntab(5) . '<span class="link_content">';
$buddypress_item .= mm_common::ntab(6) . '<span class="link_text">' . $component['name'] . '</span>';
$buddypress_item .= mm_common::ntab(5) . '</span>';
$buddypress_item .= mm_common::ntab(4) . '</a><!-- class="item_link" -->';
if (is_array($bp->bp_options_nav[$component['slug']])) {
$buddypress_item .= mm_common::ntab(4) . '<ul class="mega_dropdown">';
foreach ($bp->bp_options_nav[$component['slug']] as $key => $sub_component) {
$buddypress_item .= mm_common::ntab(5) . '<li class="menu-item">';
$buddypress_item .= mm_common::ntab(6) . '<a href="' . $sub_component['link'] . '" tabindex="0" class="item_link">';
$buddypress_item .= mm_common::ntab(7) . '<span class="link_content">';
$buddypress_item .= mm_common::ntab(8) . '<span class="link_text">' . $sub_component['name'] . '</span>';
$buddypress_item .= mm_common::ntab(7) . '</span>';
$buddypress_item .= mm_common::ntab(6) . '</a><!-- class="item_link" -->';
$buddypress_item .= mm_common::ntab(5) . '</li>';
}
$buddypress_item .= mm_common::ntab(4) . '</ul><!-- class="mega_dropdown" -->';
}
$buddypress_item .= mm_common::ntab(3) . '</li>';
}
$buddypress_item .= mm_common::ntab(3) . '<li class="menu-item">';
$buddypress_item .= mm_common::ntab(4) . '<a href="' . wp_logout_url() . '" title="' . __('Log Out') . '" tabindex="0" class="item_link with_icon">';
$buddypress_item .= mm_common::ntab(5) . '<i class="im-icon-switch"></i>';
$buddypress_item .= mm_common::ntab(5) . '<span class="link_content">';
$buddypress_item .= mm_common::ntab(6) . '<span class="link_text">';
$buddypress_item .= mm_common::ntab(7) . __('Log Out');
$buddypress_item .= mm_common::ntab(6) . '</span>';
$buddypress_item .= mm_common::ntab(5) . '</span>';
$buddypress_item .= mm_common::ntab(4) . '</a>';
$buddypress_item .= mm_common::ntab(3) . '</li>';
$buddypress_item .= mm_common::ntab(2) . '</ul><!-- class="mega_dropdown" -->';
$buddypress_item .= mm_common::ntab(1) . '</li><!-- class="nav_buddypress" -->' . mm_common::ntab(0);
} else {
$buddypress_item .= mm_common::ntab(1) . '<li class="nav_buddypress not_logged default_dropdown ' . $drop_side . ' submenu_default_width">';
$buddypress_item .= mm_common::ntab(2) . '<span class="item_link">';
$buddypress_item .= mm_common::ntab(3) . '<i class="im-icon-user"></i>';
$buddypress_item .= mm_common::ntab(2) . '</span><!-- class="item_link" -->';
$buddypress_item .= mm_common::ntab(2) . '<ul class="mega_dropdown">';
$buddypress_item .= mm_common::ntab(3) . wp_login_form(array('echo' => false));
$buddypress_item .= mm_common::ntab(2) . '</ul><!-- class="mega_dropdown" -->';
$buddypress_item .= mm_common::ntab(1) . '</li><!-- class="nav_buddypress" -->' . mm_common::ntab(0);
}
$items = $items . $buddypress_item;
//.........这里部分代码省略.........
示例6: bp_notifications_action_delete
/**
* Handle deleting single notifications.
*
* @since BuddyPress (1.9.0)
*
* @return boolean
*/
function bp_notifications_action_delete()
{
// Bail if not the read or unread screen
if (!bp_is_notifications_component() || !(bp_is_current_action('read') || bp_is_current_action('unread'))) {
return false;
}
// Get the action
$action = !empty($_GET['action']) ? $_GET['action'] : '';
$nonce = !empty($_GET['_wpnonce']) ? $_GET['_wpnonce'] : '';
$id = !empty($_GET['notification_id']) ? $_GET['notification_id'] : '';
// Bail if no action or no ID
if ('delete' !== $action || empty($id) || empty($nonce)) {
return false;
}
// Check the nonce and delete the notification
if (bp_verify_nonce_request('bp_notification_delete_' . $id) && bp_notifications_delete_notification($id)) {
bp_core_add_message(__('Notification successfully deleted.', 'buddypress'));
} else {
bp_core_add_message(__('There was a problem deleting that notification.', 'buddypress'), 'error');
}
// Redirect
bp_core_redirect(bp_displayed_user_domain() . bp_get_notifications_slug() . '/' . bp_current_action() . '/');
}
示例7: bloginfo
bloginfo('name');
?>
</strong></a>
<?php
}
?>
<!--logo end-->
<div class="nav notify-row" id="top_menu">
<!-- notification start -->
<ul class="nav top-menu">
<!-- settings start -->
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="
<?php
// Redirect
echo bp_displayed_user_domain() . bp_get_notifications_slug() . '/unread/';
?>
">
<i class="fa fa-tasks"></i>
<span class="badge bg-theme">
<?php
echo bp_notifications_get_unread_notification_count(bp_loggedin_user_id());
?>
</span>
</a>
<ul class="dropdown-menu extended tasks-bar">
<div class="notify-arrow notify-arrow-green"></div>
<li>
<p class="green">You have 4 pending tasks</p>
</li>
<li>
示例8: setup_nav
/**
* Set up component navigation.
*
* @since BuddyPress (1.9.0)
*
* @see BP_Component::setup_nav() for a description of arguments.
*
* @param array $main_nav Optional. See BP_Component::setup_nav() for
* description.
* @param array $sub_nav Optional. See BP_Component::setup_nav() for
* description.
*/
public function setup_nav($main_nav = array(), $sub_nav = array())
{
// Only grab count if we're on a user page and current user has access
if (bp_is_user() && bp_user_has_access()) {
$count = bp_notifications_get_unread_notification_count(bp_displayed_user_id());
$class = 0 === $count ? 'no-count' : 'count';
$nav_name = sprintf(_x('Notifications <span class="%s">%s</span>', 'Profile screen nav', 'buddypress'), esc_attr($class), number_format_i18n($count));
} else {
$nav_name = _x('Notifications', 'Profile screen nav', 'buddypress');
}
// Add 'Notifications' to the main navigation
$main_nav = array('name' => $nav_name, 'slug' => $this->slug, 'position' => 30, 'show_for_displayed_user' => bp_core_can_edit_settings(), 'screen_function' => 'bp_notifications_screen_unread', 'default_subnav_slug' => 'unread', 'item_css_id' => $this->id);
// Determine user to use
if (bp_displayed_user_domain()) {
$user_domain = bp_displayed_user_domain();
} elseif (bp_loggedin_user_domain()) {
$user_domain = bp_loggedin_user_domain();
} else {
return;
}
$notifications_link = trailingslashit($user_domain . bp_get_notifications_slug());
// Add the subnav items to the notifications nav item
$sub_nav[] = array('name' => _x('Unread', 'Notification screen nav', 'buddypress'), 'slug' => 'unread', 'parent_url' => $notifications_link, 'parent_slug' => bp_get_notifications_slug(), 'screen_function' => 'bp_notifications_screen_unread', 'position' => 10, 'item_css_id' => 'notifications-my-notifications', 'user_has_access' => bp_core_can_edit_settings());
$sub_nav[] = array('name' => _x('Read', 'Notification screen nav', 'buddypress'), 'slug' => 'read', 'parent_url' => $notifications_link, 'parent_slug' => bp_get_notifications_slug(), 'screen_function' => 'bp_notifications_screen_read', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
parent::setup_nav($main_nav, $sub_nav);
}
示例9: dln_get_notifications
<?php
$notifications = dln_get_notifications();
$nof_count = count($notifications);
$nof_link = trailingslashit(bp_loggedin_user_domain() . bp_get_notifications_slug());
$avatar_link = dln_get_avatar_link();
$user_id = bp_loggedin_user_id();
$display_name = bp_core_get_user_displayname($user_id);
?>
<!DOCTYPE html>
<html lang="en">
<!-- Mirrored from themepixels.com/demo/webpage/bracket/ by HTTrack Website Copier/3.x [XR&CO'2013], Tue, 18 Feb 2014 13:50:16 GMT -->
<head>
<meta charset="<?php
bloginfo('charset');
?>
" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="<?php
echo get_template_directory_uri();
?>
/assets/images/favicon.png" type="image/png">
<title><?php
wp_title('|', true, 'right');
?>
</title>
示例10: bp_get_notifications_read_permalink
/**
* Return the read notifications permalink.
*
* @since BuddyPress (1.9.0)
*
* @return string Read notifications permalink.
*/
function bp_get_notifications_read_permalink()
{
$retval = trailingslashit(bp_loggedin_user_domain() . bp_get_notifications_slug() . '/read');
return apply_filters('bp_get_notifications_unread_permalink', $retval);
}
示例11: bp_get_notifications_read_permalink
/**
* Return the read notifications permalink.
*
* @since 1.9.0
*
* @return string Read notifications permalink.
*/
function bp_get_notifications_read_permalink($user_id = 0)
{
if (0 === $user_id) {
$user_id = bp_loggedin_user_id();
$domain = bp_loggedin_user_domain();
} else {
$domain = bp_core_get_user_domain((int) $user_id);
}
$retval = trailingslashit($domain . bp_get_notifications_slug() . '/read');
/**
* Filters the read notifications permalink.
*
* @since 1.9.0
* @since 2.6.0 Added $user_id as a parameter.
*
* @param string $retval Permalink for the read notifications.
* @param int $user_id The user ID.
*/
return apply_filters('bp_get_notifications_unread_permalink', $retval, $user_id);
}