/bp-templates/bp-legacy/buddypress/forums/index.php

  1. <?php 
  2. /** 
  3. * BuddyPress - Forums 
  4. * 
  5. * @package BuddyPress 
  6. * @subpackage bp-legacy 
  7. */ 
  8.  
  9. ?> 
  10. <div id="buddypress"> 
  11.  
  12. <?php 
  13.  
  14. /** 
  15. * Fires at the start of the forums template. 
  16. * 
  17. * @since 1.5.0 
  18. */ 
  19. do_action( 'bp_before_directory_forums' ); ?> 
  20.  
  21. <form action="" method="post" id="forums-search-form" class="dir-form"> 
  22.  
  23. <?php 
  24.  
  25. /** 
  26. * Fires before the display of the forums content. 
  27. * 
  28. * @since 1.1.0 
  29. */ 
  30. do_action( 'bp_before_directory_forums_content' ); ?> 
  31.  
  32. <?php /** Backward compatibility for inline search form. Use template part instead. */ ?> 
  33. <?php if ( has_filter( 'bp_directory_forums_search_form' ) ) : ?> 
  34.  
  35. <div id="forums-dir-search" class="dir-search" role="search"> 
  36. <?php bp_directory_forums_search_form(); ?> 
  37. </div> 
  38.  
  39. <?php else: ?> 
  40.  
  41. <?php bp_get_template_part( 'common/search/dir-search-form' ); ?> 
  42.  
  43. <?php endif; ?> 
  44.  
  45. </form> 
  46.  
  47. <?php 
  48.  
  49. /** 
  50. * Fires before the display of the forum topics. 
  51. * 
  52. * @since 1.5.0 
  53. */ 
  54. do_action( 'bp_before_topics' ); ?> 
  55.  
  56. <form action="" method="post" id="forums-directory-form" class="dir-form"> 
  57.  
  58. <div class="item-list-tabs" aria-label="<?php esc_attr_e( 'Forums directory main navigation', 'buddypress' ); ?>" role="navigation"> 
  59. <ul> 
  60. <li class="selected" id="forums-all"><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() ); ?>"><?php printf( __( 'All Topics %s', 'buddypress' ), '<span>' . bp_get_forum_topic_count() . '</span>' ); ?></a></li> 
  61.  
  62. <?php if ( is_user_logged_in() && bp_get_forum_topic_count_for_user( bp_loggedin_user_id() ) ) : ?> 
  63.  
  64. <li id="forums-personal"><a href="<?php echo trailingslashit( bp_loggedin_user_domain() . bp_get_forums_slug() . '/topics' ); ?>"><?php printf( __( 'My Topics %s', 'buddypress' ), '<span>' . bp_get_forum_topic_count_for_user( bp_loggedin_user_id() ) . '</span>' ); ?></a></li> 
  65.  
  66. <?php endif; ?> 
  67.  
  68. <?php 
  69.  
  70. /** 
  71. * Fires inside the forum group types list. 
  72. * 
  73. * @since 1.2.0 
  74. */ 
  75. do_action( 'bp_forums_directory_group_types' ); ?> 
  76.  
  77. </ul> 
  78. </div> 
  79.  
  80. <div class="item-list-tabs" id="subnav" aria-label="<?php esc_attr_e( 'Forums secondary navigation', 'buddypress' ); ?>" role="navigation"> 
  81. <ul> 
  82.  
  83. <?php 
  84.  
  85. /** 
  86. * Fires inside the forum group sub-types list. 
  87. * 
  88. * @since 1.5.0 
  89. */ 
  90. do_action( 'bp_forums_directory_group_sub_types' ); ?> 
  91.  
  92. <li id="forums-order-select" class="last filter"> 
  93.  
  94. <label for="forums-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label> 
  95. <select id="forums-order-by"> 
  96. <option value="active"><?php _e( 'Last Active', 'buddypress' ); ?></option> 
  97. <option value="popular"><?php _e( 'Most Posts', 'buddypress' ); ?></option> 
  98. <option value="unreplied"><?php _e( 'Unreplied', 'buddypress' ); ?></option> 
  99.  
  100. <?php 
  101.  
  102. /** 
  103. * Fires inside the select input for forums order options. 
  104. * 
  105. * @since 1.2.0 
  106. */ 
  107. do_action( 'bp_forums_directory_order_options' ); ?> 
  108.  
  109. </select> 
  110. </li> 
  111. </ul> 
  112. </div> 
  113.  
  114. <div id="forums-dir-list" class="forums dir-list"> 
  115.  
  116. <?php bp_get_template_part( 'forums/forums-loop' ); ?> 
  117.  
  118. </div> 
  119.  
  120. <?php 
  121.  
  122. /** 
  123. * Fires and displays the forums content. 
  124. * 
  125. * @since 1.1.0 
  126. */ 
  127. do_action( 'bp_directory_forums_content' ); ?> 
  128.  
  129. <?php wp_nonce_field( 'directory_forums', '_wpnonce-forums-filter' ); ?> 
  130.  
  131. </form> 
  132.  
  133. <?php 
  134.  
  135. /** 
  136. * Fires after the display of the forums. 
  137. * 
  138. * @since 1.5.0 
  139. */ 
  140. do_action( 'bp_after_directory_forums' ); ?> 
  141.  
  142. <?php 
  143.  
  144. /** 
  145. * Fires before the display of the new topic form. 
  146. * 
  147. * @since 1.5.0 
  148. */ 
  149. do_action( 'bp_before_new_topic_form' ); ?> 
  150.  
  151. <div id="new-topic-post"> 
  152.  
  153. <?php if ( is_user_logged_in() ) : ?> 
  154.  
  155. <?php if ( bp_is_active( 'groups' ) && bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100' ) ) : ?> 
  156.  
  157. <form action="" method="post" id="forum-topic-form" class="standard-form"> 
  158.  
  159. <?php 
  160.  
  161. /** 
  162. * Fires inside the new topic form tag and before input display. 
  163. * 
  164. * @since 1.0.0 
  165. */ 
  166. do_action( 'groups_forum_new_topic_before' ); ?> 
  167.  
  168. <a name="post-new"></a> 
  169. <h5><?php _e( 'Create New Topic:', 'buddypress' ); ?></h5> 
  170.  
  171. <div id="template-notices" role="alert" aria-atomic="true"> 
  172. <?php 
  173.  
  174. /** This action is documented in bp-templates/bp-legacy/buddypress/activity/index.php */ 
  175. do_action( 'template_notices' ); ?> 
  176.  
  177. </div> 
  178.  
  179. <label for="topic_title"><?php _e( 'Title:', 'buddypress' ); ?></label> 
  180. <input type="text" name="topic_title" id="topic_title" value="" maxlength="100" /> 
  181.  
  182. <label for="topic_text"><?php _e( 'Content:', 'buddypress' ); ?></label> 
  183. <textarea name="topic_text" id="topic_text"></textarea> 
  184.  
  185. <label for="topic_tags"><?php _e( 'Tags (comma separated):', 'buddypress' ); ?></label> 
  186. <input type="text" name="topic_tags" id="topic_tags" value="" /> 
  187.  
  188. <label for="topic_group_id"><?php _e( 'Post In Group Forum:', 'buddypress' ); ?></label> 
  189. <select id="topic_group_id" name="topic_group_id"> 
  190.  
  191. <option value=""><?php /** translators: no option picked in select box */ _e( '----', 'buddypress' ); ?></option> 
  192.  
  193. <?php while ( bp_groups() ) : bp_the_group(); ?> 
  194.  
  195. <?php if ( bp_group_is_forum_enabled() && ( bp_current_user_can( 'bp_moderate' ) || 'public' == bp_get_group_status() || bp_group_is_member() ) ) : ?> 
  196.  
  197. <option value="<?php bp_group_id(); ?>"><?php bp_group_name(); ?></option> 
  198.  
  199. <?php endif; ?> 
  200.  
  201. <?php endwhile; ?> 
  202.  
  203. </select><!-- #topic_group_id --> 
  204.  
  205. <?php 
  206.  
  207. /** 
  208. * Fires before the new topic form submit actions. 
  209. * 
  210. * @since 1.0.0 
  211. */ 
  212. do_action( 'groups_forum_new_topic_after' ); ?> 
  213.  
  214. <div class="submit"> 
  215. <input type="submit" name="submit_topic" id="submit" value="<?php esc_attr_e( 'Post Topic', 'buddypress' ); ?>" /> 
  216. <input type="button" name="submit_topic_cancel" id="submit_topic_cancel" value="<?php esc_attr_e( 'Cancel', 'buddypress' ); ?>" /> 
  217. </div> 
  218.  
  219. <?php wp_nonce_field( 'bp_forums_new_topic' ); ?> 
  220.  
  221. </form><!-- #forum-topic-form --> 
  222.  
  223. <?php elseif ( bp_is_active( 'groups' ) ) : ?> 
  224.  
  225. <div id="message" class="info"> 
  226.  
  227. <p><?php printf( __( "You are not a member of any groups so you don't have any group forums you can post in. To start posting, first find a group that matches the topic subject you'd like to start. If this group does not exist, why not <a href='%s'>create a new group</a>? Once you have joined or created the group you can post your topic in that group's forum.", 'buddypress' ), trailingslashit( bp_get_groups_directory_permalink() . 'create' ) ); ?></p> 
  228.  
  229. </div> 
  230.  
  231. <?php endif; ?> 
  232.  
  233. <?php endif; ?> 
  234. </div><!-- #new-topic-post --> 
  235.  
  236. <?php 
  237.  
  238. /** 
  239. * Fires after the display of the new topic form. 
  240. * 
  241. * @since 1.5.0 
  242. */ 
  243. do_action( 'bp_after_new_topic_form' ); ?> 
  244.  
  245. <?php 
  246.  
  247. /** 
  248. * Fires before the display of the forums content. 
  249. * 
  250. * @since 1.1.0 
  251. */ 
  252. do_action( 'bp_after_directory_forums_content' ); ?> 
  253.  
  254. </div> 
.