PageRenderTime 43ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/code/cake/app/webroot/cp/wp-content/plugins/commentpress-core/themes/commentpress-theme/assets/templates/activity_sidebar.php

https://github.com/DigitalPaulScholtenProject/DPSP-Platform
PHP | 447 lines | 167 code | 160 blank | 120 comment | 16 complexity | 3ed05091fee41ebb415d688015d25d3f MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. // access globals
  3. global $post, $commentpress_core;
  4. // init output
  5. $_page_comments_output = '';
  6. // is it commentable?
  7. $_is_commentable = commentpress_is_commentable();
  8. // if a commentable post...
  9. if ( $_is_commentable ) {
  10. // set default phrase
  11. $_paragraph_text = __( 'Recent Comments on this Page', 'commentpress-core' );
  12. $_current_type = get_post_type();
  13. //print_r( $_current_type ); die();
  14. // switch( $_current_type ) {//JVDP
  15. // // we can add more of these if needed
  16. // case 'post': $_paragraph_text = __( 'Recent Comments on this Post', 'commentpress-core' ); break;
  17. // case 'page': $_paragraph_text = __( 'Recent Comments on this Page', 'commentpress-core' ); break;
  18. // }
  19. // set default
  20. $page_comments_title = apply_filters(
  21. 'cp_activity_tab_recent_title_page',
  22. $_paragraph_text
  23. );
  24. // get page comments
  25. $_page_comments_output = commentpress_get_comment_activity( 'post' );
  26. }
  27. // set default
  28. // $_all_comments_title = apply_filters(//JVDP
  29. // 'cp_activity_tab_recent_title_blog',
  30. // __( 'Recent Comments in this Document', 'commentpress-core' )
  31. // );
  32. // get all comments
  33. //$_all_comments_output = commentpress_get_comment_activity( 'all' );
  34. // set maximum number to show - put into option?
  35. $_max_members = 10;
  36. ?><!-- activity_sidebar.php -->
  37. <div id="activity_sidebar" class="sidebar_container">
  38. <div class="sidebar_header">
  39. <h2>Activity</h2>
  40. </div>
  41. <div class="sidebar_minimiser">
  42. <div class="sidebar_contents_wrapper">
  43. <div class="comments_container">
  44. <?php
  45. // show page comments if we can
  46. if ( $_is_commentable AND $_page_comments_output != '' ) {
  47. ?><h3 class="activity_heading"><?php echo $page_comments_title; ?></h3>
  48. <div class="paragraph_wrapper page_comments_output">
  49. <?php echo $_page_comments_output; ?>
  50. </div>
  51. <?php
  52. } // end commentable post/page check
  53. // show all comments from site if we can
  54. if ( $_all_comments_output != '' ) {
  55. ?><h3 class="activity_heading"><?php echo $_all_comments_title; ?></h3>
  56. <div class="paragraph_wrapper all_comments_output">
  57. <?php echo $_all_comments_output; ?>
  58. </div>
  59. <?php
  60. } // end comments from site check
  61. /*
  62. --------------------------------------------------------------------------------
  63. This seems not to work because BP returns no values for the combination we want
  64. --------------------------------------------------------------------------------
  65. NOTE: raise a ticket on BP
  66. --------------------------------------------------------------------------------
  67. Also, need to make this kind of include file properly child-theme adaptable
  68. --------------------------------------------------------------------------------
  69. // access plugin
  70. global $commentpress_core, $post;
  71. // if we have the plugin enabled and it's BP
  72. if (
  73. is_multisite()
  74. AND is_object( $commentpress_core )
  75. AND $commentpress_core->is_buddypress()
  76. AND $commentpress_core->is_groupblog()
  77. ) {
  78. // check if this blog is a group blog...
  79. $group_id = get_groupblog_group_id( get_current_blog_id() );
  80. //print_r( $group_id ); die();
  81. // when this blog is a groupblog
  82. if ( !empty( $group_id ) ) {
  83. // get activities for our activities
  84. if ( bp_has_activities( array(
  85. // NO RESULTS!
  86. 'object' => 'groups',
  87. 'action' => 'new_groupblog_comment,new_groupblog_post',
  88. 'primary_id' => $group_id
  89. 'secondary_id' => $post_id
  90. ) ) ) : ?>
  91. <h3 class="activity_heading">Recent Activity in this Workshop</h3>
  92. <div class="paragraph_wrapper">
  93. <ol class="comment_activity">
  94. <?php while ( bp_activities() ) : bp_the_activity(); ?>
  95. <?php locate_template( array( 'activity/groupblog.php' ), true, false ); ?>
  96. <?php endwhile; ?>
  97. </ol>
  98. </div>
  99. <?php
  100. endif;
  101. }
  102. } // end BP check
  103. */
  104. ?>
  105. <?php
  106. // access plugin
  107. global $commentpress_core, $post, $blog_id;
  108. // if we have the plugin enabled and it's BP
  109. if (
  110. // test for multisite buddypress
  111. is_multisite() AND
  112. is_object( $commentpress_core ) AND
  113. $commentpress_core->is_buddypress() AND
  114. // either groupblog or main BP blog
  115. ( $commentpress_core->is_groupblog() OR BP_ROOT_BLOG == $blog_id )
  116. ) {
  117. // get activities
  118. if ( bp_has_activities( array(
  119. 'scope' => 'groups',
  120. 'action' => 'new_groupblog_comment,new_groupblog_post',
  121. ) ) ) :
  122. // change header depending on logged in status
  123. if ( is_user_logged_in() ) {
  124. // set default
  125. $_section_header_text = apply_filters(
  126. 'cp_activity_tab_recent_title_all_yours',
  127. __( 'Recent Activity in your Documents', 'commentpress-core' )
  128. );
  129. } else {
  130. // set default
  131. $_section_header_text = apply_filters(
  132. 'cp_activity_tab_recent_title_all_public',
  133. __( 'Recent Activity in Public Documents', 'commentpress-core' )
  134. );
  135. } ?>
  136. <h3 class="activity_heading"><?php echo $_section_header_text; ?></h3>
  137. <div class="paragraph_wrapper workshop_comments_output">
  138. <ol class="comment_activity">
  139. <?php while ( bp_activities() ) : bp_the_activity(); ?>
  140. <?php locate_template( array( 'activity/groupblog.php' ), true, false ); ?>
  141. <?php endwhile; ?>
  142. </ol>
  143. </div>
  144. <?php endif; ?>
  145. <?php
  146. // get recently active members
  147. if ( bp_has_members(
  148. 'user_id=0'.
  149. '&type=active'.
  150. '&per_page='.$_max_members.
  151. '&max='.$_max_members.
  152. '&populate_extras=0'
  153. ) ) : ?>
  154. <h3 class="activity_heading">Recently Active Members</h3>
  155. <div class="paragraph_wrapper active_members_output">
  156. <ul class="item-list cp-recently-active">
  157. <?php while ( bp_members() ) : bp_the_member(); ?>
  158. <li>
  159. <div class="item-avatar">
  160. <a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar(); ?></a>
  161. </div>
  162. <div class="item">
  163. <div class="item-title">
  164. <a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>
  165. <?php if ( bp_get_member_latest_update() ) : ?>
  166. <span class="update"> <?php bp_member_latest_update(); ?></span>
  167. <?php endif; ?>
  168. </div>
  169. <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
  170. <?php do_action( 'bp_directory_members_item' ); ?>
  171. <?php
  172. /***
  173. * If you want to show specific profile fields here you can,
  174. * but it'll add an extra query for each member in the loop
  175. * (only one regardless of the number of fields you show):
  176. *
  177. * bp_member_profile_data( 'field=the field name' );
  178. */
  179. ?>
  180. </div>
  181. <div class="clear"></div>
  182. </li>
  183. <?php endwhile; ?>
  184. </ul>
  185. </div>
  186. <?php endif; ?>
  187. <?php
  188. // get online members
  189. if ( bp_has_members(
  190. 'user_id=0'.
  191. '&type=online'.
  192. '&per_page='.$_max_members.
  193. '&max='.$_max_members.
  194. '&populate_extras=0'
  195. ) ) : ?>
  196. <h3 class="activity_heading">Who's Online</h3>
  197. <div class="paragraph_wrapper online_members_output">
  198. <ul class="item-list cp-online-members">
  199. <?php while ( bp_members() ) : bp_the_member(); ?>
  200. <li>
  201. <div class="item-avatar">
  202. <a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar(); ?></a>
  203. </div>
  204. <div class="item">
  205. <div class="item-title">
  206. <a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>
  207. <?php if ( bp_get_member_latest_update() ) : ?>
  208. <span class="update"> <?php bp_member_latest_update(); ?></span>
  209. <?php endif; ?>
  210. </div>
  211. <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
  212. <?php do_action( 'bp_directory_members_item' ); ?>
  213. <?php
  214. /***
  215. * If you want to show specific profile fields here you can,
  216. * but it'll add an extra query for each member in the loop
  217. * (only one regardless of the number of fields you show):
  218. *
  219. * bp_member_profile_data( 'field=the field name' );
  220. */
  221. ?>
  222. </div>
  223. <div class="clear"></div>
  224. </li>
  225. <?php endwhile; ?>
  226. </ul>
  227. </div>
  228. <?php endif; ?>
  229. <?php
  230. } // end BP check
  231. ?>
  232. <?php
  233. /*
  234. // prepare for ShareThis integration
  235. if ( function_exists( 'sharethis_button' ) ) {
  236. // wrap in identifier
  237. echo '<h3 class="activity_heading">Share with ShareThis</h3>';
  238. echo '<div class="paragraph_wrapper">';
  239. echo '<p class="cp_share_this_buttons" style="padding: 10px 18px;">';
  240. sharethis_button();
  241. echo '</p>';
  242. echo '</div>';
  243. }
  244. */
  245. ?>
  246. </div><!-- /comments_container -->
  247. </div><!-- /sidebar_contents_wrapper -->
  248. </div><!-- /sidebar_minimiser -->
  249. </div><!-- /activity_sidebar -->