Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/04/2011 05:20:57 PM (12 years ago)
Author:
djpaul
Message:

Switch the "filter by" drop down on the Activity admin screen to get its values from the registered activity list. Adds missing core activity types to that list. See #3660.

File:
1 edited

Legend:

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

    r5435 r5437  
    951951     * Markup for the "filter" part of the form (i.e. which activity type to display)
    952952     *
     953     * @global object $bp BuddyPress global settings
    953954     * @param string $which 'top' or 'bottom'
    954955     * @since 1.6
    955956     */
    956957    function extra_tablenav( $which ) {
     958        global $bp;
     959
    957960        if ( 'bottom' == $which )
    958961            return;
    959962
     963        $actions  = array();
    960964        $selected = !empty( $_REQUEST['activity_type'] ) ? $_REQUEST['activity_type'] : '';
    961         ?>
     965
     966        // Walk through the registered actions, and build an array of actions/values.
     967        foreach ( $bp->activity->actions as $action ) {
     968            $action = array_values( (array) $action );
     969
     970            for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ )
     971                $actions[ $action[$i]['key'] ] = $action[$i]['value'];
     972        }
     973
     974        // This was a mis-named activity type from before BP 1.6
     975        unset( $actions['friends_register_activity_action'] );
     976
     977        // Sort array by the human-readable value
     978        natsort( $actions );
     979    ?>
    962980
    963981        <div class="alignleft actions">
    964982            <select name="activity_type">
    965983                <option value="" <?php selected( !$selected ); ?>><?php _e( 'Show all activity types', 'buddypress' ); ?></option>
    966                 <option value="activity_update"  <?php selected( 'activity_update',  $selected ); ?>><?php _e( 'Status Updates', 'buddypress' ); ?></option>
    967                 <option value="activity_comment" <?php selected( 'activity_comment', $selected ); ?>><?php _e( 'Status Update Comments', 'buddypress' ); ?></option>
    968 
    969                 <?php if ( bp_is_active( 'blogs' ) ) : ?>
    970                     <option value="new_blog_post"    <?php selected( 'new_blog_post',    $selected ); ?>><?php _e( 'Posts', 'buddypress' ); ?></option>
    971                     <option value="new_blog_comment" <?php selected( 'new_blog_comment', $selected ); ?>><?php _e( 'Comments', 'buddypress' ); ?></option>
    972                 <?php endif; ?>
    973 
    974                 <?php if ( bp_is_active( 'forums' ) ) : ?>
    975                     <option value="new_forum_topic" <?php selected( 'new_forum_topic', $selected ); ?>><?php _e( 'Forum Topics', 'buddypress' ); ?></option>
    976                     <option value="new_forum_post"  <?php selected( 'new_forum_post',  $selected ); ?>><?php _e( 'Forum Replies', 'buddypress' ); ?></option>
    977                 <?php endif; ?>
    978 
    979                 <?php if ( bp_is_active( 'groups' ) ) : ?>
    980                     <option value="created_group" <?php selected( 'created_group', $selected ); ?>><?php _e( 'New Groups', 'buddypress' ); ?></option>
    981                     <option value="joined_group"  <?php selected( 'joined_group',  $selected ); ?>><?php _e( 'Group Memberships', 'buddypress' ); ?></option>
    982                 <?php endif; ?>
    983 
    984                 <?php if ( bp_is_active( 'friends' ) ) : ?>
    985                     <option value="friendship_accepted" <?php selected( 'friendship_accepted', $selected ); ?>><?php _e( 'Friendships Accepted', 'buddypress' ); ?></option>
    986                     <option value="friendship_created"  <?php selected( 'friendship_created',  $selected ); ?>><?php _e( 'New Friendships', 'buddypress' ); ?></option>
    987                 <?php endif; ?>
    988 
    989                 <option value="new_member" <?php selected( 'new_member', $selected ); ?>><?php _e( 'New Members', 'buddypress' ); ?></option>
    990                 <option value="new_avatar" <?php selected( 'new_avatar', $selected ); ?>><?php _e( 'New Member Avatar', 'buddypress' ); ?></option>
    991 
    992                 <?php do_action( 'bp_activity_filter_options' ); ?>
    993 
     984
     985                <?php foreach ( $actions as $k => $v ) : ?>
     986                    <option value="<?php echo esc_attr( $k ); ?>" <?php selected( $k,  $selected ); ?>><?php echo esc_html( $v ); ?></option>
     987                <?php endforeach; ?>
    994988            </select>
    995989
    996990            <?php submit_button( __( 'Filter', 'buddypress' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) ); ?>
    997 
    998991        </div>
     992
    999993    <?php
    1000994    }
Note: See TracChangeset for help on using the changeset viewer.