Skip to:
Content

BuddyPress.org

Changeset 5437


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.

Location:
trunk
Files:
5 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    }
  • trunk/bp-activity/bp-activity-functions.php

    r5410 r5437  
    754754 * Register the activity stream actions for updates
    755755 *
    756  * @since 1.2.0
    757  *
    758  * @global object $bp BuddyPress global settings
    759  * @uses bp_activity_set_action()
    760  * @uses do_action() To call the 'updates_register_activity_actions' hook
    761  */
    762 function updates_register_activity_actions() {
    763     global $bp;
    764 
    765     bp_activity_set_action( $bp->activity->id, 'activity_update', __( 'Posted an update', 'buddypress' ) );
    766 
     756 * @global object $bp BuddyPress global settings
     757 * @since 1.6
     758 */
     759function bp_activity_register_activity_actions() {
     760    global $bp;
     761
     762    bp_activity_set_action( $bp->activity->id, 'activity_update', __( 'Posted a status update', 'buddypress' ) );
     763    bp_activity_set_action( $bp->activity->id, 'activity_comment', __( 'Replied to a status update', 'buddypress' ) );
     764
     765    do_action( 'bp_activity_register_activity_actions' );
     766
     767    // Backpat. Don't use this.
    767768    do_action( 'updates_register_activity_actions' );
    768769}
    769 add_action( 'bp_register_activity_actions', 'updates_register_activity_actions' );
     770add_action( 'bp_register_activity_actions', 'bp_activity_register_activity_actions' );
    770771
    771772/******************************************************************************
  • trunk/bp-core/deprecated/1.6.php

    r5366 r5437  
    7474}
    7575
     76/**
     77 * Activity functions
     78 */
     79
     80/**
     81 * @deprecated 1.6
     82 * @deprecated No longer used. Renamed to bp_activity_register_activity_actions().
     83 */
     84function updates_register_activity_actions() {
     85    _deprecated_function( __FUNCTION__, '1.6' );
     86}
    7687?>
  • trunk/bp-friends/bp-friends-activity.php

    r5416 r5437  
    4848        return false;
    4949
     50    // These two added in BP 1.6
     51    bp_activity_set_action( $bp->friends->id, 'friendship_accepted', __( 'Friendships accepted', 'buddypress' ) );
     52    bp_activity_set_action( $bp->friends->id, 'friendship_created', __( 'New friendships', 'buddypress' ) );
     53
     54    // < BP 1.6 backpat
    5055    bp_activity_set_action( $bp->friends->id, 'friends_register_activity_action', __( 'New friendship created', 'buddypress' ) );
    5156
  • trunk/bp-xprofile/bp-xprofile-activity.php

    r5302 r5437  
    1616    global $bp;
    1717
    18     if ( bp_is_active( 'activity' ) )
    19         return false;
    20 
    2118    // Register the activity stream actions for this component
     19    bp_activity_set_action( $bp->profile->id, 'new_avatar',      __( 'Member changed profile picture', 'buddypress' ) );
    2220    bp_activity_set_action( $bp->profile->id, 'new_member',      __( 'New member registered', 'buddypress' ) );
    23     bp_activity_set_action( $bp->profile->id, 'updated_profile', __( 'Updated Profile',       'buddypress' ) );
     21    bp_activity_set_action( $bp->profile->id, 'updated_profile', __( 'Updated Profile', 'buddypress' ) );
    2422
    2523    do_action( 'xprofile_register_activity_actions' );
Note: See TracChangeset for help on using the changeset viewer.