当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_message_thread_has_unread函数代码示例

本文整理汇总了PHP中bp_message_thread_has_unread函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_message_thread_has_unread函数的具体用法?PHP bp_message_thread_has_unread怎么用?PHP bp_message_thread_has_unread使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_message_thread_has_unread函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_items

 /**
  * Get all messages
  *
  * @param WP_REST_Request $request
  * @return array|WP_Error
  */
 public function get_items($request)
 {
     /* filter messages */
     $args = array();
     $args['box'] = $request['box'];
     if ($request['box'] == 'starred') {
         $args['meta_query'] = array(array('key' => 'starred_by_user', 'value' => bp_loggedin_user_id()));
     }
     if (isset($request['filter'])) {
         $args = array_merge($args, $request['filter']);
         unset($args['filter']);
     }
     global $messages_template;
     $data = array();
     if (bp_has_message_threads($args)) {
         while (bp_message_threads()) {
             bp_message_thread();
             $single_msg = array('thread_id' => $messages_template->thread->thread_id, 'read' => bp_message_thread_has_unread() ? false : true, 'total_messages' => bp_get_message_thread_total_count($messages_template->thread->thread_id), 'unread_messages' => bp_get_message_thread_unread_count($messages_template->thread->thread_id), 'avatar' => bp_core_fetch_avatar(array('item_id' => $messages_template->thread->last_sender_id, 'width' => 25, 'height' => 25, 'html' => false)), 'from' => bp_core_get_username($messages_template->thread->last_sender_id), 'from_id' => $messages_template->thread->last_sender_id, 'last_message_date' => $messages_template->thread->last_message_date, 'subject' => bp_get_message_thread_subject(), 'excerpt' => bp_get_message_thread_excerpt(), 'content' => bp_get_message_thread_content());
             if (bp_is_active('messages', 'star')) {
                 $single_msg['star'] = strpos(bp_get_the_message_star_action_link(array('thread_id' => bp_get_message_thread_id())), 'unstar') ? true : false;
             }
             if ($args['box'] == 'sentbox') {
                 foreach ($messages_template->thread->recipients as $user => $userdata) {
                     if ((int) $user !== bp_loggedin_user_id()) {
                         $single_msg['to'][$user]['name'] = bp_core_get_username($user);
                     }
                 }
             }
             $links['self'] = array('href' => rest_url(sprintf(BP_API_SLUG . '/messages/%d', $messages_template->thread->thread_id)));
             if ($args['box'] == 'sentbox') {
                 $links['collection'] = array('href' => rest_url(BP_API_SLUG . '/messages?box=sentbox'));
             } else {
                 $links['collection'] = array('href' => rest_url(BP_API_SLUG . '/messages/'));
             }
             $single_msg['_links'] = $links;
             $data[] = $single_msg;
         }
     } else {
         return new WP_Error('bp_json_messages', __('No Messages Found.', BP_API_PLUGIN_SLUG), array('status' => 200));
     }
     $data = apply_filters('bp_json_prepare_messages', $data);
     return new WP_REST_Response($data, 200);
 }
开发者ID:buddyboss,项目名称:BP-API,代码行数:49,代码来源:bp-api-messages.php

示例2: do_action

	<?php 
    do_action('bp_after_member_messages_pagination');
    do_action('bp_before_member_messages_threads');
    ?>

	<table id="message-threads" class="messages-notices">
		<?php 
    while (bp_message_threads()) {
        bp_message_thread();
        ?>
			<tr id="m-<?php 
        bp_message_thread_id();
        ?>
" class="<?php 
        bp_message_css_class();
        if (bp_message_thread_has_unread()) {
            ?>
 unread"<?php 
        } else {
            ?>
 read"<?php 
        }
        ?>
>
				<td width="1%" class="thread-count">
					<span class="unread-count"><?php 
        bp_message_thread_unread_count();
        ?>
</span>
				</td>
				<td width="1%" class="thread-avatar"><?php 
开发者ID:hscale,项目名称:webento,代码行数:31,代码来源:messages-loop.php

示例3: bp_messages_pagination_count

			<?php bp_messages_pagination_count() ?>
		</div>

		<div class="pagination-links" id="messages-dir-pag">
			<?php bp_messages_pagination() ?>
		</div>

	</div><!-- .pagination -->

	<?php do_action( 'bp_after_member_messages_pagination' ) ?>
	<?php do_action( 'bp_before_member_messages_threads' ) ?>

	<table id="message-threads" class="zebra">
		<?php while ( bp_message_threads() ) : bp_message_thread(); ?>

			<tr id="m-<?php bp_message_thread_id() ?>"<?php if ( bp_message_thread_has_unread() ) : ?> class="unread"<?php else: ?> class="read"<?php endif; ?>>
				<td width="1%" class="thread-count">
					<span class="unread-count"><?php bp_message_thread_unread_count() ?></span>
				</td>
				<td width="1%" class="thread-avatar"><?php bp_message_thread_avatar() ?></td>

				<?php if ( 'sentbox' != bp_current_action() ) : ?>
					<td width="30%" class="thread-from">
						<?php _e( 'From:', 'buddypress' ); ?> <?php bp_message_thread_from() ?><br />
						<span class="activity"><?php bp_message_thread_last_post_date() ?></span>
					</td>
				<?php else: ?>
					<td width="30%" class="thread-from">
						<?php _e( 'To:', 'buddypress' ); ?> <?php bp_message_thread_to() ?><br />
						<span class="activity"><?php bp_message_thread_last_post_date() ?></span>
					</td>
开发者ID:n-sane,项目名称:zaroka,代码行数:31,代码来源:messages-loop.php


注:本文中的bp_message_thread_has_unread函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。