Ticket #3402: 3402.diff
File 3402.diff, 1.1 KB (added by , 4 years ago) |
---|
-
includes/users/template.php
function bbp_user_nicename( $user_id = 0 477 477 $user_id = bbp_get_user_id( $user_id ); 478 478 if ( empty( $user_id ) ) { 479 479 return false; 480 480 } 481 481 482 482 // Parse default arguments 483 483 $r = bbp_parse_args( $args, array( 484 484 'user_id' => $user_id, 485 485 'before' => '', 486 486 'after' => '', 487 487 'force' => '' 488 488 ), 'get_user_nicename' ); 489 489 490 490 // Get the user data and nicename 491 491 if ( empty( $r['force'] ) ) { 492 $user = get_userdata( $user_id ); 492 $user = get_userdata( $user_id ); 493 if ( ! $user ) { 494 return false; 495 } 496 493 497 $nicename = $user->user_nicename; 494 498 495 499 // Force the nicename to something else 496 500 } else { 497 501 $nicename = (string) $r['force']; 498 502 } 499 503 500 504 // Maybe wrap the nicename 501 505 $retval = ! empty( $nicename ) 502 506 ? $r['before'] . esc_html( $nicename ) . $r['after'] 503 507 : ''; 504 508 505 509 // Filter & return 506 510 return (string) apply_filters( 'bbp_get_user_nicename', $retval, $user_id, $r, $args ); 507 511 }