Changeset 4553
- Timestamp:
- 12/07/2012 09:09:10 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/extend/buddypress/group.php
r4551 r4553 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'; 69 } 70 71 /** 72 * Setup the group forums class actions 73 * 74 * @since bbPress (r4552) 75 */ 76 private function setup_actions() { 57 77 58 78 // Possibly redirect 59 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() { 60 91 61 92 // Group forum pagination … … 84 115 add_filter( 'bbp_map_reply_meta_caps', array( $this, 'map_topic_meta_caps' ), 10, 4 ); 85 116 86 // Remove topic cap map when view is done87 add_action( 'bbp_after_group_forum_display', array( $this, 'remove_topic_meta_cap_map' ) );88 89 117 // Map group forum activity items to groups 90 118 add_filter( 'bbp_before_record_activity_parse_args', array( $this, 'map_activity_to_group' ) ); … … 113 141 114 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; 115 163 } 116 164
Note: See TracChangeset
for help on using the changeset viewer.