Skip to:
Content

BuddyPress.org

Changeset 5487


Ignore:
Timestamp:
12/10/2011 07:24:05 PM (13 years ago)
Author:
djpaul
Message:

Add a bunch of actions and filters for plugin authors to the Activity Admin screen. See #3660

File:
1 edited

Legend:

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

    r5484 r5487  
    152152add_filter( 'default_hidden_meta_boxes', 'bp_activity_admin_edit_hidden_metaboxes', 10, 2 );
    153153
    154 
    155154/**
    156155 * Set up the admin page before any output is sent. Register contextual help and screen options for this admin page.
     
    168167    // Decide whether to load the index or edit screen
    169168    $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
     169
     170    // Call an action for plugins to hook in early
     171    do_action( 'bp_activity_admin_load', $doaction );
    170172
    171173    // Edit screen
     
    262264        $activity_ids = array_map( 'absint', (array) $_REQUEST['aid'] );
    263265
     266        // Call a filter for plugins to modify the requested activities to load
     267        $activity_ids = apply_filters( 'bp_activity_admin_action_activity_ids', $activity_ids );
     268
    264269        // Is this a bulk request?
    265270        if ( 'bulk_' == substr( $doaction, 0, 5 ) && ! empty( $_REQUEST['aid'] ) ) {
     
    342347        }
    343348
     349        // Call actions for plugins to do something before we redirect
     350        do_action( 'bp_activity_admin_action_after', array( $spammed, $unspammed, $deleted, $error ), $redirect_to, $activity_ids );
     351
    344352        // Add arguments to the redirect URL so that on page reload, we can easily display what we've just done.
    345353        if ( $spammed )
     
    357365
    358366        // Redirect
    359         wp_redirect( $redirect_to );
     367        wp_redirect( apply_filters( 'bp_activity_admin_action_redirect', $redirect_to ) );
    360368        exit;
    361369
     
    477485            $error = $activity->id;
    478486
     487        // Call actions for plugins to do something before we redirect
     488        do_action_ref_array( 'bp_activity_admin_edit_after', array( &$activity, $error ) );
     489
    479490        // If an error occured, pass back the activity ID that failed
    480491        if ( $error )
     
    484495
    485496        // Redirect
    486         wp_redirect( $redirect_to );
     497        wp_redirect( apply_filters( 'bp_activity_admin_edit_redirect', $redirect_to ) );
    487498        exit;
    488499
     
    548559    $form_url = remove_query_arg( array( 'action', 'deleted', 'error', 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] );
    549560    $form_url = add_query_arg( 'action', 'save', $form_url );
     561
     562    // Call an action for plugins to modify the activity before we display the edit form
     563    do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) );
    550564?>
    551565
     
    771785    // Prepare the activity items for display
    772786    $bp_activity_list_table->prepare_items();
     787
     788    // Call an action for plugins to modify the activity before we display the edit form
     789    do_action( 'bp_activity_admin_index', $messages );
    773790?>
    774791
     
    792809        <?php endif; ?>
    793810
     811        <?php // Display each activity on its own row ?>
    794812        <?php $bp_activity_list_table->views(); ?>
    795813
     
    800818        </form>
    801819
     820        <?php // This markup is used for the reply form ?>
    802821        <table style="display: none;">
    803822            <tr id="bp-activities-container" style="display: none;">
     
    10581077            <li class="all"><a href="<?php echo esc_attr( esc_url( $redirect_to ) ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
    10591078            <li class="spam"><a href="<?php echo esc_attr( esc_url( add_query_arg( 'activity_status', 'spam', $redirect_to ) ) ); ?>" 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>
     1079
     1080            <?php do_action( 'bp_activity_list_table_get_views', $redirect_to, $this->view ); ?>
    10601081        </ul>
    10611082    <?php
     
    10741095        $actions['bulk_delete'] = __( 'Delete Permanently', 'buddypress' );
    10751096
    1076         return $actions;
     1097        return apply_filters( 'bp_activity_list_table_get_bulk_actions', $actions );
    10771098    }
    10781099
Note: See TracChangeset for help on using the changeset viewer.