Changeset 10373 for trunk/src/bp-groups/bp-groups-filters.php
- Timestamp:
- 11/22/2015 04:58:34 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-filters.php
r10184 r10373 10 10 defined( 'ABSPATH' ) || exit; 11 11 12 // Filter bbPress template locations 13 12 // Filter bbPress template locations. 14 13 add_filter( 'bp_groups_get_directory_template', 'bp_add_template_locations' ); 15 14 add_filter( 'bp_get_single_group_template', 'bp_add_template_locations' ); … … 51 50 add_filter( 'groups_group_description_before_save', 'force_balance_tags' ); 52 51 53 // Trim trailing spaces from name and description when saving 52 // Trim trailing spaces from name and description when saving. 54 53 add_filter( 'groups_group_name_before_save', 'trim' ); 55 54 add_filter( 'groups_group_description_before_save', 'trim' ); 56 55 57 // Escape output of new group creation details 56 // Escape output of new group creation details. 58 57 add_filter( 'bp_get_new_group_id', 'esc_attr' ); 59 58 add_filter( 'bp_get_new_group_name', 'esc_attr' ); 60 59 add_filter( 'bp_get_new_group_description', 'esc_textarea' ); 61 60 62 // Format numberical output 61 // Format numberical output. 63 62 add_filter( 'bp_get_total_group_count', 'bp_core_number_format' ); 64 63 add_filter( 'bp_get_group_total_for_member', 'bp_core_number_format' ); … … 71 70 * @since 1.1.0 72 71 * 73 * @param string $content 74 * 72 * @param string $content Content to filter. 75 73 * @return string 76 74 */ … … 87 85 $allowed_tags = wp_kses_allowed_html( 'buddypress-groups' ); 88 86 89 // Add our own tags allowed in group descriptions 87 // Add our own tags allowed in group descriptions. 90 88 $allowed_tags['a']['class'] = array(); 91 89 $allowed_tags['img'] = array(); … … 107 105 $tags = apply_filters( 'bp_groups_filter_kses', $allowed_tags ); 108 106 109 // Return KSES'ed content, allowing the above tags 107 // Return KSES'ed content, allowing the above tags. 110 108 return wp_kses( $content, $tags ); 111 109 } … … 126 124 * Add fields to bbPress query for group-specific data. 127 125 * 128 * @param string $sql 129 * 126 * @param string $sql SQL statement to amend. 130 127 * @return string 131 128 */ … … 138 135 * Add JOINed tables to bbPress query for group-specific data. 139 136 * 140 * @param string $sql 141 * 137 * @param string $sql SQL statement to amend. 142 138 * @return string 143 139 */ … … 153 149 * Add WHERE clauses to bbPress query for group-specific data and access protection. 154 150 * 155 * @param string $sql 151 * @param string $sql SQL Statement to amend. 156 152 * 157 153 * @return string … … 159 155 function groups_add_forum_where_sql( $sql = '' ) { 160 156 161 // Define locale variable 157 // Define locale variable. 162 158 $parts = array(); 163 159 164 // Set this for groups 160 // Set this for groups. 165 161 $parts['groups'] = "(gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id)"; 166 162 … … 173 169 * Decide if private are visible 174 170 */ 171 175 172 // Are we in our own profile? 176 173 if ( bp_is_my_profile() ) … … 181 178 unset( $parts['private'] ); 182 179 183 // No need to filter on a single item 180 // No need to filter on a single item. 184 181 elseif ( bp_is_single_item() ) 185 182 unset( $parts['private'] ); 186 183 187 // Check the SQL filter that was passed 184 // Check the SQL filter that was passed. 188 185 if ( !empty( $sql ) ) 189 186 $parts['passed'] = $sql; 190 187 191 // Assemble Voltron 188 // Assemble Voltron. 192 189 $parts_string = implode( ' AND ', $parts ); 193 190 194 191 $bp = buddypress(); 195 192 196 // Set it to the global filter 193 // Set it to the global filter. 197 194 $bp->groups->filter_sql = $parts_string; 198 195 199 // Return the global filter 196 // Return the global filter. 200 197 return $bp->groups->filter_sql; 201 198 } … … 204 201 * Modify bbPress caps for bp-forums. 205 202 * 206 * @param bool $value207 * @param string $cap 208 * @param array $args203 * @param bool $value Original value for current_user_can check. 204 * @param string $cap Capability checked. 205 * @param array $args Arguments for the caps. 209 206 * 210 207 * @return bool … … 238 235 * 239 236 * @see BB_Query::_filter_sql() 237 * 238 * @param string $sql SQL statement. 239 * @return string 240 240 */ 241 241 function groups_filter_forums_root_page_sql( $sql ) { … … 262 262 * @param bool $load_mentions True to load mentions assets, false otherwise. 263 263 * @param bool $mentions_enabled True if mentions are enabled. 264 *265 264 * @return bool True if mentions scripts should be loaded. 266 265 */
Note: See TracChangeset
for help on using the changeset viewer.