/bp-themes/bp-default/forums/index.php

  1. <?php 
  2.  
  3. /** 
  4. * BuddyPress - Forums Directory 
  5. * 
  6. * @package BuddyPress 
  7. * @subpackage bp-default 
  8. */ 
  9.  
  10. ?> 
  11.  
  12. <?php get_header( 'buddypress' ); ?> 
  13.  
  14. <?php do_action( 'bp_before_directory_forums_page' ); ?> 
  15.  
  16. <div id="content"> 
  17. <div class="padder"> 
  18.  
  19. <?php do_action( 'bp_before_directory_forums' ); ?> 
  20.  
  21. <form action="" method="post" id="forums-search-form" class="dir-form"> 
  22.  
  23. <h3><?php _e( 'Forums Directory', 'buddypress' ); ?><?php if ( is_user_logged_in() ) : ?>  <a class="button show-hide-new" href="#new-topic" id="new-topic-button"><?php _e( 'New Topic', 'buddypress' ); ?></a><?php endif; ?></h3> 
  24.  
  25. <?php do_action( 'bp_before_directory_forums_content' ); ?> 
  26.  
  27. <div id="forums-dir-search" class="dir-search" role="search"> 
  28.  
  29. <?php bp_directory_forums_search_form(); ?> 
  30.  
  31. </div> 
  32. </form> 
  33.  
  34. <?php do_action( 'bp_before_topics' ); ?> 
  35.  
  36. <form action="" method="post" id="forums-directory-form" class="dir-form"> 
  37.  
  38. <div class="item-list-tabs" role="navigation"> 
  39. <ul> 
  40. <li class="selected" id="forums-all"><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() ); ?>"><?php printf( __( 'All Topics <span>%s</span>', 'buddypress' ), bp_get_forum_topic_count() ); ?></a></li> 
  41.  
  42. <?php if ( is_user_logged_in() && bp_get_forum_topic_count_for_user( bp_loggedin_user_id() ) ) : ?> 
  43.  
  44. <li id="forums-personal"><a href="<?php echo trailingslashit( bp_loggedin_user_domain() . bp_get_forums_slug() . '/topics' ); ?>"><?php printf( __( 'My Topics <span>%s</span>', 'buddypress' ), bp_get_forum_topic_count_for_user( bp_loggedin_user_id() ) ); ?></a></li> 
  45.  
  46. <?php endif; ?> 
  47.  
  48. <?php do_action( 'bp_forums_directory_group_types' ); ?> 
  49.  
  50. </ul> 
  51. </div> 
  52.  
  53. <div class="item-list-tabs" id="subnav" role="navigation"> 
  54. <ul> 
  55.  
  56. <?php do_action( 'bp_forums_directory_group_sub_types' ); ?> 
  57.  
  58. <li id="forums-order-select" class="last filter"> 
  59.  
  60. <label for="forums-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label> 
  61. <select id="forums-order-by"> 
  62. <option value="active"><?php _e( 'Last Active', 'buddypress' ); ?></option> 
  63. <option value="popular"><?php _e( 'Most Posts', 'buddypress' ); ?></option> 
  64. <option value="unreplied"><?php _e( 'Unreplied', 'buddypress' ); ?></option> 
  65.  
  66. <?php do_action( 'bp_forums_directory_order_options' ); ?> 
  67.  
  68. </select> 
  69. </li> 
  70. </ul> 
  71. </div> 
  72.  
  73. <div id="forums-dir-list" class="forums dir-list" role="main"> 
  74.  
  75. <?php locate_template( array( 'forums/forums-loop.php' ), true ); ?> 
  76.  
  77. </div> 
  78.  
  79. <?php do_action( 'bp_directory_forums_content' ); ?> 
  80.  
  81. <?php wp_nonce_field( 'directory_forums', '_wpnonce-forums-filter' ); ?> 
  82.  
  83. </form> 
  84.  
  85. <?php do_action( 'bp_after_directory_forums' ); ?> 
  86.  
  87. <?php do_action( 'bp_before_new_topic_form' ); ?> 
  88.  
  89. <div id="new-topic-post"> 
  90.  
  91. <?php if ( is_user_logged_in() ) : ?> 
  92.  
  93. <?php if ( bp_is_active( 'groups' ) && bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100' ) ) : ?> 
  94.  
  95. <form action="" method="post" id="forum-topic-form" class="standard-form"> 
  96.  
  97. <?php do_action( 'groups_forum_new_topic_before' ); ?> 
  98.  
  99. <a name="post-new"></a> 
  100. <h5><?php _e( 'Create New Topic:', 'buddypress' ); ?></h5> 
  101.  
  102. <?php do_action( 'template_notices' ); ?> 
  103.  
  104. <label><?php _e( 'Title:', 'buddypress' ); ?></label> 
  105. <input type="text" name="topic_title" id="topic_title" value="" maxlength="100" /> 
  106.  
  107. <label><?php _e( 'Content:', 'buddypress' ); ?></label> 
  108. <textarea name="topic_text" id="topic_text"></textarea> 
  109.  
  110. <label><?php _e( 'Tags (comma separated):', 'buddypress' ); ?></label> 
  111. <input type="text" name="topic_tags" id="topic_tags" value="" /> 
  112.  
  113. <label><?php _e( 'Post In Group Forum:', 'buddypress' ); ?></label> 
  114. <select id="topic_group_id" name="topic_group_id"> 
  115.  
  116. <option value=""><?php /** translators: no option picked in select box */ _e( '----', 'buddypress' ); ?></option> 
  117.  
  118. <?php while ( bp_groups() ) : bp_the_group(); ?> 
  119.  
  120. <?php if ( bp_group_is_forum_enabled() && ( bp_current_user_can( 'bp_moderate' ) || 'public' == bp_get_group_status() || bp_group_is_member() ) ) : ?> 
  121.  
  122. <option value="<?php bp_group_id(); ?>"><?php bp_group_name(); ?></option> 
  123.  
  124. <?php endif; ?> 
  125.  
  126. <?php endwhile; ?> 
  127.  
  128. </select><!-- #topic_group_id --> 
  129.  
  130. <?php do_action( 'groups_forum_new_topic_after' ); ?> 
  131.  
  132. <div class="submit"> 
  133. <input type="submit" name="submit_topic" id="submit" value="<?php esc_attr_e( 'Post Topic', 'buddypress' ); ?>" /> 
  134. <input type="button" name="submit_topic_cancel" id="submit_topic_cancel" value="<?php esc_attr_e( 'Cancel', 'buddypress' ); ?>" /> 
  135. </div> 
  136.  
  137. <?php wp_nonce_field( 'bp_forums_new_topic' ); ?> 
  138.  
  139. </form><!-- #forum-topic-form --> 
  140.  
  141. <?php elseif ( bp_is_active( 'groups' ) ) : ?> 
  142.  
  143. <div id="message" class="info"> 
  144.  
  145. <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' ), site_url( bp_get_groups_root_slug() . '/create/' ) ); ?></p> 
  146.  
  147. </div> 
  148.  
  149. <?php endif; ?> 
  150.  
  151. <?php endif; ?> 
  152. </div><!-- #new-topic-post --> 
  153.  
  154. <?php do_action( 'bp_after_new_topic_form' ); ?> 
  155.  
  156. <?php do_action( 'bp_after_directory_forums_content' ); ?> 
  157.  
  158. </div><!-- .padder --> 
  159. </div><!-- #content --> 
  160.  
  161. <?php do_action( 'bp_after_directory_forums_page' ); ?> 
  162.  
  163. <?php get_sidebar( 'buddypress' ); ?> 
  164. <?php get_footer( 'buddypress' ); ?> 
.