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


PHP BP_Messages_Thread::get_current_threads_for_user方法代码示例

本文整理汇总了PHP中BP_Messages_Thread::get_current_threads_for_user方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Messages_Thread::get_current_threads_for_user方法的具体用法?PHP BP_Messages_Thread::get_current_threads_for_user怎么用?PHP BP_Messages_Thread::get_current_threads_for_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BP_Messages_Thread的用法示例。


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

示例1: test_get_current_threads_for_user_with_old_args

 /**
  * @group get_current_threads_for_user
  * @expectedDeprecated BP_Messages_Thread::get_current_threads_for_user
  */
 public function test_get_current_threads_for_user_with_old_args()
 {
     $u1 = $this->factory->user->create();
     $u2 = $this->factory->user->create();
     $t1 = $this->factory->message->create(array('sender_id' => $u1, 'recipients' => array($u2), 'subject' => 'Foo'));
     $t2 = $this->factory->message->create(array('sender_id' => $u1, 'recipients' => array($u2), 'subject' => 'Bar'));
     $threads = BP_Messages_Thread::get_current_threads_for_user($u1, 'sentbox', 'all', null, null, 'ar');
     $expected = array($t2);
     $found = wp_parse_id_list(wp_list_pluck($threads['threads'], 'thread_id'));
     $this->assertSame($expected, $found);
 }
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:15,代码来源:class.bp-messages-thread.php

示例2: bp_messages_box_template

	function bp_messages_box_template( $user_id, $box, $per_page, $max, $type ) {
		$this->pag_page = isset( $_GET['mpage'] ) ? intval( $_GET['mpage'] ) : 1;
		$this->pag_num  = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : $per_page;

		$this->user_id  = $user_id;
		$this->box      = $box;
		$this->type     = $type;

		if ( 'notices' == $this->box ) {
			$this->threads = BP_Messages_Notice::get_notices();
		} else {
			$threads = BP_Messages_Thread::get_current_threads_for_user( $this->user_id, $this->box, $this->type, $this->pag_num, $this->pag_page );

			$this->threads            = $threads['threads'];
			$this->total_thread_count = $threads['total'];
		}

		if ( !$this->threads ) {
			$this->thread_count       = 0;
			$this->total_thread_count = 0;
		} else {
			$total_notice_count = BP_Messages_Notice::get_total_notice_count();

			if ( !$max || $max >= (int)$total_notice_count ) {
				if ( 'notices' == $this->box ) {
					$this->total_thread_count = (int)$total_notice_count;
				}
			} else {
				$this->total_thread_count = (int)$max;
			}

			if ( $max ) {
				if ( $max >= count($this->threads) ) {
					$this->thread_count = count($this->threads);
				} else {
					$this->thread_count = (int)$max;
				}
			} else {
				$this->thread_count = count($this->threads);
			}
		}

		if ( (int)$this->total_thread_count && (int)$this->pag_num ) {
			$this->pag_links = paginate_links( array(
				'base'      => add_query_arg( 'mpage', '%#%' ),
				'format'    => '',
				'total'     => ceil( (int)$this->total_thread_count / (int)$this->pag_num ),
				'current'   => $this->pag_page,
				'prev_text' => '←',
				'next_text' => '→',
				'mid_size'  => 1
			) );
		}
	}
开发者ID:n-sane,项目名称:zaroka,代码行数:54,代码来源:bp-messages-templatetags.php

