Skip to:
Content

BuddyPress.org

Changeset 9078


Ignore:
Timestamp:
10/11/2014 01:08:07 AM (10 years ago)
Author:
boonebgorges
Message:

Add hook documentation to bp-activity-admin.php.

Props tw2113.
See #5938.

File:
1 edited

Legend:

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

    r8770 r9078  
    172172    $hidden  = array_merge( (array) $hidden, array( 'bp_activity_itemids', 'bp_activity_link', 'bp_activity_type', 'bp_activity_userid', ) );
    173173
     174    /**
     175     * Filters default hidden metaboxes so plugins can alter list.
     176     *
     177     * @since BuddyPress (1.6.0)
     178     *
     179     * @param array     $hidden Default metaboxes to hide.
     180     * @param WP_Screen $screen Screen identifier.
     181     */
    174182    return apply_filters( 'bp_hide_meta_boxes', array_unique( $hidden ), $screen );
    175183}
     
    199207    $doaction = bp_admin_list_table_current_bulk_action();
    200208
    201     // Call an action for plugins to hook in early
     209    /**
     210     * Fires at top of Activity admin page.
     211     *
     212     * @since BuddyPress (1.6.0)
     213     *
     214     * @param string $doaction Current $_GET action being performed in admin screen.
     215     */
    202216    do_action( 'bp_activity_admin_load', $doaction );
    203217
     
    301315        $activity_ids = array_map( 'absint', (array) $_REQUEST['aid'] );
    302316
    303         // Call a filter for plugins to modify the requested activities to load
     317        /**
     318         * Filters list of IDs being spammed/un-spammed/deleted.
     319         *
     320         * @since BuddyPress (1.6.0)
     321         *
     322         * @param array $activity_ids Activity IDs to spam/un-spam/delete.
     323         */
    304324        $activity_ids = apply_filters( 'bp_activity_admin_action_activity_ids', $activity_ids );
    305325
     
    385405        }
    386406
    387         // Call actions for plugins to do something before we redirect
     407        /**
     408         * Fires before redirect for plugins to do something with activity.
     409         *
     410         * Passes an activity array counts how many were spam, not spam, deleted, and IDs that were errors.
     411         *
     412         * @since BuddyPress (1.6.0)
     413         *
     414         * @param array  Array holding spam, not spam, deleted counts, error IDs.
     415         * @param string $redirect_to URL to redirect to.
     416         * @param array  $activity_ids Original array of activity IDs.
     417         */
    388418        do_action( 'bp_activity_admin_action_after', array( $spammed, $unspammed, $deleted, $errors ), $redirect_to, $activity_ids );
    389419
     
    402432            $redirect_to = add_query_arg( 'error', implode ( ',', array_map( 'absint', $errors ) ), $redirect_to );
    403433
    404         // Redirect
     434        /**
     435         * Filters redirect URL after activty spamming/un-spamming/deletion occurs.
     436         *
     437         * @since BuddyPress (1.6.0)
     438         *
     439         * @param string $redirect_to URL to redirect to.
     440         */
    405441        wp_redirect( apply_filters( 'bp_activity_admin_action_redirect', $redirect_to ) );
    406442        exit;
     
    513549            $error = $activity->id;
    514550
    515         // Call actions for plugins to do something before we redirect
     551        /**
     552         * Fires before redirect so plugins can do something first on save action.
     553         *
     554         * @since BuddyPress (1.6.0)
     555         *
     556         * @param array Array holding activity object and ID that holds error.
     557         */
    516558        do_action_ref_array( 'bp_activity_admin_edit_after', array( &$activity, $error ) );
    517559
     
    522564            $redirect_to = add_query_arg( 'updated', (int) $activity->id, $redirect_to );
    523565
    524         // Redirect
     566        /**
     567         * Filters URL to redirect to after saving.
     568         *
     569         * @since BuddyPress (1.6.0)
     570         *
     571         * @param string $redirect_to URL to redirect to.
     572         */
    525573        wp_redirect( apply_filters( 'bp_activity_admin_edit_redirect', $redirect_to ) );
    526574        exit;
     
    587635    $form_url = add_query_arg( 'action', 'save', $form_url );
    588636
    589     // Call an action for plugins to modify the activity before we display the edit form
     637    /**
     638     * Fires before activity edit form is displays so plugins can modify the activity.
     639     *
     640     * @since BuddyPress (1.6.0)
     641     *
     642     * @param array Array holding single activity object.
     643     */
    590644    do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) ); ?>
    591645
     
    901955    $bp_activity_list_table->prepare_items();
    902956
    903     // Call an action for plugins to modify the activity before we display the edit form
     957    /**
     958     * Fires before edit form is displayed so plugins can modify the activity messages.
     959     *
     960     * @since BuddyPress (1.6.0)
     961     *
     962     * @param array $messages Array of messages to display at top of page.
     963     */
    904964    do_action( 'bp_activity_admin_index', $messages ); ?>
    905965
     
    12121272            <li class="spam"><a href="<?php echo esc_attr( esc_url( add_query_arg( 'activity_status', 'spam', $url_base ) ) ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam <span class="count">(%s)</span>', 'buddypress' ), number_format_i18n( $this->spam_count ) ); ?></a></li>
    12131273
    1214             <?php do_action( 'bp_activity_list_table_get_views', $url_base, $this->view ); ?>
     1274            <?php
     1275
     1276            /**
     1277             * Fires inside listing of views so plugins can add their own.
     1278             *
     1279             * @since BuddyPress (1.6.0)
     1280             *
     1281             * @param string $url_base Current URL base for view.
     1282             * @param string $view Current view being displayed.
     1283             */
     1284            do_action( 'bp_activity_list_table_get_views', $url_base, $this->view ); ?>
    12151285        </ul>
    12161286    <?php
     
    12301300        $actions['bulk_delete'] = __( 'Delete Permanently', 'buddypress' );
    12311301
     1302        /**
     1303         * Filters the default bulk actions so plugins can add custom actions.
     1304         *
     1305         * @since BuddyPress (1.6.0)
     1306         *
     1307         * @param array $actions Default available actions for bulk operations.
     1308         */
    12321309        return apply_filters( 'bp_activity_list_table_get_bulk_actions', $actions );
    12331310    }
     
    14301507        echo '<div class="submitted-on">';
    14311508
    1432         // Other plugins can filter which actions are shown
     1509        /**
     1510         * Filters available actions for plugins to alter.
     1511         *
     1512         * @since BuddyPress (1.6.0)
     1513         *
     1514         * @param array $actions Array of available actions user could use.
     1515         * @param array $item Current item being added to page.
     1516         */
    14331517        $actions = apply_filters( 'bp_activity_admin_comment_row_actions', array_filter( $actions ), $item );
    14341518
     
    14411525        // Get activity content - if not set, use the action
    14421526        if ( ! empty( $item['content'] ) ) {
     1527
     1528            /**
     1529             * Filters current activity item content.
     1530             *
     1531             * @since BuddyPress (1.2.0)
     1532             *
     1533             * @param array $item Array index holding current activity item content.
     1534             */
    14431535            $content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $item['content'] ) );
    14441536        } else {
     1537            /**
     1538             * Filters current activity item action.
     1539             *
     1540             * @since BuddyPress (1.2.0)
     1541             *
     1542             * @var array $item Array index holding current activity item action.
     1543             */
    14451544            $content = apply_filters_ref_array( 'bp_get_activity_action', array( $item['action'] ) );
    14461545        }
     
    14601559    function column_response( $item ) {
    14611560        // Is $item is a root activity?
     1561
     1562        /**
     1563         * Filters default list of default root activity types.
     1564         *
     1565         * @since BuddyPress (1.6.0)
     1566         *
     1567         * @param array Array of default activity types.
     1568         * @param array $item Current item being displayed.
     1569         */
    14621570        if ( empty( $item['item_id'] ) || ! in_array( $item['type'], apply_filters( 'bp_activity_admin_root_activity_types', array( 'activity_comment' ), $item ) ) ) {
    14631571            $comment_count     = !empty( $item['children'] ) ? bp_activity_recurse_comment_count( (object) $item ) : 0;
     
    15741682        }
    15751683
     1684        /**
     1685         * Filters if an activity item can be commented on or not.
     1686         *
     1687         * @since BuddyPress (2.0.0)
     1688         *
     1689         * @param bool $can_comment Whether an activity item can be commented on or not.
     1690         */
    15761691        return apply_filters( 'bp_activity_list_table_can_comment', $can_comment );
    15771692    }
Note: See TracChangeset for help on using the changeset viewer.