Skip to:
Content

BuddyPress.org

Changeset 9487


Ignore:
Timestamp:
02/17/2015 05:16:34 AM (11 years ago)
Author:
tw2113
Message:

Adds hooks documentation to bp-groups-admin.php.

See #5943

File:
1 edited

Legend:

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

    r9466 r9487  
    8282        $doaction = bp_admin_list_table_current_bulk_action();
    8383
    84         // Call an action for plugins to hook in early
     84        /**
     85         * Fires at top of groups admin page.
     86         *
     87         * @since BuddyPress (1.7.0)
     88         *
     89         * @param string $doaction Current $_GET action being performed in admin screen.
     90         */
    8591        do_action( 'bp_groups_admin_load', $doaction );
    8692
     
    127133                add_meta_box( 'bp_group_members', _x( 'Manage Members', 'group admin edit screen', 'buddypress' ), 'bp_groups_admin_edit_metabox_members', get_current_screen()->id, 'normal', 'core' );
    128134
     135                /**
     136                 * Fires after the registration of all of the default group meta boxes.
     137                 *
     138                 * @since BuddyPress (1.7.0)
     139                 */
    129140                do_action( 'bp_groups_admin_meta_boxes' );
    130141
     
    226237                $enable_forum   = ( isset( $_POST['group-show-forum'] ) ) ? 1 : 0;
    227238
    228                 // Privacy setting
     239                /**
     240                 * Filters the allowed status values for the group.
     241                 *
     242                 * @since BuddyPress (1.0.2)
     243                 *
     244                 * @param array $value Array of allowed group statuses.
     245                 */
    229246                $allowed_status = apply_filters( 'groups_allowed_status', array( 'public', 'private', 'hidden' ) );
    230247                $status         = ( in_array( $_POST['group-status'], (array) $allowed_status ) ) ? $_POST['group-status'] : 'public';
    231248
    232249                // Invite status
     250                /**
     251                 * Filters the allowed invite status values for the group.
     252                 *
     253                 * @since BuddyPress (1.5.0)
     254                 *
     255                 * @param array $value Array of allowed invite statuses.
     256                 */
    233257                $allowed_invite_status = apply_filters( 'groups_allowed_invite_status', array( 'members', 'mods', 'admins' ) );
    234258                $invite_status         = in_array( $_POST['group-invite-status'], (array) $allowed_invite_status ) ? $_POST['group-invite-status'] : 'members';
     
    348372                }
    349373
    350                 // Call actions for plugins to do something before we redirect
     374                /**
     375                 * Fires before redirect so plugins can do something first on save action.
     376                 *
     377                 * @since BuddyPress (1.6.0)
     378                 *
     379                 * @param int $group_id ID of the group being edited.
     380                 */
    351381                do_action( 'bp_group_admin_edit_after', $group_id );
    352382
     
    381411                }
    382412
    383                 // Redirect
     413                /**
     414                 * Filters the URL to redirect to after successfully editing a group.
     415                 *
     416                 * @since BuddyPress (1.7.0)
     417                 *
     418                 * @param string $redirect_to URL to redirect user to.
     419                 */
    384420                wp_redirect( apply_filters( 'bp_group_admin_edit_redirect', $redirect_to ) );
    385421                exit;
     
    510546        // Get the group from the database
    511547        $group      = groups_get_group( 'group_id=' . $_GET['gid'] );
     548
     549        /** This filter is documented in bp-groups/bp-groups-template.php */
    512550        $group_name = isset( $group->name ) ? apply_filters( 'bp_get_group_name', $group->name ) : '';
    513551
     
    516554        $form_url = add_query_arg( 'action', 'save', $form_url );
    517555
    518         // Call an action for plugins to modify the group before we display the edit form
     556        /**
     557         * Fires before the display of the edit form.
     558         *
     559         * Useful for plugins to modify the group before display.
     560         *
     561         * @since BuddyPress (1.7.0)
     562         *
     563         * @param BP_Groups_Group Instance of the current group being edited. Passed by reference.
     564         */
    519565        do_action_ref_array( 'bp_groups_admin_edit', array( &$group ) ); ?>
    520566
     
    662708        $bp_groups_list_table->prepare_items();
    663709
    664         // Call an action for plugins to modify the messages before we display the edit form
     710        /**
     711         * Fires before the display of messages for the edit form.
     712         *
     713         * Useful for plugins to modify the messages before display.
     714         *
     715         * @since BuddyPress (1.7.0)
     716         *
     717         * @param array $messages Array of messages to be displayed.
     718         */
    665719        do_action( 'bp_groups_admin_index', $messages ); ?>
    666720
     
    876930                                                <tr>
    877931                                                        <td colspan="3">
    878                                                                 <?php do_action( 'bp_groups_admin_manage_member_row', $type_user->ID, $item ); ?>
     932                                                                <?php
     933
     934                                                                /**
     935                                                                 * Fires after the listing of a single row for members in a group on the group edit screen.
     936                                                                 *
     937                                                                 * @since BuddyPress (1.8.0)
     938                                                                 *
     939                                                                 * @param int             $ID   ID of the user being rendered.
     940                                                                 * @param BP_Groups_Group $item Object for the current group.
     941                                                                 */
     942                                                                do_action( 'bp_groups_admin_manage_member_row', $type_user->ID, $item ); ?>
    879943                                                        </td>
    880944                                                </tr>
     
    12761340                }
    12771341
     1342                /**
     1343                 * Filters the classes applied to a single row in the groups list table.
     1344                 *
     1345                 * @since BuddyPress (1.9.0)
     1346                 *
     1347                 * @param array  $row_classes Array of classes to apply to the row.
     1348                 * @param string $value       ID of the current group being displayed.
     1349                 */
    12781350                $row_classes = apply_filters( 'bp_groups_admin_row_class', $row_classes, $item['id'] );
    12791351                $row_class = ' class="' . implode( ' ', $row_classes ) . '"';
     
    13001372                        <li class="hidden"><a href="<?php echo esc_attr( esc_url( add_query_arg( 'group_status', 'hidden', $url_base ) ) ); ?>" class="<?php if ( 'hidden' == $this->view ) echo 'current'; ?>"><?php printf( _n( 'Hidden <span class="count">(%s)</span>', 'Hidden <span class="count">(%s)</span>', $this->group_counts['hidden'], 'buddypress' ), number_format_i18n( $this->group_counts['hidden'] ) ); ?></a></li>
    13011373
    1302                         <?php do_action( 'bp_groups_list_table_get_views', $url_base, $this->view ); ?>
     1374                        <?php
     1375
     1376                        /**
     1377                         * Fires inside listing of views so plugins can add their own.
     1378                         *
     1379                         * @since BuddyPress (1.7.0)
     1380                         *
     1381                         * @param string $url_base Current URL base for view.
     1382                         * @param string $view     Current view being displayed.
     1383                         */
     1384                        do_action( 'bp_groups_list_table_get_views', $url_base, $this->view ); ?>
    13031385                </ul>
    13041386        <?php
     
    13131395         */
    13141396        public function get_bulk_actions() {
     1397
     1398                /**
     1399                 * Filters the list of bulk actions to display on a single group row.
     1400                 *
     1401                 * @since BuddyPress (1.7.0)
     1402                 *
     1403                 * @param array $value Array of bulk actions to display.
     1404                 */
    13151405                return apply_filters( 'bp_groups_list_table_get_bulk_actions', array(
    13161406                        'delete' => __( 'Delete', 'buddypress' )
     
    13281418         */
    13291419        public function get_columns() {
     1420
     1421                /**
     1422                 * Filters the titles for the columns for the groups list table.
     1423                 *
     1424                 * @since BuddyPress (2.0.0)
     1425                 *
     1426                 * @param array $value Array of slugs and titles for the columns.
     1427                 */
    13301428                return apply_filters( 'bp_groups_list_table_get_columns', array(
    13311429                        'cb'          => '<input name type="checkbox" />',
     
    14171515                $edit_url   = $base_url . '&amp;action=edit';
    14181516                $view_url   = bp_get_group_permalink( $item_obj );
     1517
     1518                /**
     1519                 * Filters the group name for a group's column content.
     1520                 *
     1521                 * @since BuddyPress (1.7.0)
     1522                 *
     1523                 * @param string $value Name of the group being rendered.
     1524                 * @param array  $item  Array for the current group item.
     1525                 */
    14191526                $group_name = apply_filters_ref_array( 'bp_get_group_name', array( $item['name'] ), $item );
    14201527
     
    14301537                $actions['view']   = sprintf( '<a href="%s">%s</a>', esc_url( $view_url   ), __( 'View',   'buddypress' ) );
    14311538
    1432                 // Other plugins can filter which actions are shown
     1539                /**
     1540                 * Filters the actions that will be shown for the column content.
     1541                 *
     1542                 * @since BuddyPress (1.7.0)
     1543                 *
     1544                 * @param array $value Array of actions to be displayed for the column content.
     1545                 * @param array $item  The current group item in the loop.
     1546                 */
    14331547                $actions = apply_filters( 'bp_groups_admin_comment_row_actions', array_filter( $actions ), $item );
    14341548
     
    14621576         */
    14631577        public function column_description( $item = array() ) {
     1578
     1579                /**
     1580                 * Filters the markup for the Description column.
     1581                 *
     1582                 * @since BuddyPress (1.0.0)
     1583                 *
     1584                 * @param string $value Markup for the Description column.
     1585                 * @parma array  $item  The current group item in the loop.
     1586                 */
    14641587                echo apply_filters_ref_array( 'bp_get_group_description', array( $item['description'], $item ) );
    14651588        }
     
    14901613                }
    14911614
     1615                /**
     1616                 * Filters the markup for the Status column.
     1617                 *
     1618                 * @since BuddyPress (1.7.0)
     1619                 *
     1620                 * @param string $status_desc Markup for the Status column.
     1621                 * @parma array  $item        The current group item in the loop.
     1622                 */
    14921623                echo apply_filters_ref_array( 'bp_groups_admin_get_group_status', array( $status_desc, $item ) );
    14931624        }
     
    15021633        public function column_members( $item = array() ) {
    15031634                $count = groups_get_groupmeta( $item['id'], 'total_member_count' );
     1635
     1636                /**
     1637                 * Filters the markup for the number of Members column.
     1638                 *
     1639                 * @since BuddyPress (1.7.0)
     1640                 *
     1641                 * @param int   $count Markup for the number of Members column.
     1642                 * @parma array $item  The current group item in the loop.
     1643                 */
    15041644                echo apply_filters_ref_array( 'bp_groups_admin_get_group_member_count', array( (int) $count, $item ) );
    15051645        }
     
    15141654        public function column_last_active( $item = array() ) {
    15151655                $last_active = groups_get_groupmeta( $item['id'], 'last_activity' );
     1656
     1657                /**
     1658                 * Filters the markup for the Last Active column.
     1659                 *
     1660                 * @since BuddyPress (1.7.0)
     1661                 *
     1662                 * @param string $last_active Markup for the Last Active column.
     1663                 * @parma array  $item        The current group item in the loop.
     1664                 */
    15161665                echo apply_filters_ref_array( 'bp_groups_admin_get_group_last_active', array( $last_active, $item ) );
    15171666        }
     
    15201669         * Allow plugins to add their custom column.
    15211670         *
    1522          * @since BuddyPress 2.0.0
     1671         * @since BuddyPress (2.0.0)
    15231672         *
    15241673         * @param array Information about the current row.
    15251674         * @param string the column name.
     1675         *
     1676         * @return string
    15261677         */
    15271678        public function column_default( $item = array(), $column_name = '' ) {
     1679
     1680                /**
     1681                 * Filters a string to allow plugins to add custom column content.
     1682                 *
     1683                 * @since BuddyPress (2.0.0)
     1684                 *
     1685                 * @param string $value       Empty string.
     1686                 * @param string $column_name Name of the column being rendered.
     1687                 * @param array  $item        The current group item in the loop.
     1688                 */
    15281689                return apply_filters( 'bp_groups_admin_get_group_custom_column', '', $column_name, $item );
    15291690        }
Note: See TracChangeset for help on using the changeset viewer.