Ticket #5938: bp-activity-screens-5938.diff
File bp-activity-screens-5938.diff, 11.1 KB (added by , 10 years ago) |
---|
-
src/bp-activity/bp-activity-screens.php
17 17 /** 18 18 * Load the Activity directory. 19 19 * 20 * @since BuddyPress (1.5 )20 * @since BuddyPress (1.5.0) 21 21 * 22 22 * @uses bp_displayed_user_id() 23 23 * @uses bp_is_activity_component() … … 31 31 if ( bp_is_activity_directory() ) { 32 32 bp_update_is_directory( true, 'activity' ); 33 33 34 /** 35 * Fires right before the loading of the Activity directory screen template file. 36 * 37 * @since BuddyPress (1.5.0) 38 */ 34 39 do_action( 'bp_activity_screen_index' ); 35 40 41 /** 42 * Filters the template to load for the Activity directory screen. 43 * 44 * @since BuddyPress (1.5.0) 45 * 46 * @param string $template Path to the activity template to load. 47 */ 36 48 bp_core_load_template( apply_filters( 'bp_activity_screen_index', 'activity/index' ) ); 37 49 } 38 50 } … … 41 53 /** 42 54 * Load the 'My Activity' page. 43 55 * 44 * @since BuddyPress (1.0 )56 * @since BuddyPress (1.0.0) 45 57 * 46 58 * @uses do_action() To call the 'bp_activity_screen_my_activity' hook. 47 59 * @uses bp_core_load_template() … … 48 60 * @uses apply_filters() To call the 'bp_activity_template_my_activity' hook. 49 61 */ 50 62 function bp_activity_screen_my_activity() { 63 64 /** 65 * Fires right before the loading of the "My Activity" screen template file. 66 * 67 * @since BuddyPress (1.0.0) 68 */ 51 69 do_action( 'bp_activity_screen_my_activity' ); 70 71 /** 72 * Filters the template to load for the "My Activity" screen. 73 * 74 * @since BuddyPress (1.0.0) 75 * 76 * @param string $template Path to the activity template to load. 77 */ 52 78 bp_core_load_template( apply_filters( 'bp_activity_template_my_activity', 'members/single/home' ) ); 53 79 } 54 80 … … 55 81 /** 56 82 * Load the 'My Friends' activity page. 57 83 * 58 * @since BuddyPress (1.0 )84 * @since BuddyPress (1.0.0) 59 85 * 60 86 * @uses bp_is_active() 61 87 * @uses bp_update_is_item_admin() … … 69 95 return false; 70 96 71 97 bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' ); 98 99 /** 100 * Fires right before the loading of the "My Friends" screen template file. 101 * 102 * @since BuddyPress (1.2.0) 103 */ 72 104 do_action( 'bp_activity_screen_friends' ); 105 106 /** 107 * Filters the template to load for the "My Friends" screen. 108 * 109 * @since BuddyPress (1.0.0) 110 * 111 * @param string $template Path to the activity template to load. 112 */ 73 113 bp_core_load_template( apply_filters( 'bp_activity_template_friends_activity', 'members/single/home' ) ); 74 114 } 75 115 … … 76 116 /** 77 117 * Load the 'My Groups' activity page. 78 118 * 79 * @since BuddyPress (1.2 )119 * @since BuddyPress (1.2.0) 80 120 * 81 121 * @uses bp_is_active() 82 122 * @uses bp_update_is_item_admin() … … 90 130 return false; 91 131 92 132 bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' ); 133 134 /** 135 * Fires right before the loading of the "My Groups" screen template file. 136 * 137 * @since BuddyPress (1.2.0) 138 */ 93 139 do_action( 'bp_activity_screen_groups' ); 140 141 /** 142 * Filters the template to load for the "My Groups" screen. 143 * 144 * @since BuddyPress (1.2.0) 145 * 146 * @param string $template Path to the activity template to load. 147 */ 94 148 bp_core_load_template( apply_filters( 'bp_activity_template_groups_activity', 'members/single/home' ) ); 95 149 } 96 150 … … 97 151 /** 98 152 * Load the 'Favorites' activity page. 99 153 * 100 * @since BuddyPress (1.2 )154 * @since BuddyPress (1.2.0) 101 155 * 102 156 * @uses bp_update_is_item_admin() 103 157 * @uses bp_current_user_can() … … 107 161 */ 108 162 function bp_activity_screen_favorites() { 109 163 bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' ); 164 165 /** 166 * Fires right before the loading of the "Favorites" screen template file. 167 * 168 * @since BuddyPress (1.2.0) 169 */ 110 170 do_action( 'bp_activity_screen_favorites' ); 171 172 /** 173 * Filters the template to load for the "Favorites" screen. 174 * 175 * @since BuddyPress (1.2.0) 176 * 177 * @param string $template Path to the activity template to load. 178 */ 111 179 bp_core_load_template( apply_filters( 'bp_activity_template_favorite_activity', 'members/single/home' ) ); 112 180 } 113 181 … … 114 182 /** 115 183 * Load the 'Mentions' activity page. 116 184 * 117 * @since BuddyPress (1.2 )185 * @since BuddyPress (1.2.0) 118 186 * 119 187 * @uses bp_update_is_item_admin() 120 188 * @uses bp_current_user_can() … … 124 192 */ 125 193 function bp_activity_screen_mentions() { 126 194 bp_update_is_item_admin( bp_current_user_can( 'bp_moderate' ), 'activity' ); 195 196 /** 197 * Fires right before the loading of the "Mentions" screen template file. 198 * 199 * @since BuddyPress (1.2.0) 200 */ 127 201 do_action( 'bp_activity_screen_mentions' ); 202 203 /** 204 * Filters the template to load for the "Mentions" screen. 205 * 206 * @since BuddyPress (1.2.0) 207 * 208 * @param string $template Path to the activity template to load. 209 */ 128 210 bp_core_load_template( apply_filters( 'bp_activity_template_mention_activity', 'members/single/home' ) ); 129 211 } 130 212 … … 131 213 /** 132 214 * Reset the logged-in user's new mentions data when he visits his mentions screen. 133 215 * 134 * @since BuddyPress (1.5 )216 * @since BuddyPress (1.5.0) 135 217 * 136 218 * @uses bp_is_my_profile() 137 219 * @uses bp_activity_clear_new_mentions() … … 146 228 /** 147 229 * Load the page for a single activity item. 148 230 * 149 * @since BuddyPress (1.2 )231 * @since BuddyPress (1.2.0) 150 232 * 151 233 * @global object $bp BuddyPress global settings 152 234 * @uses bp_is_activity_component() … … 218 300 } 219 301 } 220 302 221 // Allow access to be filtered 303 /** 304 * Filters the access permission for a single activity view. 305 * 306 * @since BuddyPress (1.2.0) 307 * 308 * @param array $access Array holding the current $has_access value and current activity item instance. 309 */ 222 310 $has_access = apply_filters_ref_array( 'bp_activity_permalink_access', array( $has_access, &$activity ) ); 223 311 224 // Allow additional code execution 312 /** 313 * Fires before the loading of a single activity template file. 314 * 315 * @since BuddyPress (1.2.0) 316 * 317 * @param BP_Activity_Activity $activity Object representing the current activity item being displayed. 318 * @param bool $has_access Whether or not the current user has access to view activity. 319 */ 225 320 do_action( 'bp_activity_screen_single_activity_permalink', $activity, $has_access ); 226 321 227 322 // Access is specifically disallowed … … 244 339 bp_core_redirect( $url ); 245 340 } 246 341 342 /** 343 * Filters the template to load for a single activity screen. 344 * 345 * @since BuddyPress (1.0.0) 346 * 347 * @param string $template Path to the activity template to load. 348 */ 247 349 bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink' ) ); 248 350 } 249 351 add_action( 'bp_screens', 'bp_activity_screen_single_activity_permalink' ); … … 251 353 /** 252 354 * Add activity notifications settings to the notifications settings page. 253 355 * 254 * @since BuddyPress (1.2 )356 * @since BuddyPress (1.2.0) 255 357 * 256 358 * @uses bp_get_user_meta() 257 359 * @uses bp_core_get_username() … … 298 400 <td class="no"><input type="radio" name="notifications[notification_activity_new_reply]" value="no" <?php checked( $reply, 'no', true ) ?>/></td> 299 401 </tr> 300 402 301 <?php do_action( 'bp_activity_screen_notification_settings' ) ?> 403 <?php 404 405 /** 406 * Fires inside the closing </tbody> tag for activity screen notification settings. 407 * 408 * @since BuddyPress (1.2.0) 409 */ 410 do_action( 'bp_activity_screen_notification_settings' ) ?> 302 411 </tbody> 303 412 </table> 304 413 … … 314 423 * This class sets up the necessary theme compatability actions to safely output 315 424 * activity template parts to the_title and the_content areas of a theme. 316 425 * 317 * @since BuddyPress (1.7 )426 * @since BuddyPress (1.7.0) 318 427 */ 319 428 class BP_Activity_Theme_Compat { 320 429 … … 321 430 /** 322 431 * Set up the activity component theme compatibility. 323 432 * 324 * @since BuddyPress (1.7 )433 * @since BuddyPress (1.7.0) 325 434 */ 326 435 public function __construct() { 327 436 add_action( 'bp_setup_theme_compat', array( $this, 'is_activity' ) ); … … 330 439 /** 331 440 * Set up the theme compatibility hooks, if we're looking at an activity page. 332 441 * 333 * @since BuddyPress (1.7 )442 * @since BuddyPress (1.7.0) 334 443 */ 335 444 public function is_activity() { 336 445 … … 342 451 if ( ! bp_displayed_user_id() && ! bp_current_action() ) { 343 452 bp_update_is_directory( true, 'activity' ); 344 453 454 /** This action is documented in bp-activity/bp-activity-screens.php */ 345 455 do_action( 'bp_activity_screen_index' ); 346 456 347 457 add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) ); … … 363 473 * 364 474 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 365 475 * 366 * @since BuddyPress (1.8 )476 * @since BuddyPress (1.8.0) 367 477 * 368 478 * @param string $templates The templates from bp_get_theme_compat_templates(). 369 479 * @return array $templates Array of custom templates to look for. 370 480 */ 371 481 public function directory_template_hierarchy( $templates ) { 372 // Setup our templates based on priority 482 483 /** 484 * Filters the template hierarchy for the activity directory page. 485 * 486 * @since BuddyPress (1.8.0) 487 * 488 * @param array $index-directory Array holding template names to be merged into template list. 489 */ 373 490 $new_templates = apply_filters( 'bp_template_hierarchy_activity_directory', array( 374 491 'activity/index-directory.php' 375 492 ) ); … … 384 501 /** 385 502 * Update the global $post with directory data. 386 503 * 387 * @since BuddyPress (1.7 )504 * @since BuddyPress (1.7.0) 388 505 */ 389 506 public function directory_dummy_post() { 390 507 bp_theme_compat_reset_post( array( … … 403 520 /** 404 521 * Filter the_content with the groups index template part. 405 522 * 406 * @since BuddyPress (1.7 )523 * @since BuddyPress (1.7.0) 407 524 */ 408 525 public function directory_content() { 409 526 return bp_buffer_template_part( 'activity/index', null, false ); … … 416 533 * 417 534 * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 418 535 * 419 * @since BuddyPress (1.8 )536 * @since BuddyPress (1.8.0) 420 537 * 421 538 * @param string $templates The templates from bp_get_theme_compat_templates(). 422 539 * @return array $templates Array of custom templates to look for. 423 540 */ 424 541 public function single_template_hierarchy( $templates ) { 425 // Setup our templates based on priority 542 543 /** 544 * Filters the template hierarchy for the activity permalink pages. 545 * 546 * @since BuddyPress (1.8.0) 547 * 548 * @param array $index Array holding template names to be merged into template list. 549 */ 426 550 $new_templates = apply_filters( 'bp_template_hierarchy_activity_single_item', array( 427 551 'activity/single/index.php' 428 552 ) ); … … 437 561 /** 438 562 * Update the global $post with the displayed user's data. 439 563 * 440 * @since BuddyPress (1.7 )564 * @since BuddyPress (1.7.0) 441 565 */ 442 566 public function single_dummy_post() { 443 567 bp_theme_compat_reset_post( array( … … 456 580 /** 457 581 * Filter the_content with the members' activity permalink template part. 458 582 * 459 * @since BuddyPress (1.7 )583 * @since BuddyPress (1.7.0) 460 584 */ 461 585 public function single_dummy_content() { 462 586 return bp_buffer_template_part( 'activity/single/home', null, false );