Skip to:
Content

BuddyPress.org

Changeset 10093


Ignore:
Timestamp:
09/06/2015 02:35:08 PM (11 years ago)
Author:
imath
Message:

Activity Administration screens: Include new hooks to ease their customization

  • the action bp_activity_admin_meta_boxes can be used to add new metaboxes when editing an activity from the corresponding Administration screen.
  • the action bp_activity_admin_enqueue_scripts can be used to enqueue custom script in Activity Administration screens.
  • the filter bp_activity_admin_comment_content can be used to add custom content to the activity content when viewing activities from the corresponding Administration screen.
  • It is now possible to add custom columns and their corresponding rows in BP_Activity_List_Table

Fixes #6611

File:
1 edited

Legend:

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

    r10084 r10093  
    257257                add_meta_box( 'bp_activity_userid',  _x( 'Author ID', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_userid', get_current_screen()->id, 'normal', 'core' );
    258258
     259                /**
     260                 * Fires after the registration of all of the default activity meta boxes.
     261                 *
     262                 * @since 2.4.0
     263                 */
     264                do_action( 'bp_activity_admin_meta_boxes' );
     265
    259266                // Enqueue JavaScript files
    260267                wp_enqueue_script( 'postbox' );
     
    307314        }
    308315
     316        /**
     317         * Fires after the activity js and style has been enqueued.
     318         *
     319         * @since 2.4.0
     320         */
     321        do_action( 'bp_activity_admin_enqueue_scripts' );
    309322
    310323        // Handle spam/un-spam/delete of activities
     
    13441357         */
    13451358        function get_columns() {
    1346                 return array(
     1359                /**
     1360                 * Filters the titles for the columns for the activity list table.
     1361                 *
     1362                 * @since 2.4.0
     1363                 *
     1364                 * @param array $value Array of slugs and titles for the columns.
     1365                 */
     1366                return apply_filters( 'bp_activity_list_table_get_columns', array(
    13471367                        'cb'       => '<input name type="checkbox" />',
    13481368                        'author'   => _x('Author', 'Admin SWA column header', 'buddypress' ),
     
    13501370                        'action'   => _x( 'Action', 'Admin SWA column header', 'buddypress' ),
    13511371                        'response' => _x( 'In Response To', 'Admin SWA column header', 'buddypress' ),
    1352                 );
     1372                ) );
    13531373        }
    13541374
     
    13941414                <div class="alignleft actions">
    13951415                        <label for="activity-type" class="screen-reader-text"><?php _e( 'Filter by activity type', 'buddypress' ); ?></label>
    1396                         <select name="activity_type" id="activity-type"> 
     1416                        <select name="activity_type" id="activity-type">
    13971417                                <option value="" <?php selected( ! $selected ); ?>><?php _e( 'View all actions', 'buddypress' ); ?></option>
    13981418
     
    16011621                }
    16021622
    1603                 echo $content . ' ' . $this->row_actions( $actions );
     1623                /**
     1624                 * Filter here to add extra output to the activity content into the Administration
     1625                 *
     1626                 * @since  2.4.0
     1627                 *
     1628                 * @param  string $content The activity content
     1629                 * @param  array  $item    The activity object converted into an array
     1630                 */
     1631                echo apply_filters( 'bp_activity_admin_comment_content', $content, $item ) . ' ' . $this->row_actions( $actions );
    16041632        }
    16051633
     
    16421670                if ( ! $item['is_spam'] )
    16431671                        printf( __( '<a href="%1$s">View Activity</a>', 'buddypress' ), bp_activity_get_permalink( $item['id'], (object) $item ) );
     1672        }
     1673
     1674        /**
     1675         * Allow plugins to add their custom column.
     1676         *
     1677         * @since 2.4.0
     1678         *
     1679         * @param array  $item        Information about the current row.
     1680         * @param string $column_name The column name.
     1681         *
     1682         * @return string
     1683         */
     1684        public function column_default( $item = array(), $column_name = '' ) {
     1685
     1686                /**
     1687                 * Filters a string to allow plugins to add custom column content.
     1688                 *
     1689                 * @since 2.4.0
     1690                 *
     1691                 * @param string $value       Empty string.
     1692                 * @param string $column_name Name of the column being rendered.
     1693                 * @param array  $item        The current activity item in the loop.
     1694                 */
     1695                return apply_filters( 'bp_activity_admin_get_custom_column', '', $column_name, $item );
    16441696        }
    16451697
Note: See TracChangeset for help on using the changeset viewer.