示例3: __construct

 function __construct($user_id, $box, $per_page, $max, $type, $search_terms, $page_arg = 'mpage')
 {
     $this->pag_page = isset($_GET[$page_arg]) ? intval($_GET[$page_arg]) : 1;
     $this->pag_num = isset($_GET['num']) ? intval($_GET['num']) : $per_page;
     $this->user_id = $user_id;
     $this->box = $box;
     $this->type = $type;
     $this->search_terms = $search_terms;
     if ('notices' == $this->box) {
         $this->threads = BP_Messages_Notice::get_notices(array('pag_num' => $this->pag_num, 'pag_page' => $this->pag_page));
     } else {
         $threads = BP_Messages_Thread::get_current_threads_for_user($this->user_id, $this->box, $this->type, $this->pag_num, $this->pag_page, $this->search_terms);
         $this->threads = $threads['threads'];
         $this->total_thread_count = $threads['total'];
     }
     if (!$this->threads) {
         $this->thread_count = 0;
         $this->total_thread_count = 0;
     } else {
         $total_notice_count = BP_Messages_Notice::get_total_notice_count();
         if (!$max || $max >= (int) $total_notice_count) {
             if ('notices' == $this->box) {
                 $this->total_thread_count = (int) $total_notice_count;
             }
         } else {
             $this->total_thread_count = (int) $max;
         }
         if ($max) {
             if ($max >= count($this->threads)) {
                 $this->thread_count = count($this->threads);
             } else {
                 $this->thread_count = (int) $max;
             }
         } else {
             $this->thread_count = count($this->threads);
         }
     }
     if ((int) $this->total_thread_count && (int) $this->pag_num) {
         $this->pag_links = paginate_links(array('base' => add_query_arg($page_arg, '%#%'), 'format' => '', 'total' => ceil((int) $this->total_thread_count / (int) $this->pag_num), 'current' => $this->pag_page, 'prev_text' => _x('←', 'Message pagination previous text', 'buddypress'), 'next_text' => _x('→', 'Message pagination next text', 'buddypress'), 'mid_size' => 1));
     }
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:41,代码来源:bp-messages-template.php

示例4: __construct

 /**
  * Constructor method.
  *
  * @param array $args {
  *     Array of arguments. See bp_has_message_threads() for full description.
  * }
  */
 public function __construct($args = array())
 {
     // Backward compatibility with old method of passing arguments
     if (!is_array($args) || func_num_args() > 1) {
         _deprecated_argument(__METHOD__, '2.2.0', sprintf(__('Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress'), __METHOD__, __FILE__));
         $old_args_keys = array(0 => 'user_id', 1 => 'box', 2 => 'per_page', 3 => 'max', 4 => 'type', 5 => 'search_terms', 6 => 'page_arg');
         $func_args = func_get_args();
         $args = bp_core_parse_args_array($old_args_keys, $func_args);
     }
     $r = wp_parse_args($args, array('page' => 1, 'per_page' => 10, 'page_arg' => 'mpage', 'box' => 'inbox', 'type' => 'all', 'user_id' => bp_loggedin_user_id(), 'max' => false, 'search_terms' => '', 'meta_query' => array()));
     $this->pag_arg = sanitize_key($r['page_arg']);
     $this->pag_page = bp_sanitize_pagination_arg($this->pag_arg, $r['page']);
     $this->pag_num = bp_sanitize_pagination_arg('num', $r['per_page']);
     $this->user_id = $r['user_id'];
     $this->box = $r['box'];
     $this->type = $r['type'];
     $this->search_terms = $r['search_terms'];
     if ('notices' === $this->box) {
         $this->threads = BP_Messages_Notice::get_notices(array('pag_num' => $this->pag_num, 'pag_page' => $this->pag_page));
     } else {
         $threads = BP_Messages_Thread::get_current_threads_for_user(array('user_id' => $this->user_id, 'box' => $this->box, 'type' => $this->type, 'limit' => $this->pag_num, 'page' => $this->pag_page, 'search_terms' => $this->search_terms, 'meta_query' => $r['meta_query']));
         $this->threads = $threads['threads'];
         $this->total_thread_count = $threads['total'];
     }
     if (!$this->threads) {
         $this->thread_count = 0;
         $this->total_thread_count = 0;
     } else {
         $total_notice_count = BP_Messages_Notice::get_total_notice_count();
         if (empty($r['max']) || (int) $r['max'] >= (int) $total_notice_count) {
             if ('notices' === $this->box) {
                 $this->total_thread_count = (int) $total_notice_count;
             }
         } else {
             $this->total_thread_count = (int) $r['max'];
         }
         if (!empty($r['max'])) {
             if ((int) $r['max'] >= count($this->threads)) {
                 $this->thread_count = count($this->threads);
             } else {
                 $this->thread_count = (int) $r['max'];
             }
         } else {
             $this->thread_count = count($this->threads);
         }
     }
     if ((int) $this->total_thread_count && (int) $this->pag_num) {
         $pag_args = array($r['page_arg'] => '%#%');
         if (defined('DOING_AJAX') && true === (bool) DOING_AJAX) {
             $base = remove_query_arg('s', wp_get_referer());
         } else {
             $base = '';
         }
         $add_args = array();
         if (!empty($this->search_terms)) {
             $add_args['s'] = $this->search_terms;
         }
         $this->pag_links = paginate_links(array('base' => add_query_arg($pag_args, $base), 'format' => '', 'total' => ceil((int) $this->total_thread_count / (int) $this->pag_num), 'current' => $this->pag_page, 'prev_text' => _x('←', 'Message pagination previous text', 'buddypress'), 'next_text' => _x('→', 'Message pagination next text', 'buddypress'), 'mid_size' => 1, 'add_args' => $add_args));
     }
 }
开发者ID:kosir,项目名称:thatcamp-org,代码行数:67,代码来源:bp-messages-template.php


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