Changeset 11644
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-template.php
r11643 r11644 274 274 * Output the permalink for a particular thread. 275 275 * 276 * @since 2.9.0 Introduced `$user_id` parameter. 277 * 276 278 * @param int $thread_id Optional. ID of the thread. Default: current thread 277 279 * being iterated on in the loop. 278 */ 279 function bp_message_thread_view_link( $thread_id = 0 ) { 280 echo bp_get_message_thread_view_link( $thread_id ); 280 * @param int $user_id Optional. ID of the user relative to whom the link 281 * should be generated. Default: ID of logged-in user. 282 */ 283 function bp_message_thread_view_link( $thread_id = 0, $user_id = null ) { 284 echo bp_get_message_thread_view_link( $thread_id, $user_id ); 281 285 } 282 286 /** 283 287 * Get the permalink of a particular thread. 288 * 289 * @since 2.9.0 Introduced `$user_id` parameter. 284 290 * 285 291 * @param int $thread_id Optional. ID of the thread. Default: current 286 292 * thread being iterated on in the loop. 287 * @return string 288 */ 289 function bp_get_message_thread_view_link( $thread_id = 0 ) { 293 * @param int $user_id Optional. ID of the user relative to whom the link 294 * should be generated. Default: ID of logged-in user. 295 * @return string 296 */ 297 function bp_get_message_thread_view_link( $thread_id = 0, $user_id = null ) { 290 298 global $messages_template; 291 299 … … 296 304 } 297 305 306 if ( null === $user_id ) { 307 $user_id = bp_loggedin_user_id(); 308 } 309 310 $domain = bp_core_get_user_domain( $user_id ); 311 298 312 /** 299 313 * Filters the permalink of a particular thread. … … 301 315 * @since 1.0.0 302 316 * @since 2.6.0 Added the `$thread_id` parameter. 317 * @since 2.9.0 Added the `$user_id` parameter. 303 318 * 304 319 * @param string $value Permalink of a particular thread. 305 320 * @param int $thread_id ID of the thread. 306 */ 307 return apply_filters( 'bp_get_message_thread_view_link', trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id ), $thread_id ); 321 * @param int $user_id ID of the user. 322 */ 323 return apply_filters( 'bp_get_message_thread_view_link', trailingslashit( $domain . bp_get_messages_slug() . '/view/' . $thread_id ), $thread_id, $user_id ); 308 324 } 309 325 310 326 /** 311 327 * Output the URL for deleting the current thread. 312 */ 313 function bp_message_thread_delete_link() { 314 echo esc_url( bp_get_message_thread_delete_link() ); 328 * 329 * @since 2.9.0 Introduced `$user_id` parameter. 330 * 331 * @param int $user_id Optional. ID of the user relative to whom the link 332 * should be generated. Default: ID of logged-in user. 333 */ 334 function bp_message_thread_delete_link( $user_id = null ) { 335 echo esc_url( bp_get_message_thread_delete_link( $user_id ) ); 315 336 } 316 337 /** 317 338 * Generate the URL for deleting the current thread. 318 339 * 319 * @return string 320 */ 321 function bp_get_message_thread_delete_link() { 340 * @since 2.9.0 Introduced `$user_id` parameter. 341 * 342 * @param int $user_id Optional. ID of the user relative to whom the link 343 * should be generated. Default: ID of logged-in user. 344 * @return string 345 */ 346 function bp_get_message_thread_delete_link( $user_id = null ) { 322 347 global $messages_template; 323 348 349 if ( null === $user_id ) { 350 $user_id = bp_loggedin_user_id(); 351 } 352 353 $domain = bp_core_get_user_domain( $user_id ); 354 324 355 /** 325 356 * Filters the URL for deleting the current thread. … … 327 358 * @since 1.0.0 328 359 * 329 * @param string $value URL for deleting the current thread.330 * @param string $value Text indicating action being executed.331 */ 332 return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/delete/' . $messages_template->thread->thread_id ), 'messages_delete_thread' ));360 * @param string $value URL for deleting the current thread. 361 * @param int $user_id ID of the user relative to whom the link should be generated. 362 */ 363 return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( trailingslashit( $domain . bp_get_messages_slug() . '/' . bp_current_action() . '/delete/' . $messages_template->thread->thread_id ), 'messages_delete_thread' ), $user_id ); 333 364 } 334 365 … … 339 370 * 340 371 * @since 2.2.0 341 */ 342 function bp_the_message_thread_mark_unread_url() { 343 echo esc_url( bp_get_the_message_thread_mark_unread_url() ); 372 * @since 2.9.0 Introduced `$user_id` parameter. 373 * 374 * @param int $user_id Optional. ID of the user relative to whom the link 375 * should be generated. Default: ID of logged-in user. 376 */ 377 function bp_the_message_thread_mark_unread_url( $user_id = null ) { 378 echo esc_url( bp_get_the_message_thread_mark_unread_url( $user_id ) ); 344 379 } 345 380 /** … … 347 382 * 348 383 * @since 2.2.0 349 * 350 * @return string 351 */ 352 function bp_get_the_message_thread_mark_unread_url() { 384 * @since 2.9.0 Introduced `$user_id` parameter. 385 * 386 * @param int $user_id Optional. ID of the user relative to whom the link 387 * should be generated. Default: ID of logged-in user. 388 * @return string 389 */ 390 function bp_get_the_message_thread_mark_unread_url( $user_id = null ) { 353 391 354 392 // Get the message ID. … … 361 399 ); 362 400 401 if ( null === $user_id ) { 402 $user_id = bp_loggedin_user_id(); 403 } 404 405 $domain = bp_core_get_user_domain( $user_id ); 406 363 407 // Base unread URL. 364 $url = trailingslashit( bp_displayed_user_domain(). bp_get_messages_slug() . '/' . bp_current_action() . '/unread' );408 $url = trailingslashit( $domain . bp_get_messages_slug() . '/' . bp_current_action() . '/unread' ); 365 409 366 410 // Add the args to the URL. … … 374 418 * 375 419 * @since 2.2.0 376 * 377 * @param string $url URL used for marking a single message thread as unread. 378 */ 379 return apply_filters( 'bp_get_the_message_thread_mark_unread_url', $url ); 420 * @since 2.9.0 Added `$user_id` parameter. 421 * 422 * @param string $url URL used for marking a single message thread as unread. 423 * @param int $user_id ID of the user relative to whom the link should be generated. 424 */ 425 return apply_filters( 'bp_get_the_message_thread_mark_unread_url', $url, $user_id ); 380 426 } 381 427 … … 386 432 * 387 433 * @since 2.2.0 388 */ 389 function bp_the_message_thread_mark_read_url() { 390 echo esc_url( bp_get_the_message_thread_mark_read_url() ); 434 * @since 2.9.0 Introduced `$user_id` parameter. 435 * 436 * @param int $user_id Optional. ID of the user relative to whom the link 437 * should be generated. Default: ID of logged-in user. 438 */ 439 function bp_the_message_thread_mark_read_url( $user_id = null ) { 440 echo esc_url( bp_get_the_message_thread_mark_read_url( $user_id ) ); 391 441 } 392 442 /** … … 394 444 * 395 445 * @since 2.2.0 396 * 397 * @return string 398 */ 399 function bp_get_the_message_thread_mark_read_url() { 446 * @since 2.9.0 Introduced `$user_id` parameter. 447 * 448 * @param int $user_id Optional. ID of the user relative to whom the link 449 * should be generated. Default: ID of logged-in user. 450 * @return string 451 */ 452 function bp_get_the_message_thread_mark_read_url( $user_id = null ) { 400 453 401 454 // Get the message ID. … … 408 461 ); 409 462 463 if ( null === $user_id ) { 464 $user_id = bp_loggedin_user_id(); 465 } 466 467 $domain = bp_core_get_user_domain( $user_id ); 468 410 469 // Base read URL. 411 $url = trailingslashit( bp_displayed_user_domain(). bp_get_messages_slug() . '/' . bp_current_action() . '/read' );470 $url = trailingslashit( $domain . bp_get_messages_slug() . '/' . bp_current_action() . '/read' ); 412 471 413 472 // Add the args to the URL. … … 422 481 * @since 2.2.0 423 482 * 424 * @param string $url URL used for marking a single message thread as read. 483 * @param string $url URL used for marking a single message thread as read. 484 * @param int $user_id ID of the user relative to whom the link should be generated. 425 485 */ 426 486 return apply_filters( 'bp_get_the_message_thread_mark_read_url', $url ); -
trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php
r11591 r11644 116 116 117 117 <td class="thread-info"> 118 <p><a href="<?php bp_message_thread_view_link( ); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( "View Message", 'buddypress' ); ?>" aria-label="<?php esc_attr_e( "View Message", 'buddypress' ); ?>"><?php bp_message_thread_subject(); ?></a></p>118 <p><a href="<?php bp_message_thread_view_link( bp_get_message_thread_id(), bp_displayed_user_id() ); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( "View Message", 'buddypress' ); ?>" aria-label="<?php esc_attr_e( "View Message", 'buddypress' ); ?>"><?php bp_message_thread_subject(); ?></a></p> 119 119 <p class="thread-excerpt"><?php bp_message_thread_excerpt(); ?></p> 120 120 </td> … … 140 140 <td class="thread-options"> 141 141 <?php if ( bp_message_thread_has_unread() ) : ?> 142 <a class="read" href="<?php bp_the_message_thread_mark_read_url( );?>"><?php _e( 'Read', 'buddypress' ); ?></a>142 <a class="read" href="<?php bp_the_message_thread_mark_read_url( bp_displayed_user_id() );?>"><?php _e( 'Read', 'buddypress' ); ?></a> 143 143 <?php else : ?> 144 <a class="unread" href="<?php bp_the_message_thread_mark_unread_url( );?>"><?php _e( 'Unread', 'buddypress' ); ?></a>144 <a class="unread" href="<?php bp_the_message_thread_mark_unread_url( bp_displayed_user_id() );?>"><?php _e( 'Unread', 'buddypress' ); ?></a> 145 145 <?php endif; ?> 146 146 | 147 <a class="delete" href="<?php bp_message_thread_delete_link( ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a>147 <a class="delete" href="<?php bp_message_thread_delete_link( bp_displayed_user_id() ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a> 148 148 149 149 <?php
Note: See TracChangeset
for help on using the changeset viewer.