Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/31/2010 09:45:19 AM (14 years ago)
Author:
apeatling
Message:

Improved noscript support.

File:
1 edited

Legend:

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

    r2482 r2485  
    117117    global $bp, $activities_template;
    118118
    119     /* Note: any params used for filtering can be a single value, or multiple values comma separated. */
    120 
    121     $defaults = array(
    122         'display_comments' => false, // false for none, stream/threaded - show comments in the stream or threaded under items
    123         'include' => false, // pass an activity_id or string of ID's comma separated
    124         'sort' => 'DESC', // sort DESC or ASC
    125         'page' => 1, // which page to load
    126         'per_page' => 25, // number of items per page
    127         'max' => false, // max number to return
    128         'show_hidden' => false, // Show activity items that are hidden site-wide?
    129 
    130         /* Filtering */
    131         'user_id' => false, // user_id to filter on
    132         'object' => false, // object to filter on e.g. groups, profile, status, friends
    133         'action' => false, // action to filter on e.g. activity_update, new_forum_post, profile_updated
    134         'primary_id' => false, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
    135         'secondary_id' => false, // secondary object ID to filter on e.g. a post_id
    136 
    137         /* Searching */
    138         'search_terms' => false // specify terms to search on
    139     );
    140 
    141     $r = wp_parse_args( $args, $defaults );
    142     extract( $r, EXTR_SKIP );
    143 
    144     if ( ( 'personal' == $type || 'friends' == $type ) && !$user_id )
    145         $user_id = (int)$bp->displayed_user->id;
    146 
    147     if ( $max ) {
    148         if ( $per_page > $max )
    149             $per_page = $max;
     119    /***
     120     * Set the defaults based on the current page. Any of these will be overridden
     121     * if arguments are directly passed into the loop. Custom plugins should always
     122     * pass their parameters directly to the loop.
     123     */
     124    $user_id = false;
     125    $include = false;
     126    $show_hidden = false;
     127    $search_terms = false;
     128    $object = false;
     129    $primary_id = false;
     130
     131    /* User filtering */
     132    if ( !empty( $bp->displayed_user->id ) )
     133        $user_id = $bp->displayed_user->id;
     134
     135    /* User activity scope filtering */
     136    if ( !empty( $user_id ) ) {
     137        switch ( $bp->current_action ) {
     138            case 'friends':
     139                if ( function_exists( 'friends_get_friend_user_ids' ) )
     140                    $user_id = implode( ',', (array)friends_get_friend_user_ids( $bp->displayed_user->id ) );
     141                break;
     142            case 'groups':
     143                if ( function_exists( 'groups_get_user_groups' ) ) {
     144                    $groups = groups_get_user_groups( $bp->displayed_user->id );
     145                    $object = $bp->groups->id;
     146                    $primary_id = implode( ',', (array)$groups['groups'] );
     147                    $show_hidden = ( bp_is_my_profile() ) ? 1 : 0;
     148                }
     149                break;
     150            case 'favorites':
     151                $favs = bp_activity_get_user_favorites( $bp->displayed_user->id );
     152                $include = implode( ',', (array)$favs );
     153                $show_hidden = ( bp_is_my_profile() ) ? 1 : 0;
     154                break;
     155            case 'mentions':
     156                $search_terms = '@' . bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login );
     157                $show_hidden = ( bp_is_my_profile() ) ? 1 : 0;
     158                break;
     159        }
     160    }
     161
     162    /* Group filtering */
     163    if ( !empty( $bp->groups->current_group ) ) {
     164        $object = $bp->groups->id;
     165        $primary_id = $bp->groups->current_group->id;
    150166    }
    151167
     
    159175    else
    160176        $filter = array( 'user_id' => $user_id, 'object' => $object, 'action' => $action, 'primary_id' => $primary_id, 'secondary_id' => $secondary_id );
     177
     178    /* Note: any params used for filtering can be a single value, or multiple values comma separated. */
     179    $defaults = array(
     180        'display_comments' => 'threaded', // false for none, stream/threaded - show comments in the stream or threaded under items
     181        'include' => $include, // pass an activity_id or string of ID's comma separated
     182        'sort' => 'DESC', // sort DESC or ASC
     183        'page' => 1, // which page to load
     184        'per_page' => 25, // number of items per page
     185        'max' => false, // max number to return
     186        'show_hidden' => $show_hidden, // Show activity items that are hidden site-wide?
     187
     188        /* Filtering */
     189        'user_id' => $user_id, // user_id to filter on
     190        'object' => $object, // object to filter on e.g. groups, profile, status, friends
     191        'action' => false, // action to filter on e.g. activity_update, new_forum_post, profile_updated
     192        'primary_id' => $primary_id, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
     193        'secondary_id' => false, // secondary object ID to filter on e.g. a post_id
     194
     195        /* Searching */
     196        'search_terms' => $search_terms // specify terms to search on
     197    );
     198
     199    $r = wp_parse_args( $args, $defaults );
     200    extract( $r, EXTR_SKIP );
     201
     202    if ( $max ) {
     203        if ( $per_page > $max )
     204            $per_page = $max;
     205    }
    161206
    162207    $activities_template = new BP_Activity_Template( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden );
     
    759804        global $bp;
    760805
    761         if ( ( $bp->current_component == $bp->profile->slug ) || 'just-me' == $bp->current_action )
    762             return apply_filters( 'bp_get_activities_member_rss_link', $bp->displayed_user->domain . $bp->activity->slug . '/feed/' );
    763         else
    764             return apply_filters( 'bp_get_activities_member_rss_link', $bp->displayed_user->domain . $bp->activity->slug . '/my-friends/feed/' );
     806        if ( $bp->current_component == $bp->profile->slug || 'just-me' == $bp->current_action )
     807            $link = $bp->displayed_user->domain . $bp->activity->slug . '/feed/';
     808        else if ( 'friends' == $bp->current_action )
     809            $link = $bp->displayed_user->domain . $bp->activity->slug . '/friends/feed/';
     810        else if ( 'groups' == $bp->current_action )
     811            $link = $bp->displayed_user->domain . $bp->activity->slug . '/groups/feed/';
     812        else if ( 'favorites' == $bp->current_action )
     813            $link = $bp->displayed_user->domain . $bp->activity->slug . '/favorites/feed/';
     814        else if ( 'mentions' == $bp->current_action )
     815            $link = $bp->displayed_user->domain . $bp->activity->slug . '/mentions/feed/';
     816
     817        return apply_filters( 'bp_get_activities_member_rss_link', $link );
    765818    }
    766819    function bp_get_activities_member_rss_link() { return bp_get_member_activity_feed_link(); }
Note: See TracChangeset for help on using the changeset viewer.