Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/22/2015 04:58:34 AM (5 years ago)
Author:
tw2113
Message:

More docs cleanup for BP-Groups component.

See #6401.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-filters.php

    r10184 r10373  
    1010defined( 'ABSPATH' ) || exit;
    1111
    12 // Filter bbPress template locations
    13 
     12// Filter bbPress template locations.
    1413add_filter( 'bp_groups_get_directory_template', 'bp_add_template_locations' );
    1514add_filter( 'bp_get_single_group_template',    'bp_add_template_locations' );
     
    5150add_filter( 'groups_group_description_before_save', 'force_balance_tags' );
    5251
    53 // Trim trailing spaces from name and description when saving
     52// Trim trailing spaces from name and description when saving.
    5453add_filter( 'groups_group_name_before_save',        'trim' );
    5554add_filter( 'groups_group_description_before_save', 'trim' );
    5655
    57 // Escape output of new group creation details
     56// Escape output of new group creation details.
    5857add_filter( 'bp_get_new_group_id',          'esc_attr'     );
    5958add_filter( 'bp_get_new_group_name',        'esc_attr'     );
    6059add_filter( 'bp_get_new_group_description', 'esc_textarea' );
    6160
    62 // Format numberical output
     61// Format numberical output.
    6362add_filter( 'bp_get_total_group_count',          'bp_core_number_format' );
    6463add_filter( 'bp_get_group_total_for_member',     'bp_core_number_format' );
     
    7170 * @since 1.1.0
    7271 *
    73  * @param string $content
    74  *
     72 * @param string $content Content to filter.
    7573 * @return string
    7674 */
     
    8785    $allowed_tags = wp_kses_allowed_html( 'buddypress-groups' );
    8886
    89     // Add our own tags allowed in group descriptions
     87    // Add our own tags allowed in group descriptions.
    9088    $allowed_tags['a']['class']    = array();
    9189    $allowed_tags['img']           = array();
     
    107105    $tags = apply_filters( 'bp_groups_filter_kses', $allowed_tags );
    108106
    109     // Return KSES'ed content, allowing the above tags
     107    // Return KSES'ed content, allowing the above tags.
    110108    return wp_kses( $content, $tags );
    111109}
     
    126124 * Add fields to bbPress query for group-specific data.
    127125 *
    128  * @param string $sql
    129  *
     126 * @param string $sql SQL statement to amend.
    130127 * @return string
    131128 */
     
    138135 * Add JOINed tables to bbPress query for group-specific data.
    139136 *
    140  * @param string $sql
    141  *
     137 * @param string $sql SQL statement to amend.
    142138 * @return string
    143139 */
     
    153149 * Add WHERE clauses to bbPress query for group-specific data and access protection.
    154150 *
    155  * @param string $sql
     151 * @param string $sql SQL Statement to amend.
    156152 *
    157153 * @return string
     
    159155function groups_add_forum_where_sql( $sql = '' ) {
    160156
    161     // Define locale variable
     157    // Define locale variable.
    162158    $parts = array();
    163159
    164     // Set this for groups
     160    // Set this for groups.
    165161    $parts['groups'] = "(gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id)";
    166162
     
    173169     * Decide if private are visible
    174170     */
     171
    175172    // Are we in our own profile?
    176173    if ( bp_is_my_profile() )
     
    181178        unset( $parts['private'] );
    182179
    183     // No need to filter on a single item
     180    // No need to filter on a single item.
    184181    elseif ( bp_is_single_item() )
    185182        unset( $parts['private'] );
    186183
    187     // Check the SQL filter that was passed
     184    // Check the SQL filter that was passed.
    188185    if ( !empty( $sql ) )
    189186        $parts['passed'] = $sql;
    190187
    191     // Assemble Voltron
     188    // Assemble Voltron.
    192189    $parts_string = implode( ' AND ', $parts );
    193190
    194191    $bp = buddypress();
    195192
    196     // Set it to the global filter
     193    // Set it to the global filter.
    197194    $bp->groups->filter_sql = $parts_string;
    198195
    199     // Return the global filter
     196    // Return the global filter.
    200197    return $bp->groups->filter_sql;
    201198}
     
    204201 * Modify bbPress caps for bp-forums.
    205202 *
    206  * @param bool $value
    207  * @param string $cap
    208  * @param array $args
     203 * @param bool   $value Original value for current_user_can check.
     204 * @param string $cap   Capability checked.
     205 * @param array  $args  Arguments for the caps.
    209206 *
    210207 * @return bool
     
    238235 *
    239236 * @see BB_Query::_filter_sql()
     237 *
     238 * @param string $sql SQL statement.
     239 * @return string
    240240 */
    241241function groups_filter_forums_root_page_sql( $sql ) {
     
    262262 * @param bool $load_mentions    True to load mentions assets, false otherwise.
    263263 * @param bool $mentions_enabled True if mentions are enabled.
    264  *
    265264 * @return bool True if mentions scripts should be loaded.
    266265 */
Note: See TracChangeset for help on using the changeset viewer.