本文整理汇总了PHP中messages_get_unread_count函数的典型用法代码示例。如果您正苦于以下问题:PHP messages_get_unread_count函数的具体用法?PHP messages_get_unread_count怎么用?PHP messages_get_unread_count使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了messages_get_unread_count函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
/** @see WP_Widget::widget -- do not rename this */
function widget($args, $instance)
{
extract($args);
//Our variables from the widget settings.
$title = apply_filters('widget_title', $instance['title']);
$num = $instance['number'];
$activity = $instance['activity'];
$messages = $instance['messages'];
$friends = $instance['friends'];
if (!is_numeric($num)) {
$num = 5;
}
$user_id = bp_loggedin_user_id();
$width = $instance['width'];
echo '<div class="' . $width . '"><div class="dash-widget">' . $before_widget;
echo '<div id="vibe-tabs-student-activity" class="tabs tabbable">
<ul class="nav nav-tabs clearfix">';
if (isset($messages) && $messages && function_exists('messages_get_unread_count')) {
echo '<li><a href="#tab-messages" data-toggle="tab"><i class="icon-bubble-talk-1"></i>' . messages_get_unread_count($user_id) . '</a></li>';
}
if (isset($friends) && $friends) {
$searchArgs = array('type' => 'online', 'page' => 1, 'per_page' => $num, 'user_id' => $user_id);
if (bp_has_members($searchArgs)) {
while (bp_members()) {
bp_the_member();
$user_friends[] = array('avatar' => bp_get_member_avatar(), 'name' => bp_get_member_name(), 'last_active' => bp_get_member_last_active());
}
}
if (!is_array($user_friends)) {
$user_friends = array();
}
echo '<li><a href="#tab-friends" data-toggle="tab"><i class="icon-myspace-alt"></i>' . count($user_friends) . '</a></li>';
}
if (isset($activity) && $activity) {
echo '<li><a href="#tab-activity" data-toggle="tab"><i class="icon-atom"></i> </a></li>';
}
echo '</ul><div class="tab-content">';
// Display the widget title
global $wpdb, $bp;
if (isset($messages) && $messages) {
echo '<div id="tab-messages" class="tab-pane">
<h4>' . __('Unread Messages', 'wplms-dashboard') . '</h4>';
$message_args = array('user_id' => $user_id, 'box' => 'inbox', 'type' => 'unread', 'max' => $num);
if (bp_has_message_threads($message_args)) {
echo '<ul class="dash-unread-messages">';
while (bp_message_threads()) {
bp_message_thread();
echo '<li>' . bp_get_message_thread_avatar() . '<a href="' . bp_get_message_thread_view_link() . '">' . bp_get_message_thread_subject() . '<span>' . bp_get_message_thread_from() . '</span></a></li>';
}
echo '</ul>';
} else {
echo '<div class="message error">' . __('No messages found', 'wplms-dashboard') . '</div>';
}
echo '</div>';
}
if (isset($friends) && $friends) {
echo '<div id="tab-friends" class="tab-pane">
<h4>' . __('Friends Online', 'wplms-dashboard') . '</h4>';
if (count($user_friends)) {
echo '<ul class="dash-user-friends">';
foreach ($user_friends as $user_friend) {
echo '<li>' . $user_friend['avatar'] . ' ' . $user_friend['name'] . '<span>' . $user_friend['last_active'] . '</span></li>';
}
echo '</ul>';
} else {
echo '<div class="message error">' . __('No friends online', 'wplms-dashboard') . '</div>';
}
echo '</div>';
}
if (isset($activity) && $activity) {
$activities = apply_filters('wplms_dashboard_activity', $wpdb->get_results($wpdb->prepare("\n\t\t\tSELECT *\n\t\t FROM {$bp->activity->table_name} AS activity\n\t\t WHERE \tactivity.user_id IN (%d)\n\t\t AND (activity.action != '' OR activity.action IS NOT NULL)\n\t\t ORDER BY activity.date_recorded DESC\n\t\t LIMIT 0,{$num}\n\t\t", $user_id)));
echo '<div id="tab-activity" class="tab-pane student_activity">
<h4>' . __('Recent Activity', 'wplms-dashboard') . '</h4>';
if (isset($activities) && is_array($activities)) {
echo '<ul class="dash-activities">';
foreach ($activities as $activity) {
if (isset($activity->action) && $activity->action != '') {
$time = tofriendlytime(time() - strtotime($activity->date_recorded));
echo '<li class="' . $activity->component . ' ' . $activity->type . '">
<div class="dash-activity">
<span class="dash-activity-time">' . $time . ' ' . __('AGO', 'wplms-dashboard') . '</span>
<strong>' . $activity->action . '</strong>
</div>
</li>';
}
}
echo '</ul>';
} else {
echo '<div class="message error">' . __('No activity found', 'wplms-dashboard') . '</div>';
}
echo '</div>';
}
echo '</div></div>' . $after_widget . '</div></div>';
}
示例2: messages_setup_nav
function messages_setup_nav()
{
global $bp;
if ($bp->current_component == $bp->messages->slug) {
$inbox_count = messages_get_unread_count();
$inbox_display = $inbox_count ? ' style="display:inline;"' : ' style="display:none;"';
$count_indicator = ' <span' . $inbox_display . ' class="unread-count inbox-count">' . $inbox_count . '</span>';
}
/* Add 'Profile' to the main navigation */
bp_core_add_nav_item(__('Messages', 'buddypress'), $bp->messages->slug, false, false);
bp_core_add_nav_default($bp->messages->slug, 'messages_screen_inbox', 'inbox', bp_is_home());
$messages_link = $bp->loggedin_user->domain . $bp->messages->slug . '/';
/* Add the subnav items to the profile */
bp_core_add_subnav_item($bp->messages->slug, 'inbox', __('Inbox', 'buddypress') . $count_indicator, $messages_link, 'messages_screen_inbox', false, bp_is_home());
bp_core_add_subnav_item($bp->messages->slug, 'sentbox', __('Sent Messages', 'buddypress'), $messages_link, 'messages_screen_sentbox', false, bp_is_home());
bp_core_add_subnav_item($bp->messages->slug, 'compose', __('Compose', 'buddypress'), $messages_link, 'messages_screen_compose', false, bp_is_home());
bp_core_add_subnav_item($bp->messages->slug, 'notices', __('Notices', 'buddypress'), $messages_link, 'messages_screen_notices', false, true, true);
if ($bp->current_component == $bp->messages->slug) {
if (bp_is_home()) {
$bp->bp_options_title = __('My Messages', 'buddypress');
} else {
$bp_options_avatar = bp_core_get_avatar($bp->displayed_user->id, 1);
$bp->bp_options_title = $bp->displayed_user->fullname;
}
}
}
示例3: ajax_navigation_func
function ajax_navigation_func()
{
$notifyAmount = bp_notifications_get_unread_notification_count(bp_loggedin_user_id());
$messageAmount = messages_get_unread_count();
$friendRequests = bp_friend_get_total_requests_count();
$groups = groups_get_invites_for_user(bp_loggedin_user_id());
$groupInvites = $groups['total'];
$navigationData = array('notifyAmount' => $notifyAmount, 'messageAmount' => $messageAmount, 'friendRequests' => $friendRequests, 'groupInvites' => $groupInvites);
echo json_encode($navigationData);
die;
}
示例4: test_get_unread_count
/**
* @group counts
*/
public function test_get_unread_count()
{
$u1 = $this->factory->user->create();
$u2 = $this->factory->user->create();
// send a private message
$t1 = messages_new_message(array('sender_id' => $u1, 'recipients' => array($u2), 'subject' => 'A new message', 'content' => 'Hey there!'));
// get unread count for $u2
$this->set_current_user($u2);
$this->assertEquals(1, messages_get_unread_count($u2));
// send another message and get recheck unread count
$t2 = messages_new_message(array('sender_id' => $u1, 'recipients' => array($u2), 'subject' => 'A new message', 'content' => 'Hey there!'));
$this->assertEquals(2, messages_get_unread_count($u2));
// mark one message as read
messages_mark_thread_read($t1);
// recheck unread count
$this->assertEquals(1, messages_get_unread_count($u2));
}
示例5: messages_setup_nav
function messages_setup_nav() {
global $bp;
if ( $count = messages_get_unread_count() )
$name = sprintf( __('Messages <strong>(%s)</strong>', 'buddypress'), $count );
else
$name = __('Messages <strong></strong>', 'buddypress');
/* Add 'Messages' to the main navigation */
bp_core_new_nav_item( array( 'name' => $name, 'slug' => $bp->messages->slug, 'position' => 50, 'show_for_displayed_user' => false, 'screen_function' => 'messages_screen_inbox', 'default_subnav_slug' => 'inbox', 'item_css_id' => $bp->messages->id ) );
$messages_link = $bp->loggedin_user->domain . $bp->messages->slug . '/';
/* Add the subnav items to the profile */
bp_core_new_subnav_item( array( 'name' => __( 'Inbox', 'buddypress' ) . $count_indicator, 'slug' => 'inbox', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_inbox', 'position' => 10, 'user_has_access' => bp_is_my_profile() ) );
bp_core_new_subnav_item( array( 'name' => __( 'Sent Messages', 'buddypress' ), 'slug' => 'sentbox', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_sentbox', 'position' => 20, 'user_has_access' => bp_is_my_profile() ) );
bp_core_new_subnav_item( array( 'name' => __( 'Compose', 'buddypress' ), 'slug' => 'compose', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_compose', 'position' => 30, 'user_has_access' => bp_is_my_profile() ) );
if ( is_super_admin() )
bp_core_new_subnav_item( array( 'name' => __( 'Notices', 'buddypress' ), 'slug' => 'notices', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_notices', 'position' => 90, 'user_has_access' => is_super_admin() ) );
if ( $bp->current_component == $bp->messages->slug ) {
if ( bp_is_my_profile() ) {
$bp->bp_options_title = __( 'My Messages', 'buddypress' );
} else {
$bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
$bp->bp_options_title = $bp->displayed_user->fullname;
}
}
do_action( 'messages_setup_nav' );
}
示例6: setup_admin_bar
/**
* Set up the admin bar
*
* @global obj $bp
*/
function setup_admin_bar()
{
global $bp;
// Prevent debug notices
$nxt_admin_nav = array();
// Menus for logged in user
if (is_user_logged_in()) {
// Setup the logged in user variables
$user_domain = $bp->loggedin_user->domain;
$messages_link = trailingslashit($user_domain . $this->slug);
// Unread message count
if ($count = messages_get_unread_count()) {
$title = sprintf(__('Messages <span class="count">%s</span>', 'buddypress'), $count);
$inbox = sprintf(__('Inbox <span class="count">%s</span>', 'buddypress'), $count);
} else {
$title = __('Messages', 'buddypress');
$inbox = __('Inbox', 'buddypress');
}
// Add main Messages menu
$nxt_admin_nav[] = array('parent' => $bp->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => trailingslashit($messages_link));
// Inbox
$nxt_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-inbox', 'title' => $inbox, 'href' => trailingslashit($messages_link . 'inbox'));
// Sent Messages
$nxt_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-sentbox', 'title' => __('Sent', 'buddypress'), 'href' => trailingslashit($messages_link . 'sentbox'));
// Compose Message
$nxt_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-compose', 'title' => __('Compose', 'buddypress'), 'href' => trailingslashit($messages_link . 'compose'));
// Site Wide Notices
if (is_super_admin()) {
$nxt_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-notices', 'title' => __('All Member Notices', 'buddypress'), 'href' => trailingslashit($messages_link . 'notices'));
}
}
parent::setup_admin_bar($nxt_admin_nav);
}
示例7: _e
"><i class="icon-close-off-2"></i> <?php
_e('LOGOUT', 'vibe');
?>
</a></li>
<li id="admin_panel_icon"><?php
if (current_user_can("edit_posts")) {
echo '<a href="' . vibe_site_url() . 'wp-admin/" title="' . __('Access admin panel', 'vibe') . '"><i class="icon-settings-1"></i></a>';
}
?>
</li>
</ul>
<ul>
<?php
$loggedin_menu = array('courses' => array('icon' => 'icon-book-open-1', 'label' => __('Courses', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_COURSE_SLUG), 'stats' => array('icon' => 'icon-analytics-chart-graph', 'label' => __('Stats', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_COURSE_SLUG . '/' . BP_COURSE_STATS_SLUG));
if (bp_is_active('messages')) {
$loggedin_menu['messages'] = array('icon' => 'icon-letter-mail-1', 'label' => __('Inbox', 'vibe') . (messages_get_unread_count() ? ' <span>' . messages_get_unread_count() . '</span>' : ''), 'link' => bp_loggedin_user_domain() . BP_MESSAGES_SLUG);
$n = vbp_current_user_notification_count();
$loggedin_menu['notifications'] = array('icon' => 'icon-exclamation', 'label' => __('Notifications', 'vibe') . ($n ? ' <span>' . $n . '</span>' : ''), 'link' => bp_loggedin_user_domain() . BP_NOTIFICATIONS_SLUG);
}
if (bp_is_active('groups')) {
$loggedin_menu['groups'] = array('icon' => 'icon-myspace-alt', 'label' => __('Groups', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_GROUPS_SLUG);
}
$loggedin_menu['settings'] = array('icon' => 'icon-settings', 'label' => __('Settings', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_SETTINGS_SLUG);
$loggedin_menu = apply_filters('wplms_logged_in_top_menu', $loggedin_menu);
foreach ($loggedin_menu as $item) {
echo '<li><a href="' . $item['link'] . '"><i class="' . $item['icon'] . '"></i>' . $item['label'] . '</a></li>';
}
?>
</ul>
<?php
示例8: widget
function widget($args, $instance)
{
extract($args);
echo $before_widget;
if (is_user_logged_in()) {
do_action('bp_before_sidebar_me');
?>
<div id="sidebar-me">
<div id="bpavatar">
<?php
bp_loggedin_user_avatar('type=full');
?>
</div>
<ul>
<li id="username"><a
href="<?php
bp_loggedin_user_link();
?>
"><?php
bp_loggedin_user_fullname();
?>
</a></li>
<li><a href="<?php
echo bp_loggedin_user_domain() . BP_XPROFILE_SLUG;
?>
/"
title="<?php
_e('View profile', 'vibe');
?>
"><?php
_e('View profile', 'vibe');
?>
</a>
</li>
<li id="vbplogout"><a href="<?php
echo wp_logout_url(get_permalink());
?>
"
id="destroy-sessions" rel="nofollow" class="logout"
title="<?php
_e('Log Out', 'vibe');
?>
"><i
class="icon-close-off-2"></i> <?php
_e('LOGOUT', 'vibe');
?>
</a></li>
<li id="admin_panel_icon"><?php
if (current_user_can("edit_posts")) {
echo '<a href="' . vibe_site_url() . 'wp-admin/" title="' . __('Access admin panel', 'vibe') . '"><i class="icon-settings-1"></i></a>';
}
?>
</li>
</ul>
<ul>
<?php
$loggedin_menu = array('courses' => array('icon' => 'icon-book-open-1', 'label' => __('Courses', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_COURSE_SLUG), 'stats' => array('icon' => 'icon-analytics-chart-graph', 'label' => __('Stats', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_COURSE_SLUG . '/' . BP_COURSE_STATS_SLUG));
if (bp_is_active('messages')) {
$loggedin_menu['messages'] = array('icon' => 'icon-letter-mail-1', 'label' => __('Inbox', 'vibe') . (messages_get_unread_count() ? ' <span>' . messages_get_unread_count() . '</span>' : ''), 'link' => bp_loggedin_user_domain() . BP_MESSAGES_SLUG);
$n = vbp_current_user_notification_count();
$loggedin_menu['notifications'] = array('icon' => 'icon-exclamation', 'label' => __('Notifications', 'vibe') . ($n ? ' <span>' . $n . '</span>' : ''), 'link' => bp_loggedin_user_domain() . BP_NOTIFICATIONS_SLUG);
}
if (bp_is_active('groups')) {
$loggedin_menu['groups'] = array('icon' => 'icon-myspace-alt', 'label' => __('Groups', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_GROUPS_SLUG);
}
$loggedin_menu['settings'] = array('icon' => 'icon-settings', 'label' => __('Settings', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_SETTINGS_SLUG);
$loggedin_menu = apply_filters('wplms_logged_in_top_menu', $loggedin_menu);
foreach ($loggedin_menu as $item) {
echo '<li><a href="' . $item['link'] . '"><i class="' . $item['icon'] . '"></i>' . $item['label'] . '</a></li>';
}
?>
</ul>
<?php
do_action('bp_sidebar_me');
?>
</div>
<?php
do_action('bp_after_sidebar_me');
/***** If the user is not logged in, show the log form and account creation link *****/
} else {
if (!isset($user_login)) {
$user_login = '';
}
do_action('bp_before_sidebar_login_form');
?>
<form name="login-form" id="vbp-login-form" class="standard-form"
action="<?php
echo apply_filters('wplms_login_widget_action', vibe_site_url('wp-login.php', 'login-post'));
?>
" method="post">
<label><?php
_e('Username', 'vibe');
?>
<br/>
<input type="text" name="log" id="side-user-login" class="input" tabindex="1"
value="<?php
echo esc_attr(stripslashes($user_login));
//.........这里部分代码省略.........
示例9: widget
function widget($args, $instance)
{
extract($args);
echo $before_widget;
if (is_user_logged_in()) {
do_action('bp_before_sidebar_me');
?>
<div id="sidebar-me">
<div id="bpavatar">
<a href="<?php
echo bp_loggedin_user_domain() . BP_XPROFILE_SLUG;
?>
/" title="<?php
_e('Thông tin cá nhân', 'vibe');
?>
"><?php
bp_loggedin_user_avatar('type=full');
?>
</a>
</div>
<ul style="width: 145px">
<li id="username"><a href="<?php
bp_loggedin_user_link();
?>
"><?php
bp_loggedin_user_fullname();
?>
</a></li>
<li><a href="<?php
echo bp_loggedin_user_domain() . BP_XPROFILE_SLUG;
?>
/" title="<?php
_e('Thông tin cá nhân', 'vibe');
?>
"><?php
_e('Thông tin cá nhân', 'vibe');
?>
</a></li>
<li id="vbplogout"><a href="<?php
echo wp_logout_url(get_permalink());
?>
" id="destroy-sessions" rel="nofollow" class="logout" title="<?php
_e('Đăng xuất', 'vibe');
?>
"><?php
_e('Đăng xuất', 'vibe');
?>
</a></li>
<li id="admin_panel_icon"><?php
if (current_user_can("edit_posts")) {
echo '<a href="' . vibe_site_url() . 'wp-admin/" title="' . __('Access admin panel', 'vibe') . '"><i class="icon-settings-1"></i></a>';
}
?>
</li>
</ul>
<ul>
<?php
function child_wplms_get_mycred_link()
{
$mycred = get_option('mycred_pref_core');
if (isset($mycred['buddypress']) && isset($mycred['buddypress']['history_url']) && isset($mycred['buddypress']['history_location']) && $mycred['buddypress']['history_location']) {
$link = bp_get_loggedin_user_link() . $mycred['buddypress']['history_url'];
} else {
$link = '#';
}
return $link;
}
$loggedin_menu = array('taikhoan' => array('icon' => 'icon-book-open-1', 'label' => __('Tài khoản: ' . apply_filters('get_point_user', ''), 'vibe'), 'link' => child_wplms_get_mycred_link()), 'naptientaokhoan' => array('icon' => 'icon-book-open-1', 'label' => __('Nạp tiền tài khoản', 'vibe'), 'link' => get_home_url() . '/thanh-toan-khoa-hoc/'), 'courses' => array('icon' => 'icon-book-open-1', 'label' => __('Khóa học của tôi', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_COURSE_SLUG));
if (bp_is_active('messages')) {
$loggedin_menu['messages'] = array('icon' => 'icon-letter-mail-1', 'label' => __('Hộp thư đến', 'vibe') . (messages_get_unread_count() ? ' <span>' . messages_get_unread_count() . '</span>' : ''), 'link' => bp_loggedin_user_domain() . BP_MESSAGES_SLUG);
$n = vbp_current_user_notification_count();
// $loggedin_menu['notifications']=array(
// 'icon' => 'icon-exclamation',
// 'label' => __('Thông báo','vibe').(($n)?' <span>'.$n.'</span>':''),
// 'link' => bp_loggedin_user_domain().BP_NOTIFICATIONS_SLUG
// );
}
if (bp_is_active('groups')) {
$loggedin_menu['groups'] = array('icon' => 'icon-myspace-alt', 'label' => __('Nhóm', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_GROUPS_SLUG);
}
$loggedin_menu = apply_filters('wplms_logged_in_top_menu', $loggedin_menu);
foreach ($loggedin_menu as $item) {
echo '<li><a href="' . $item['link'] . '"><i class="' . $item['icon'] . '"></i>' . $item['label'] . '</a></li>';
}
?>
</ul>
<?php
do_action('bp_sidebar_me');
?>
</div>
<?php
do_action('bp_after_sidebar_me');
/***** If the user is not logged in, show the log form and account creation link *****/
} else {
if (!isset($user_login)) {
$user_login = '';
}
do_action('bp_before_sidebar_login_form');
?>
//.........这里部分代码省略.........
示例10: bp_loggedin_user_domain
/notifications">
<li>
<span>Unread</span>
<span class="amount-wrap notify-inner"></span>
</li>
</a>
<a href="<?php
echo bp_loggedin_user_domain();
?>
/notifications/read">
<li>View All</li>
</a>
</ul>
<li>
<?php
$messageCount = messages_get_unread_count();
?>
<a class="nav-link message-btn" href="<?php
echo bp_loggedin_user_domain();
?>
/messages">
<svg><use xlink:href="#message-icon" /></svg>
<span>Messages</span>
</a>
<div class="drop-arrow">
<span class="arrow-wrap">
<svg><use xlink:href="#arrow-icon" /></svg>
</span>
</div>
</li>
<ul class="nav-right-inner">
示例11: buddyboss_notification_count_heartbeat
/**
* Sending a heartbeat for notification updates
*
* @since Boss 1.0.0
*
*/
function buddyboss_notification_count_heartbeat($response, $data, $screen_id)
{
if (function_exists("bp_friend_get_total_requests_count")) {
$friend_request_count = bp_friend_get_total_requests_count();
}
if (function_exists("bp_notifications_get_all_notifications_for_user")) {
$notifications = bp_notifications_get_all_notifications_for_user(get_current_user_id());
}
$notification_count = count($notifications);
if (function_exists("bp_notifications_get_all_notifications_for_user")) {
$notifications = bp_notifications_get_notifications_for_user(get_current_user_id());
foreach ((array) $notifications as $notification) {
$notification_content .= $notification;
}
if (empty($notification_content)) {
$notification_content = '<a href="' . bp_loggedin_user_domain() . '' . BP_NOTIFICATIONS_SLUG . '/">' . __("No new notifications", "buddypress") . '</a>';
}
}
if (function_exists("messages_get_unread_count")) {
$unread_message_count = messages_get_unread_count();
}
$response['bb_notification_count'] = array('friend_request' => @intval($friend_request_count), 'notification' => @intval($notification_count), 'notification_content' => @$notification_content, 'unread_message' => @intval($unread_message_count));
return $response;
}
示例12: widget
//.........这里部分代码省略.........
<button type="submit" name="wp-submit" class="userSubmit submitDefault" tabindex="40">Entrar</button>
<input type="hidden" name="redirect_to" value="<?php
bloginfo('url');
?>
" />
<input type="hidden" name="testcookie" value="1" />
</div>
</fieldset>
</form>
<?php
echo $after_widget;
$before_widget_ = strstr('#', $before_widget);
$before_pos = strpos('"', $before_widget_);
$before_widget_ = substr($before_widget_, 0, $before_pos - 1);
if (bp_get_signup_allowed()) {
echo '<div id="register-' . $id . '" class="widget widget_register widget_login">' . $before_title . 'Registre-se' . $after_title;
?>
<form id="registerform" action="<?php
bloginfo('url');
?>
/registrar-na-rede/" method="post">
<fieldset>
<div class="formfield">
<label for="field_1">Nome Completo:</label>
<div class="inputDefault"><input id="field_1" type="text" name="field_1"/></div>
<label for="userLogin_">Nome do usuário:</label>
<div class="inputDefault"><input type="text" name="signup_username" id="userLogin_" tabindex="10" /></div>
<label for="signup_email">E-mail:</label>
<div class="inputDefault"><input type="text" id="signup_email" name="signup_email" tabindex="20" /></div>
<label for="signup_password">Senha:</label>
<div class="inputDefault"><input type="password" id="signup_password" name="signup_password" tabindex="20" /></div>
<div class="datebox">
<label for="field_4_day">Data de nascimento:</label>
<select name="field_4_day" id="field_4_day">
<option value="">--</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option>
</select>
<select name="field_4_month" id="field_4_month">
<option value="">------</option><option value="January">janeiro</option><option value="February">fevereiro</option><option value="March">março</option><option value="April">abril</option><option value="May">maio</option><option value="June">junho</option><option value="July">julho</option><option value="August">agosto</option><option value="September">setembro</option><option value="October">outubro</option><option value="November">novembro</option><option value="December">dezembro</option> </select>
<select name="field_4_year" id="field_4_year">
<option value="">----</option><option value="2010">2010</option><option value="2009">2009</option><option value="2008">2008</option><option value="2007">2007</option><option value="2006">2006</option><option value="2005">2005</option><option value="2004">2004</option><option value="2003">2003</option><option value="2002">2002</option><option value="2001">2001</option><option value="2000">2000</option><option value="1999">1999</option><option value="1998">1998</option><option value="1997">1997</option><option value="1996">1996</option><option value="1995">1995</option><option value="1994">1994</option><option value="1993">1993</option><option value="1992">1992</option><option value="1991">1991</option><option value="1990">1990</option><option value="1989">1989</option><option value="1988">1988</option><option value="1987">1987</option><option value="1986">1986</option><option value="1985">1985</option><option value="1984">1984</option><option value="1983">1983</option><option value="1982">1982</option><option value="1981">1981</option><option value="1980">1980</option><option value="1979">1979</option><option value="1978">1978</option><option value="1977">1977</option><option value="1976">1976</option><option value="1975">1975</option><option value="1974">1974</option><option value="1973">1973</option><option value="1972">1972</option><option value="1971">1971</option><option value="1970">1970</option><option value="1969">1969</option><option value="1968">1968</option><option value="1967">1967</option><option value="1966">1966</option><option value="1965">1965</option><option value="1964">1964</option><option value="1963">1963</option><option value="1962">1962</option><option value="1961">1961</option><option value="1960">1960</option><option value="1959">1959</option><option value="1958">1958</option><option value="1957">1957</option><option value="1956">1956</option><option value="1955">1955</option><option value="1954">1954</option><option value="1953">1953</option><option value="1952">1952</option><option value="1951">1951</option><option value="1950">1950</option><option value="1949">1949</option><option value="1948">1948</option><option value="1947">1947</option><option value="1946">1946</option><option value="1945">1945</option><option value="1944">1944</option><option value="1943">1943</option><option value="1942">1942</option><option value="1941">1941</option><option value="1940">1940</option><option value="1939">1939</option><option value="1938">1938</option><option value="1937">1937</option><option value="1936">1936</option><option value="1935">1935</option><option value="1934">1934</option><option value="1933">1933</option><option value="1932">1932</option><option value="1931">1931</option><option value="1930">1930</option><option value="1929">1929</option><option value="1928">1928</option><option value="1927">1927</option><option value="1926">1926</option><option value="1925">1925</option><option value="1924">1924</option><option value="1923">1923</option><option value="1922">1922</option><option value="1921">1921</option><option value="1920">1920</option><option value="1919">1919</option><option value="1918">1918</option><option value="1917">1917</option><option value="1916">1916</option><option value="1915">1915</option><option value="1914">1914</option><option value="1913">1913</option><option value="1912">1912</option><option value="1911">1911</option><option value="1910">1910</option><option value="1909">1909</option><option value="1908">1908</option><option value="1907">1907</option><option value="1906">1906</option><option value="1905">1905</option><option value="1904">1904</option><option value="1903">1903</option><option value="1902">1902</option><option value="1901">1901</option><option value="1900">1900</option>
</select>
</div>
<button type="submit" name="wp-submit" class="userSubmit submitDefault" tabindex="40">Continuar »</button>
</div>
</fieldset>
</form>
<?php
echo $after_widget;
}
} else {
echo $before_widget . $before_title . 'Minha conta' . $after_title;
global $bp;
?>
<div class="panel">
<a href="<?php
echo $bp->loggedin_user->domain;
?>
" title="Perfil"><?php
bp_loggedin_user_avatar('type=thumb&width=62&height=62');
?>
</a>
<h3>Olá <strong><?php
echo $bp->loggedin_user->fullname;
?>
</strong>.</h3>
<div class="linksAdmin">
<a href="<?php
echo $bp->loggedin_user->domain;
?>
">Meu perfil</a> | <strong><a class="button logout" href="<?php
echo wp_logout_url(bp_get_root_domain());
?>
">Sair</a></strong>
</div>
<div class="msg">
<p>
<?php
global $bp;
$hmag_inbox_count = messages_get_unread_count();
if ($hmag_inbox_count <= 0) {
echo 'Você não possui mensagem.';
} else {
echo 'Você possui ' . $hmag_inbox_count . ' <a href="' . $bp->loggedin_user->domain . 'messages/" title="Minhas mensagens">mensagens</a>!';
}
?>
</p>
</div>
</div>
<?php
echo $after_widget;
}
}
示例13: setup_admin_bar
/**
* Set up the Toolbar.
*
* @param array $wp_admin_nav See {BP_Component::setup_admin_bar()}
* for details.
*/
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
$messages_link = trailingslashit(bp_loggedin_user_domain() . bp_get_messages_slug());
// Unread message count
$count = messages_get_unread_count();
if (!empty($count)) {
$title = sprintf(__('Messages <span class="count">%s</span>', 'buddypress'), bp_core_number_format($count));
$inbox = sprintf(__('Inbox <span class="count">%s</span>', 'buddypress'), bp_core_number_format($count));
} else {
$title = __('Messages', 'buddypress');
$inbox = __('Inbox', 'buddypress');
}
// Add main Messages menu
$wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => $messages_link);
// Inbox
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-inbox', 'title' => $inbox, 'href' => $messages_link);
// Starred
if (bp_is_active($this->id, 'star')) {
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-starred', 'title' => __('Starred', 'buddypress'), 'href' => trailingslashit($messages_link . bp_get_messages_starred_slug()));
}
// Sent Messages
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-sentbox', 'title' => __('Sent', 'buddypress'), 'href' => trailingslashit($messages_link . 'sentbox'));
// Compose Message
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-compose', 'title' => __('Compose', 'buddypress'), 'href' => trailingslashit($messages_link . 'compose'));
// Site Wide Notices
if (bp_current_user_can('bp_moderate')) {
$wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-notices', 'title' => __('All Member Notices', 'buddypress'), 'href' => trailingslashit($messages_link . 'notices'));
}
}
parent::setup_admin_bar($wp_admin_nav);
}