Changeset 9960
- Timestamp:
- 06/22/2015 02:14:25 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-template.php
r9959 r9960 524 524 * admin. Filter 'bp_get_blog_avatar_' . $blog_id to customize. 525 525 * 526 * @since BuddyPress (2.4.0) Introduced `$title` argument. 527 * 526 528 * @see bp_core_fetch_avatar() For a description of arguments and 527 529 * return values. … … 533 535 * @type string $alt Default: 'Profile picture of site author [user name]'. 534 536 * @type string $class Default: 'avatar'. 537 * @type string $title Default: 'Profile picture of site author [user name]'. 535 538 * @type string $type Default: 'full'. 536 539 * @type int|bool $width Default: false. … … 550 553 } 551 554 555 $author_displayname = bp_core_get_user_displayname( $blogs_template->blog->admin_user_id ); 556 552 557 // Parse the arguments 553 558 $r = bp_parse_args( $args, array( … … 556 561 'height' => false, 557 562 'class' => 'avatar', 563 'title' => sprintf( __( 'Profile picture of site author %s', 'buddypress' ), esc_attr( $author_displayname ) ), 558 564 'id' => false, 559 'alt' => sprintf( __( 'Profile picture of site author %s', 'buddypress' ), bp_core_get_user_displayname( $blogs_template->blog->admin_user_id) ),565 'alt' => sprintf( __( 'Profile picture of site author %s', 'buddypress' ), esc_attr( $author_displayname ) ), 560 566 'no_grav' => true, 561 567 ) ); … … 564 570 $avatar = bp_core_fetch_avatar( array( 565 571 'item_id' => $blogs_template->blog->admin_user_id, 566 'title' => $ blogs_template->blog->admin_user_email,572 'title' => $r['title'], 567 573 //'avatar_dir' => 'blog-avatars', 568 574 //'object' => 'blog', -
trunk/tests/phpunit/testcases/blogs/template.php
r9819 r9960 367 367 $_REQUEST = $request; 368 368 } 369 370 /** 371 * @ticket BP6519 372 */ 373 public function test_bp_blog_get_avatar_should_respect_title_parameter() { 374 global $blogs_template; 375 376 if ( isset( $blogs_template ) ) { 377 $_blogs_template = $blogs_template; 378 } 379 380 $user = $this->factory->user->create_and_get(); 381 382 $blogs_template = new stdClass; 383 $blogs_template->blog = new stdClass; 384 $blogs_template->blog->blog_id = get_current_blog_id(); 385 $blogs_template->blog->admin_user_id = $user->ID; 386 $blogs_template->blog->admin_user_email = $user->user_email; 387 388 $actual = bp_get_blog_avatar( array( 389 'title' => 'Foo', 390 ) ); 391 392 if ( isset( $_blogs_template ) ) { 393 $blogs_template = $_blogs_template; 394 } else { 395 unset( $blogs_template ); 396 } 397 398 $this->assertContains( 'title="Foo"', $actual ); 399 } 400 401 /** 402 * @ticket BP6519 403 */ 404 public function test_bp_blog_get_avatar_title_attribute_should_default_to_user_displayname() { 405 global $blogs_template; 406 407 if ( isset( $blogs_template ) ) { 408 $_blogs_template = $blogs_template; 409 } 410 411 $user = $this->factory->user->create_and_get(); 412 413 $blogs_template = new stdClass; 414 $blogs_template->blog = new stdClass; 415 $blogs_template->blog->blog_id = get_current_blog_id(); 416 $blogs_template->blog->admin_user_id = $user->ID; 417 $blogs_template->blog->admin_user_email = $user->user_email; 418 419 $actual = bp_get_blog_avatar(); 420 421 if ( isset( $_blogs_template ) ) { 422 $blogs_template = $_blogs_template; 423 } else { 424 unset( $blogs_template ); 425 } 426 427 $this->assertContains( 'title="Profile picture of site author ' . bp_core_get_user_displayname( $user->ID ) . '"', $actual ); 428 } 369 429 }
Note: See TracChangeset
for help on using the changeset viewer.