Ticket #1815: 1815.02.diff
File 1815.02.diff, 10.7 KB (added by , 13 years ago) |
---|
-
bbp-theme-compat/css/bbpress-rtl.css
183 183 word-wrap: break-word; 184 184 } 185 185 186 li.bbp-body div.bbp-topic-author .bbp-author-role, 187 li.bbp-body div.bbp-reply-author .bbp-author-role { 188 font-size: 11px; 189 font-style: italic; 190 } 191 186 192 li.bbp-body div.bbp-topic-content, 187 193 li.bbp-body div.bbp-reply-content { 188 194 margin-right: 140px; -
bbp-theme-compat/css/bbpress.css
201 201 word-break: break-word; 202 202 } 203 203 204 li.bbp-body div.bbp-topic-author .bbp-author-role, 205 li.bbp-body div.bbp-reply-author .bbp-author-role { 206 font-size: 11px; 207 font-style: italic; 208 } 209 204 210 li.bbp-body div.bbp-topic-content, 205 211 li.bbp-body div.bbp-reply-content { 206 212 margin-left: 140px; -
bbp-themes/bbp-twentyten/css/bbpress-rtl.css
143 143 vertical-align: top; 144 144 } 145 145 146 #content td.bbp-topic-author .bbp-author-role, 147 #content td.bbp-reply-author .bbp-author-role { 148 font-size: 11px; 149 font-style: italic; 150 } 151 146 152 .bbp-topic-title { 147 153 width: 55%; 148 154 text-align: right; -
bbp-themes/bbp-twentyten/css/bbpress.css
139 139 text-align: center; 140 140 vertical-align: top; 141 141 } 142 #content td.bbp-topic-author .bbp-author-role, 143 #content td.bbp-reply-author .bbp-author-role { 144 font-size: 11px; 145 font-style: italic; 146 } 142 147 .bbp-topic-title { 143 148 width: 55%; 144 149 text-align: left; -
bbp-includes/bbp-reply-template.php
949 949 * @uses bbp_get_reply_author() To get the reply author name 950 950 * @uses bbp_get_reply_author_url() To get the reply author url 951 951 * @uses bbp_get_reply_author_avatar() To get the reply author avatar 952 * bbp_get_reply_author_display_name() To get the reply author display952 * @uses bbp_get_reply_author_display_name() To get the reply author display 953 953 * name 954 * @uses bbp_get_user_display_role() To get the reply author display role 955 * @uses bbp_get_reply_author_id() To get the reply author id 954 956 * @uses apply_filters() Calls 'bbp_get_reply_author_link' with the 955 957 * author link and args 956 958 * @return string Author link of reply … … 961 963 'link_title' => '', 962 964 'type' => 'both', 963 965 'size' => 80, 964 'sep' => ' ' 966 'sep' => ' ', 967 'show_role' => true 965 968 ); 966 969 $r = bbp_parse_args( $args, $defaults, 'get_reply_author_link' ); 967 970 extract( $r ); … … 997 1000 $link_class = ' class="bbp-author-' . $link . '"'; 998 1001 $author_link[] = sprintf( '<a href="%1$s"%2$s%3$s>%4$s</a>', $author_url, $link_title, $link_class, $link_text ); 999 1002 } 1003 1004 if ( true === $show_role ) 1005 $author_link[] = bbp_get_reply_author_role( array( 'reply_id' => $reply_id ) ); 1006 1000 1007 $author_link = join( $sep, $author_link ); 1001 1008 1002 1009 // No links if anonymous … … 1109 1116 } 1110 1117 1111 1118 /** 1119 * Output the reply author role 1120 * 1121 * @since bbPress (r3857) 1122 * 1123 * @param array $args Optional. 1124 * @uses bbp_get_reply_author_role() To get the reply author role 1125 */ 1126 function bbp_reply_author_role( $args = array() ) { 1127 echo bbp_get_reply_author_role( $args ); 1128 } 1129 /** 1130 * Return the reply author role 1131 * 1132 * @since bbPress (r3857) 1133 * 1134 * @param array $args Optional. 1135 * @uses bbp_get_reply_id() To get the reply id 1136 * @uses bbp_get_user_display_role() To get the user display role 1137 * @uses bbp_get_reply_author_id() To get the reply author id 1138 * @uses apply_filters() Calls bbp_get_reply_author_role with the author 1139 * role & args 1140 * @return string Reply author role 1141 */ 1142 function bbp_get_reply_author_role( $args = array() ) { 1143 $defaults = array( 1144 'reply_id' => 0, 1145 'class' => 'bbp-author-role', 1146 'before' => '', 1147 'after' => '' 1148 ); 1149 $args = bbp_parse_args( $args, $defaults, 'get_reply_author_role' ); 1150 extract( $args, EXTR_SKIP ); 1151 1152 $reply_id = bbp_get_reply_id( $reply_id ); 1153 1154 // Get role 1155 $role = bbp_get_user_display_role( bbp_get_reply_author_id( $reply_id ) ); 1156 1157 // Setup HTML 1158 $author_role = sprintf( '%1$s<div class="%2$s">%3$s</div>%4$s', $before, $class, $role, $after ); 1159 1160 return apply_filters( 'bbp_get_reply_author_role', $author_role, $args ); 1161 } 1162 1163 /** 1112 1164 * Output the topic title a reply belongs to 1113 1165 * 1114 1166 * @since bbPress (r2553) … … 1747 1799 $classes[] = 'bbp-parent-forum-' . bbp_get_reply_forum_id( $reply_id ); 1748 1800 $classes[] = 'bbp-parent-topic-' . bbp_get_reply_topic_id( $reply_id ); 1749 1801 $classes[] = 'user-id-' . bbp_get_reply_author_id( $reply_id ); 1750 $classes[] = ( bbp_get_reply_author_id( $reply_id ) == bbp_get_topic_author_id( bbp_get_reply_topic_id( $reply_id ) ) ? 'topic-author' : '' ); 1802 $classes[] = ( bbp_get_reply_author_id( $reply_id ) == bbp_get_topic_author_id( bbp_get_reply_topic_id( $reply_id ) ) ? 'topic-author' : '' ); 1751 1803 $classes = array_filter( $classes ); 1752 1804 $classes = get_post_class( $classes, $reply_id ); 1753 1805 $classes = apply_filters( 'bbp_get_reply_class', $classes, $reply_id ); -
bbp-includes/bbp-user-template.php
402 402 } 403 403 404 404 /** 405 * Return a user's main role 406 * 407 * @since bbPress (r3857) 408 * 409 * @param int $user_id 410 * @uses bbp_get_user_id() To get the user id 411 * @uses get_userdata() To get the user data 412 * @uses apply_filters() Calls 'bbp_get_user_role' with the 413 * role and user id 414 * @return string 415 */ 416 function bbp_get_user_role( $user_id = 0 ) { 417 // Validate user id 418 $user_id = bbp_get_user_id( $user_id, false ); 419 420 // Get userdata 421 $user = get_userdata( $user_id ); 422 423 // Get the user's main role 424 $role = 'anonymous'; 425 if ( isset( $user->roles ) ) 426 $role = array_shift( $user->roles ); 427 428 return apply_filters( 'bbp_get_user_role', $role, $user_id ); 429 } 430 431 /** 432 * Output a user's main role for display 433 * 434 * @since bbPress (r3857) 435 * 436 * @param int $user_id 437 * @uses bbp_get_user_display_role To get the user display role 438 */ 439 function bbp_user_display_role( $user_id = 0 ) { 440 echo bbp_get_user_display_role( $user_id ); 441 } 442 /** 443 * Return a user's main role for display 444 * 445 * @since bbPress (r3857) 446 * 447 * @param int $user_id 448 * @uses bbp_get_user_role() To get the main user role 449 * @uses bbp_get_moderator_role() To get the moderator role 450 * @uses bbp_get_participant_role() To get the participant role 451 * @uses bbp_get_moderator_role() To get the moderator role 452 * @uses apply_filters() Calls 'bbp_get_user_display_role' with the 453 * display role, user id, and user role 454 * @return string 455 */ 456 function bbp_get_user_display_role( $user_id = 0 ) { 457 // Get user role 458 $user_role = bbp_get_user_role( $user_id ); 459 460 // Set default, but if all goes well 461 // this will never be presented 462 $role = __( 'The Matrix', 'bbpress' ); 463 464 // Get the user's main role for display 465 switch ( $user_role ) { 466 // Administrator 467 case 'administrator': 468 $role = __( 'Key Master', 'bbpress' ); 469 470 break; 471 472 // Moderator 473 case bbp_get_moderator_role(): 474 $role = __( 'Moderator', 'bbpress' ); 475 476 break; 477 478 // Anonymous 479 case 'anonymous': 480 $role = __( 'Not Registered', 'bbpress' ); 481 482 break; 483 484 // WordPress Core Roles 485 case 'editor' : 486 case 'author' : 487 case 'contributor' : 488 case 'subscriber' : 489 490 // bbPress Participant Role 491 case bbp_get_participant_role() : 492 $role = __( 'Member', 'bbpress' ); 493 494 break; 495 496 // Any other role 497 default : 498 global $wp_roles; 499 500 // Load roles if not set 501 if ( !isset( $wp_roles ) ) 502 $wp_roles = new WP_Roles(); 503 504 // Set a default 505 $role = __( 'Member', 'bbpress' ); 506 507 // Get a translated role name 508 if ( !empty( $wp_roles->role_names[$user_role] ) ) 509 $role = translate_user_role( $wp_roles->role_names[$user_role] ); 510 511 break; 512 } 513 514 return apply_filters( 'bbp_get_user_display_role', $role, $user_id, $user_role ); 515 } 516 517 /** 405 518 * Output the link to the admin section 406 519 * 407 520 * @since bbPress (r2827) … … 1446 1559 1447 1560 /** 1448 1561 * Output a users topic count 1449 * 1562 * 1450 1563 * @since bbPress (r3632) 1451 1564 * 1452 1565 * @param int $user_id 1453 1566 * @uses bbp_get_user_topic_count() 1454 * @return string 1567 * @return string 1455 1568 */ 1456 1569 function bbp_user_topic_count( $user_id = 0 ) { 1457 1570 echo bbp_get_user_topic_count( $user_id ); 1458 1571 } 1459 1572 /** 1460 1573 * Return a users reply count 1461 * 1574 * 1462 1575 * @since bbPress (r3632) 1463 1576 * 1464 1577 * @param int $user_id 1465 1578 * @uses bbp_get_user_id() 1466 1579 * @uses get_user_meta() 1467 1580 * @uses apply_filters() 1468 * @return string 1581 * @return string 1469 1582 */ 1470 1583 function bbp_get_user_topic_count( $user_id = 0 ) { 1471 1584 … … 1481 1594 1482 1595 /** 1483 1596 * Output a users reply count 1484 * 1597 * 1485 1598 * @since bbPress (r3632) 1486 1599 * 1487 1600 * @param int $user_id 1488 1601 * @uses bbp_get_user_reply_count() 1489 * @return string 1602 * @return string 1490 1603 */ 1491 1604 function bbp_user_reply_count( $user_id = 0 ) { 1492 1605 echo bbp_get_user_reply_count( $user_id ); 1493 1606 } 1494 1607 /** 1495 1608 * Return a users reply count 1496 * 1609 * 1497 1610 * @since bbPress (r3632) 1498 1611 * 1499 1612 * @param int $user_id 1500 1613 * @uses bbp_get_user_id() 1501 1614 * @uses get_user_meta() 1502 1615 * @uses apply_filters() 1503 * @return string 1616 * @return string 1504 1617 */ 1505 1618 function bbp_get_user_reply_count( $user_id = 0 ) { 1506 1619 … … 1516 1629 1517 1630 /** 1518 1631 * Output a users total post count 1519 * 1632 * 1520 1633 * @since bbPress (r3632) 1521 1634 * 1522 1635 * @param int $user_id 1523 1636 * @uses bbp_get_user_post_count() 1524 * @return string 1637 * @return string 1525 1638 */ 1526 1639 function bbp_user_post_count( $user_id = 0 ) { 1527 1640 echo bbp_get_user_post_count( $user_id ); 1528 1641 } 1529 1642 /** 1530 1643 * Return a users total post count 1531 * 1644 * 1532 1645 * @since bbPress (r3632) 1533 1646 * 1534 1647 * @param int $user_id 1535 1648 * @uses bbp_get_user_id() 1536 1649 * @uses get_user_meta() 1537 1650 * @uses apply_filters() 1538 * @return string 1651 * @return string 1539 1652 */ 1540 1653 function bbp_get_user_post_count( $user_id = 0 ) { 1541 1654 1542 1655 // Validate user id 1543 1656 $user_id = bbp_get_user_id( $user_id ); 1544 1657 if ( empty( $user_id ) )