Skip to:
Content

BuddyPress.org

Changeset 9493


Ignore:
Timestamp:
02/17/2015 06:59:02 AM (11 years ago)
Author:
tw2113
Message:

Adds hooks documentation to class-bp-groups-group.php.

See #5943.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/classes/class-bp-groups-group.php

    r9486 r9493  
    214214                if ( ! empty( $this->args['populate_extras'] ) ) {
    215215
    216                         // Get group admins and mods
     216                        /**
     217                         * Filters the SQL prepared statement used to fetch group admins and mods.
     218                         *
     219                         * @since BuddyPress (1.5.0)
     220                         *
     221                         * @param string $value SQL select statement used to fetch admins and mods.
     222                         */
    217223                        $admin_mods = $wpdb->get_results( apply_filters( 'bp_group_admin_mods_user_join_filter', $wpdb->prepare( "SELECT u.ID as user_id, u.user_login, u.user_email, u.user_nicename, m.is_admin, m.is_mod FROM {$wpdb->users} u, {$bp->groups->table_name_members} m WHERE u.ID = m.user_id AND m.group_id = %d AND ( m.is_admin = 1 OR m.is_mod = 1 )", $this->id ) ) );
    218224
     
    271277                $this->date_created = apply_filters( 'groups_group_date_created_before_save', $this->date_created, $this->id );
    272278
     279                /**
     280                 * Fires before the current group item gets saved.
     281                 *
     282                 * Please use this hook to filter the properties above. Each part will be passed in.
     283                 *
     284                 * @since BuddyPress (1.0.0)
     285                 *
     286                 * @param BP_Groups_Group Current instance of the group item being saved. Passed by reference.
     287                 */
    273288                do_action_ref_array( 'groups_group_before_save', array( &$this ) );
    274289
     
    344359                        $this->id = $wpdb->insert_id;
    345360
     361                /**
     362                 * Fires after the current group item has been saved.
     363                 *
     364                 * @since BuddyPress (1.0.0)
     365                 *
     366                 * @param BP_Groups_Group Current instance of the group item that was saved. Passed by reference.
     367                 */
    346368                do_action_ref_array( 'groups_group_after_save', array( &$this ) );
    347369
     
    372394                BP_Groups_Member::delete_all( $this->id );
    373395
     396                /**
     397                 * Fires before the deletion of a group.
     398                 *
     399                 * @since BuddyPress (1.2.0)
     400                 *
     401                 * @param BP_Groups_Group $this     Current instance of the group item being deleted. Passed by reference.
     402                 * @param array           $user_ids Array of user IDs that were members of the group.
     403                 */
    374404                do_action_ref_array( 'bp_groups_delete_group', array( &$this, $user_ids ) );
    375405
     
    769799                // 'order' and 'orderby' params passed to the function
    770800                if (  ! empty( $r['type'] ) ) {
     801
     802                        /**
     803                         * Filters the 'type' parameter used to overwrite 'order' and 'orderby' values.
     804                         *
     805                         * @since BuddyPress (2.1.0)
     806                         *
     807                         * @param array  $value Converted 'type' value for order and orderby.
     808                         * @param string $value Parsed 'type' value for the get method.
     809                         */
    771810                        $order_orderby = apply_filters( 'bp_groups_get_orderby', self::convert_type_to_order_orderby( $r['type'] ), $r['type'] );
    772811
     
    786825                $order = bp_esc_sql_order( $order );
    787826
    788                 // Convert 'orderby' into the proper ORDER BY term
     827                /**
     828                 * Filters the converted 'orderby' term.
     829                 *
     830                 * @since BuddyPress (2.1.0)
     831                 *
     832                 * @param string $value   Converted 'orderby' term.
     833                 * @param string $orderby Original orderby value.
     834                 * @param string $value   Parsed 'type' value for the get method.
     835                 */
    789836                $orderby = apply_filters( 'bp_groups_get_orderby_converted_by_term', self::convert_orderby_to_order_by_term( $orderby ), $orderby, $r['type'] );
    790837
     
    800847                }
    801848
    802                 // Get paginated results
     849                /**
     850                 * Filters the pagination SQL statement.
     851                 *
     852                 * @since BuddyPress (1.5.0)
     853                 *
     854                 * @param string $value Concatenated SQL statement.
     855                 * @param array  $sql   Array of SQL parts before concatenation.
     856                 * @param array  $r     Array of parsed arguments for the get method.
     857                 */
    803858                $paged_groups_sql = apply_filters( 'bp_groups_get_paged_groups_sql', join( ' ', (array) $sql ), $sql, $r );
    804859                $paged_groups     = $wpdb->get_results( $paged_groups_sql );
     
    852907                }
    853908
    854                 // Get total group results
     909                /**
     910                 * Filters the SQL used to retrieve total group results.
     911                 *
     912                 * @since BuddyPress (1.5.0)
     913                 *
     914                 * @param string $t_sql     Concatenated SQL statement used for retrieving total group results.
     915                 * @param array  $total_sql Array of SQL parts for the query.
     916                 * @param array  $r         Array of parsed arguments for the get method.
     917                 */
    855918                $total_groups_sql = apply_filters( 'bp_groups_get_total_groups_sql', $t_sql, $total_sql, $r );
    856919                $total_groups     = $wpdb->get_var( $total_groups_sql );
     
    10371100                global $wpdb, $bbdb;
    10381101
    1039                 if ( empty( $bbdb ) )
     1102                if ( empty( $bbdb ) ) {
     1103
     1104                        /** This action is documented in bp-forums/bp-forums-screens */
    10401105                        do_action( 'bbpress_init' );
     1106                }
    10411107
    10421108                if ( !empty( $limit ) && !empty( $page ) ) {
     
    11031169                global $wpdb, $bbdb;
    11041170
    1105                 if ( empty( $bbdb ) )
     1171                if ( empty( $bbdb ) ) {
     1172
     1173                        /** This action is documented in bp-forums/bp-forums-screens */
    11061174                        do_action( 'bbpress_init' );
     1175                }
    11071176
    11081177                if ( !empty( $limit ) && !empty( $page ) ) {
     
    14121481                        $bp->groups->filter_sql = ' AND t.topic_posts = 1';
    14131482
    1414                 // https://buddypress.trac.wordpress.org/ticket/4306
     1483                /**
     1484                 * Filters the portion of the SQL related to global count of forum topics in public groups.
     1485                 *
     1486                 * https://buddypress.trac.wordpress.org/ticket/4306.
     1487                 *
     1488                 * @since BuddyPress (1.6.0)
     1489                 *
     1490                 * @param string $filter_sql SQL portion for the query.
     1491                 * @param string $type       Type of forum topics to query for.
     1492                 */
    14151493                $extra_sql = apply_filters( 'get_global_forum_topic_count_extra_sql', $bp->groups->filter_sql, $type );
    14161494
Note: See TracChangeset for help on using the changeset viewer.