Changeset 2158
- Timestamp:
- 11/30/2009 12:27:52 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
bp-activity.php (modified) (4 diffs)
-
bp-activity/bp-activity-classes.php (modified) (2 diffs)
-
bp-activity/bp-activity-templatetags.php (modified) (4 diffs)
-
bp-activity/bp-activity-widgets.php (modified) (1 diff)
-
bp-groups.php (modified) (3 diffs)
-
bp-groups/bp-groups-templatetags.php (modified) (2 diffs)
-
bp-themes/bp-default/_inc/css/screen.css (modified) (1 diff)
-
bp-themes/bp-sn-parent/activity/entry.php (modified) (1 diff)
-
bp-themes/bp-sn-parent/activity/just-me.php (modified) (1 diff)
-
bp-themes/bp-sn-parent/groups/single/home.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity.php
r2128 r2158 83 83 bp_core_add_root_component( BP_ACTIVITY_SLUG ); 84 84 } 85 add_action( 'plugins_loaded', 'bp_activity_setup_root_component' );85 add_action( 'plugins_loaded', 'bp_activity_setup_root_component', 2 ); 86 86 87 87 function bp_activity_setup_nav() { … … 136 136 } 137 137 138 function bp_activity_screen_single_activity_permalink() { 139 global $bp; 140 141 if ( !$bp->displayed_user->id || $bp->current_component != $bp->activity->slug ) 142 return false; 143 144 if ( empty( $bp->current_action ) || !is_numeric( $bp->current_action ) ) 145 return false; 146 147 /* Get the activity details */ 148 $activity = bp_activity_get_specific( array( 'activity_ids' => $bp->current_action ) ); 149 150 if ( !$activity = $activity['activities'][0] ) 151 bp_core_redirect( $bp->root_domain ); 152 153 $has_access = true; 154 /* Redirect based on the type of activity */ 155 if ( $activity->component_name == $bp->groups->id ) { 156 if ( !function_exists( 'groups_get_group' ) ) 157 bp_core_redirect( $bp->root_domain ); 158 159 if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) { 160 /* Check to see if the group is not public, if so, check the user has access to see this activity */ 161 if ( 'public' != $group->status ) { 162 if ( !groups_is_user_member( $bp->loggedin_user->id, $group->id ) ) 163 $has_access = false; 164 } 165 } 166 } 167 168 $has_access = apply_filters( 'bp_activity_permalink_access', $has_access, &$activity ); 169 170 if ( !$has_access ) { 171 bp_core_add_message( __( 'You do not have access to this activity.', 'buddypress' ), 'error' ); 172 bp_core_redirect( $bp->loggedin_user->domain ); 173 } 174 175 bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'activity/single' ) ); 176 } 177 /* This screen is not attached to a nav item, so we need to add an action for it. */ 178 add_action( 'wp', 'bp_activity_screen_single_activity_permalink', 3 ); 138 179 139 180 /******************************************************************************** … … 145 186 */ 146 187 188 function bp_activity_action_permalink_router() { 189 global $bp; 190 191 if ( $bp->current_component != $bp->activity->slug || $bp->current_action != 'p' ) 192 return false; 193 194 if ( empty( $bp->action_variables[0] ) || !is_numeric( $bp->action_variables[0] ) ) 195 return false; 196 197 /* Get the activity details */ 198 $activity = bp_activity_get_specific( array( 'activity_ids' => $bp->action_variables[0] ) ); 199 200 if ( !$activity = $activity['activities'][0] ) 201 bp_core_redirect( $bp->root_domain ); 202 203 $redirect = false; 204 /* Redirect based on the type of activity */ 205 if ( $activity->component_name == $bp->groups->id ) { 206 if ( $activity->user_id ) 207 $redirect = bp_core_get_userurl( $activity->user_id ) . $bp->activity->slug . '/' . $activity->id; 208 else { 209 if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) 210 $redirect = bp_get_group_permalink( $group ) . $bp->activity->slug . '/' . $activity->id; 211 } 212 } else 213 $redirect = bp_core_get_userurl( $activity->user_id ) . $bp->activity->slug . '/' . $activity->id; 214 215 if ( !$redirect ) 216 bp_core_redirect( $bp->root_domain ); 217 218 /* Redirect to the actual activity permalink page */ 219 bp_core_redirect( apply_filters( 'bp_activity_action_permalink_url', $redirect . '/', &$activity ) ); 220 } 221 add_action( 'wp', 'bp_activity_action_permalink_router', 3 ); 222 147 223 function bp_activity_action_delete_activity() { 148 224 global $bp; … … 178 254 } 179 255 add_action( 'wp', 'bp_activity_action_delete_activity', 3 ); 180 181 256 182 257 function bp_activity_action_sitewide_feed() { -
trunk/bp-activity/bp-activity-classes.php
r2149 r2158 188 188 $sort = 'DESC'; 189 189 190 /* Hide Hidden Items? */ 191 if ( !$show_hidden ) 192 $hidden_sql = "AND hide_sitewide = 0"; 193 190 194 /* Alter the query based on whether we want to show activity item comments in the stream like normal comments or threaded below the activity */ 191 195 if ( !$display_comments || 'threaded' == $display_comments ) { 192 196 if ( $per_page && $page && $max ) 193 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d {$search_sql} {$filter_sql} AND component_action != 'activity_comment' ORDER BY date_recorded {$sort} {$pag_sql}", $user_id ) );197 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d {$search_sql} {$filter_sql} {$hidden_sql} AND component_action != 'activity_comment' ORDER BY date_recorded {$sort} {$pag_sql}", $user_id ) ); 194 198 else 195 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d {$search_sql} {$filter_sql} AND component_action != 'activity_comment' ORDER BY date_recorded {$sort} {$pag_sql} {$max_sql}", $user_id ) );196 197 $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE user_id = %d {$search_sql} {$filter_sql} AND component_action != 'activity_comment' ORDER BY date_recorded {$sort} {$max_sql}", $user_id ) );199 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d {$search_sql} {$filter_sql} {$hidden_sql} AND component_action != 'activity_comment' ORDER BY date_recorded {$sort} {$pag_sql} {$max_sql}", $user_id ) ); 200 201 $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE user_id = %d {$search_sql} {$filter_sql} {$hidden_sql} AND component_action != 'activity_comment' ORDER BY date_recorded {$sort} {$max_sql}", $user_id ) ); 198 202 199 203 if ( $activities && $display_comments ) … … 201 205 } else { 202 206 if ( $per_page && $page && $max ) 203 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d {$search_sql} {$filter_sql} ORDER BY date_recorded {$sort} {$pag_sql}", $user_id ) );207 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d {$search_sql} {$filter_sql} {$hidden_sql} ORDER BY date_recorded {$sort} {$pag_sql}", $user_id ) ); 204 208 else 205 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d {$search_sql} {$filter_sql} ORDER BY date_recorded {$sort} {$pag_sql} {$max_sql}", $user_id ) );206 207 $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE user_id = %d {$search_sql} {$filter_sql} ORDER BY date_recorded {$sort} {$max_sql}", $user_id ) );209 $activities = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$bp->activity->table_name} WHERE user_id = %d {$search_sql} {$filter_sql} {$hidden_sql} ORDER BY date_recorded {$sort} {$pag_sql} {$max_sql}", $user_id ) ); 210 211 $total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$bp->activity->table_name} WHERE user_id = %d {$search_sql} {$filter_sql} {$hidden_sql} ORDER BY date_recorded {$sort} {$max_sql}", $user_id ) ); 208 212 209 213 if ( $activities ) -
trunk/bp-activity/bp-activity-templatetags.php
r2147 r2158 32 32 33 33 if ( $type == 'personal' ) 34 $this->activities = bp_activity_get_for_user( array( 'user_id' => $user_id, 'display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'filter' => $filter ) );34 $this->activities = bp_activity_get_for_user( array( 'user_id' => $user_id, 'display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'filter' => $filter, 'show_hidden' => $show_hidden ) ); 35 35 36 36 if ( $type == 'friends' && ( bp_is_home() || is_site_admin() || $bp->loggedin_user->id == $user_id ) ) … … 153 153 } 154 154 155 /* Support for permalinks on single item pages: /groups/my-group/activity/124/ */ 156 if ( $bp->current_action == $bp->activity->slug ) 157 $include = $bp->action_variables[0]; 158 155 159 if ( isset( $_GET['afilter'] ) ) 156 160 $filter = array( 'object' => $_GET['afilter'] ); … … 348 352 } 349 353 354 if ( 'activity_comment' == $activities_template->activity->component_action ) 355 $meta = '</span> <span class="activity-header-meta"> · <a href="' . $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activities_template->activity->item_id . '">' . __( 'View Thread', 'buddypress' ) . '</a>'; 356 else 357 $meta = '</span> <span class="activity-header-meta"> · <a href="' . $bp->root_domain . '/' . BP_ACTIVITY_SLUG . '/p/' . $activities_template->activity->id . '">' . __( 'Permalink', 'buddypress' ) . '</a>'; 358 350 359 /* Add the delete link if the user has permission on this item */ 351 360 if ( ( $activities_template->activity->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin || is_site_admin() ) 352 $content[1] = '</span> <span class="activity-delete-link">' . bp_get_activity_delete_link() . '</span>' . $content[1]; 353 361 $meta .= ' ·' . bp_get_activity_delete_link(); 362 363 $content[1] = $meta . '</span>' . $content[1]; 354 364 $content_new = ''; 355 365 … … 486 496 return apply_filters( 'bp_activity_insert_time_since', @sprintf( $content, @sprintf( __( ' %s ago', 'buddypress' ), bp_core_time_since( strtotime( $date ) ) ) ) ); 487 497 } 498 499 function bp_activity_permalink_id() { 500 echo bp_get_activity_permalink_id(); 501 } 502 function bp_get_activity_permalink_id() { 503 global $bp; 504 505 return apply_filters( 'bp_get_activity_permalink_id', $bp->current_action ); 506 } 488 507 489 508 function bp_activity_css_class() { -
trunk/bp-activity/bp-activity-widgets.php
r2156 r2158 49 49 <div id="whats-new-submit"> 50 50 <span class="ajax-loader"></span> 51 <input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="<?php _e( ' Update', 'callisto' ) ?>" />51 <input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="<?php _e( 'Post Update', 'callisto' ) ?>" /> 52 52 </div> 53 53 -
trunk/bp-groups.php
r2147 r2158 575 575 } 576 576 577 578 577 function groups_screen_group_home() { 579 578 global $bp; 580 579 581 580 if ( $bp->is_single_item ) { 582 583 581 if ( isset($_GET['new']) ) { 584 582 // Delete group request notifications for the user … … 975 973 } 976 974 } 975 976 function groups_screen_group_activity_permalink() { 977 global $bp; 978 979 if ( !$bp->is_single_item || $bp->current_component != $bp->groups->slug || $bp->current_action != $bp->activity->slug ) 980 return false; 981 982 if ( '' != locate_template( array( 'groups/single/home.php' ), false ) ) 983 bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) ); 984 else 985 bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/group-home' ) ); 986 } 987 add_action( 'wp', 'groups_screen_group_activity_permalink', 3 ); 977 988 978 989 function groups_screen_group_admin() { … … 1607 1618 */ 1608 1619 1620 function groups_get_group( $args = '' ) { 1621 $defaults = array( 1622 'group_id' => false, 1623 'load_users' => false 1624 ); 1625 1626 $args = wp_parse_args( $args, $defaults ); 1627 extract( $args, EXTR_SKIP ); 1628 1629 return apply_filters( 'groups_get_group', new BP_Groups_Group( $group_id, true, $load_users ) ); 1630 } 1631 1609 1632 /*** Group Creation, Editing & Deletion *****************************************/ 1610 1633 -
trunk/bp-groups/bp-groups-templatetags.php
r2088 r2158 484 484 $group =& $groups_template->group; 485 485 486 return apply_filters( 'bp_get_group_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group->slug );486 return apply_filters( 'bp_get_group_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group->slug . '/' ); 487 487 } 488 488 … … 739 739 } 740 740 741 function bp_group_is_activity_permalink() { 742 global $bp; 743 744 if ( !$bp->is_single_item || $bp->current_component != $bp->groups->slug || $bp->current_action != $bp->activity->slug ) 745 return false; 746 747 return true; 748 } 749 741 750 function bp_group_pagination() { 742 751 echo bp_get_group_pagination(); -
trunk/bp-themes/bp-default/_inc/css/screen.css
r2155 r2158 1341 1341 margin-bottom: 18px; 1342 1342 } 1343 1344 .activity-list li span.activity-header-meta { 1345 font-size: 0.95em; 1346 } 1347 .activity-list li span.activity-header-meta a { 1348 color: #888; 1349 } 1343 1350 1344 1351 .activity-list li span.time-since { -
trunk/bp-themes/bp-sn-parent/activity/entry.php
r2132 r2158 22 22 <div class="ac-reply-avatar"><?php bp_loggedin_user_avatar( 'width=25&height=25' ) ?></div> 23 23 <div class="ac-reply-content"> 24 <textarea id="ac-input-<?php bp_activity_id() ?>" class="ac-input" name="ac-input-<?php bp_activity_id() ?>"></textarea> 24 <div class="ac-textarea"> 25 <textarea id="ac-input-<?php bp_activity_id() ?>" class="ac-input" name="ac-input-<?php bp_activity_id() ?>"></textarea> 26 </div> 27 25 28 <input type="submit" name="ac-form-submit" value="<?php _e( 'Post', 'buddypress' ) ?> →" /> 26 29 </div> -
trunk/bp-themes/bp-sn-parent/activity/just-me.php
r2155 r2158 54 54 <div class="activity"> 55 55 56 <?php if ( bp_has_activities( 'type=personal&max=20&per_page=20&display_comments=stream ') ) : ?>56 <?php if ( bp_has_activities( 'type=personal&max=20&per_page=20&display_comments=stream&show_hidden=' . bp_is_home() ) ) : ?> 57 57 58 58 <ul id="activity-list" class="activity-list item-list"> -
trunk/bp-themes/bp-sn-parent/groups/single/home.php
r2155 r2158 59 59 <h4><?php _e( 'Group Activity', 'buddypress' ); ?></h4> 60 60 61 <?php if ( is_user_logged_in() && bp_group_is_member() ) : ?>61 <?php if ( is_user_logged_in() && bp_group_is_member() && !bp_group_is_activity_permalink() ) : ?> 62 62 63 63 <form action="" method="post" id="whats-new-form" name="whats-new-form">
Note: See TracChangeset
for help on using the changeset viewer.