Changeset 4554
- Timestamp:
- 12/07/2012 09:11:46 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/includes/extend/buddypress/group.php
r4545 r4554 32 32 */ 33 33 public function __construct() { 34 $this->setup_variables(); 35 $this->setup_actions(); 36 $this->setup_filters(); 37 $this->maybe_unset_forum_menu(); 38 } 39 40 /** 41 * Setup the group forums class variables 42 * 43 * @since bbPress () 44 */ 45 private function setup_variables() { 34 46 35 47 // Name and slug … … 55 67 $this->template_file = 'groups/single/plugins'; 56 68 $this->display_hook = 'bp_template_content'; 57 58 // Add handlers to bp_actions 59 add_action( 'bp_actions', 'bbp_new_forum_handler' );60 add_action( 'bp_actions', 'bbp_new_topic_handler' );61 add_action( 'bp_actions', 'bbp_new_reply_handler' );62 add_action( 'bp_actions', 'bbp_edit_forum_handler' );63 add_action( 'bp_actions', 'bbp_edit_topic_handler' );64 add_action( 'bp_actions', 'bbp_edit_reply_handler' );69 } 70 71 /** 72 * Setup the group forums class actions 73 * 74 * @since bbPress (r4552) 75 */ 76 private function setup_actions() { 65 77 66 78 // Possibly redirect 67 add_action( 'bbp_template_redirect', array( $this, 'redirect_canonical' ) ); 79 add_action( 'bbp_template_redirect', array( $this, 'redirect_canonical' ) ); 80 81 // Remove topic cap map when view is done 82 add_action( 'bbp_after_group_forum_display', array( $this, 'remove_topic_meta_cap_map' ) ); 83 } 84 85 /** 86 * Setup the group forums class filters 87 * 88 * @since bbPress (r4552) 89 */ 90 private function setup_filters() { 68 91 69 92 // Group forum pagination … … 92 115 add_filter( 'bbp_map_reply_meta_caps', array( $this, 'map_topic_meta_caps' ), 10, 4 ); 93 116 94 // Remove topic cap map when view is done95 add_action( 'bbp_after_group_forum_display', array( $this, 'remove_topic_meta_cap_map' ) );96 97 117 // Map group forum activity items to groups 98 118 add_filter( 'bbp_before_record_activity_parse_args', array( $this, 'map_activity_to_group' ) ); … … 121 141 122 142 $this->display_forums( 0 ); 143 } 144 145 /** 146 * Maybe unset the group forum nav item if group does not have a forum 147 * 148 * @since bbPress (r4552) 149 * 150 * @return If not viewing a single group 151 */ 152 public function maybe_unset_forum_menu() { 153 154 // Bail if not viewing a single group 155 if ( ! bp_is_group() ) 156 return; 157 158 // Are forums enabled for this group? 159 $checked = (bool) ( bp_get_new_group_enable_forum() ); 160 161 // Tweak the nav item variable based on if group has forum or not 162 $this->enable_nav_item = $checked; 123 163 } 124 164 … … 578 618 579 619 bbp_set_query_name( 'bbp_forum_form' ); 580 581 620 bbp_get_template_part( 'form', 'forum' ); 582 621 … … 632 671 if ( !empty( $_GET['action'] ) && 'merge' == $_GET['action'] ) : 633 672 bbp_set_query_name( 'bbp_topic_merge' ); 634 635 673 bbp_get_template_part( 'form', 'topic-merge' ); 636 674 … … 638 676 elseif ( !empty( $_GET['action'] ) && 'split' == $_GET['action'] ) : 639 677 bbp_set_query_name( 'bbp_topic_split' ); 640 641 678 bbp_get_template_part( 'form', 'topic-split' ); 642 679 … … 650 687 // Single Topic 651 688 else: 652 653 689 bbp_set_query_name( 'bbp_single_topic' ); ?> 654 690
Note: See TracChangeset
for help on using the changeset viewer.