Changeset 4783
- Timestamp:
- 02/28/2013 05:15:01 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
-
includes/admin/users.php (modified) (3 diffs)
-
includes/common/functions.php (modified) (4 diffs)
-
includes/extend/buddypress/group.php (modified) (4 diffs)
-
includes/forums/functions.php (modified) (6 diffs)
-
includes/forums/template-tags.php (modified) (1 diff)
-
includes/topics/template-tags.php (modified) (1 diff)
-
includes/users/capabilities.php (modified) (7 diffs)
-
includes/users/functions.php (modified) (3 diffs)
-
includes/users/template-tags.php (modified) (19 diffs)
-
templates/default/bbpress/content-single-topic-lead.php (modified) (1 diff)
-
templates/default/bbpress/loop-search-reply.php (modified) (1 diff)
-
templates/default/bbpress/loop-search-topic.php (modified) (1 diff)
-
templates/default/bbpress/loop-single-reply.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/admin/users.php
r4682 r4783 77 77 78 78 // Only keymasters can set other keymasters 79 if ( ! current_user_can( 'keep_gate') )79 if ( ! bbp_is_user_keymaster() ) 80 80 unset( $dynamic_roles[ bbp_get_keymaster_role() ] ); ?> 81 81 … … 133 133 134 134 // Only keymasters can set other keymasters 135 if ( ! current_user_can( 'keep_gate') )135 if ( ! bbp_is_user_keymaster() ) 136 136 unset( $dynamic_roles[ bbp_get_keymaster_role() ] ); ?> 137 137 … … 190 190 191 191 // Only keymasters can set other keymasters 192 if ( in_array( bbp_get_keymaster_role(), array( $user_role, $new_role ) ) && ! current_user_can( 'keep_gate') )192 if ( in_array( bbp_get_keymaster_role(), array( $user_role, $new_role ) ) && ! bbp_is_user_keymaster() ) 193 193 continue; 194 194 -
trunk/includes/common/functions.php
r4775 r4783 762 762 * @param string $title The title of the content 763 763 * @param string $content The content being posted 764 * @uses is_super_admin() Allow super admins to bypass blacklist764 * @uses bbp_is_user_keymaster() Allow keymasters to bypass blacklist 765 765 * @uses bbp_current_author_ip() To get current user IP address 766 766 * @uses bbp_current_author_ua() To get current user agent … … 773 773 return true; 774 774 775 // Bail if super adminis author776 if ( is_super_admin( $author_id ) )775 // Bail if keymaster is author 776 if ( bbp_is_user_keymaster( $author_id ) ) 777 777 return true; 778 778 … … 881 881 * @param string $title The title of the content 882 882 * @param string $content The content being posted 883 * @uses is_super_admin() Allow super admins to bypass blacklist883 * @uses bbp_is_user_keymaster() Allow keymasters to bypass blacklist 884 884 * @uses bbp_current_author_ip() To get current user IP address 885 885 * @uses bbp_current_author_ua() To get current user agent … … 892 892 return true; 893 893 894 // Bail if super adminis author895 if ( is_super_admin( $author_id ) )894 // Bail if keymaster is author 895 if ( bbp_is_user_keymaster( $author_id ) ) 896 896 return true; 897 897 -
trunk/includes/extend/buddypress/group.php
r4777 r4783 261 261 </div> 262 262 263 <?php if ( is_super_admin() ) : ?>263 <?php if ( bbp_is_user_keymaster() ) : ?> 264 264 <div class="field-group"> 265 265 <label for="bbp_group_forum_id"><?php _e( 'Group Forum:', 'bbpress' ); ?></label> … … 307 307 $group_id = bp_get_current_group_id(); 308 308 309 // Super admins have the ability to reconfigure forums310 if ( is_super_admin() ) {309 // Keymasters have the ability to reconfigure forums 310 if ( bbp_is_user_keymaster() ) { 311 311 $forum_ids = ! empty( $_POST['bbp_group_forum_id'] ) ? (array) (int) $_POST['bbp_group_forum_id'] : array(); 312 312 … … 869 869 * @param bool $retval Are we allowed to view the reply form? 870 870 * @uses bp_is_group() To determine if we're on a group page 871 * @uses bp_loggedin_user_id() To determine if a user is logged in. 872 * @uses bp_group_is_member() Is the current user a member of the group? 873 * @uses bp_group_is_user_banned() Is the current user banned from the group? 871 * @uses is_user_logged_in() To determine if a user is logged in. 872 * @uses bbp_is_user_keymaster() Is the current user a keymaster? 873 * @uses bbp_group_is_member() Is the current user a member of the group? 874 * @uses bbp_group_is_user_banned() Is the current user banned from the group? 874 875 * 875 876 * @return bool … … 886 887 return $retval; 887 888 888 // Admins can always pass go889 } elseif ( is_super_admin() ) {889 // Keymasters can always pass go 890 } elseif ( bbp_is_user_keymaster() ) { 890 891 $retval = true; 891 892 -
trunk/includes/forums/functions.php
r4724 r4783 1536 1536 * @param string Optional. The type of value to return. (string|array|meta_query) 1537 1537 * 1538 * @uses is_super_admin()1538 * @uses bbp_is_user_keymaster() 1539 1539 * @uses bbp_get_hidden_forum_ids() 1540 1540 * @uses bbp_get_private_forum_ids() … … 1561 1561 } 1562 1562 1563 // Exclude for everyone but super admins1564 if ( ! is_super_admin() ) {1563 // Exclude for everyone but keymasters 1564 if ( ! bbp_is_user_keymaster() ) { 1565 1565 1566 1566 // Private forums … … 1795 1795 * @uses current_user_can() To check if the current user can read private forums 1796 1796 * @uses is_singular() To check if it's a singular page 1797 * @uses bbp_is_user_keymaster() To check if user is a keymaster 1797 1798 * @uses bbp_get_forum_post_type() To get the forum post type 1798 1799 * @uses bbp_get_topic_post_type() To get the topic post type … … 1806 1807 1807 1808 // Bail if not viewing a single item or if user has caps 1808 if ( !is_singular() || is_super_admin() || current_user_can( 'read_hidden_forums' ) )1809 if ( !is_singular() || bbp_is_user_keymaster() || current_user_can( 'read_hidden_forums' ) ) 1809 1810 return; 1810 1811 … … 1847 1848 * @uses current_user_can() To check if the current user can read private forums 1848 1849 * @uses is_singular() To check if it's a singular page 1850 * @uses bbp_is_user_keymaster() To check if user is a keymaster 1849 1851 * @uses bbp_get_forum_post_type() To get the forum post type 1850 1852 * @uses bbp_get_topic_post_type() To get the topic post type … … 1858 1860 1859 1861 // Bail if not viewing a single item or if user has caps 1860 if ( !is_singular() || is_super_admin() || current_user_can( 'read_private_forums' ) )1862 if ( !is_singular() || bbp_is_user_keymaster() || current_user_can( 'read_private_forums' ) ) 1861 1863 return; 1862 1864 -
trunk/includes/forums/template-tags.php
r4775 r4783 624 624 625 625 // Super admin get whitelisted post statuses 626 if ( is_super_admin() ) {626 if ( bbp_is_user_keymaster() ) { 627 627 $post_stati = array( bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id() ); 628 628 629 // Not a super admin, so check caps629 // Not a keymaster, so check caps 630 630 } else { 631 631 -
trunk/includes/topics/template-tags.php
r4781 r4783 2891 2891 $tab = !empty( $r['tab'] ) ? ' tabindex="' . $r['tab'] . '"' : ''; 2892 2892 $select_id = esc_attr( $r['select_id'] ); 2893 $sticky_statuses = array (2893 $sticky_statuses = array_filter( array( 2894 2894 'unstick' => $r['unstick_text'], 2895 2895 'stick' => $r['stick_text'], 2896 2896 'super' => $r['super_text'], 2897 ) ; ?>2897 ) ); ?> 2898 2898 2899 2899 <select name="<?php echo $select_id; ?>" id="<?php echo $select_id; ?>"<?php echo $tab; ?>> -
trunk/includes/users/capabilities.php
r4758 r4783 364 364 * @uses bbp_is_user_home() 365 365 * @uses bbp_get_displayed_user_field() 366 * @uses is_super_admin()366 * @uses bbp_is_user_keymaster() 367 367 * @uses get_blogs_of_user() 368 368 * @uses get_current_blog_id() … … 387 387 return false; 388 388 389 // Bail if user ID is super admin390 if ( is_super_admin( $user_id ) )389 // Bail if user ID is keymaster 390 if ( bbp_is_user_keymaster( $user_id ) ) 391 391 return false; 392 392 … … 453 453 * @uses bbp_is_user_home() 454 454 * @uses bbp_get_displayed_user_field() 455 * @uses is_super_admin()455 * @uses bbp_is_user_keymaster() 456 456 * @uses get_blogs_of_user() 457 457 * @uses bbp_get_topic_post_type() … … 475 475 return false; 476 476 477 // Bail if user ID is super admin478 if ( is_super_admin( $user_id ) )477 // Bail if user ID is keymaster 478 if ( bbp_is_user_keymaster( $user_id ) ) 479 479 return false; 480 480 … … 628 628 629 629 /** 630 * Checks if user is a keymaster 631 * 632 * @since bbPress (r4783) 633 * 634 * @param int $user_id 635 * @return bool True if keymaster, false if not 636 */ 637 function bbp_is_user_keymaster( $user_id = 0 ) { 638 639 // Default to current user ID if none is passed 640 $_user_id = (int) ! empty( $user_id ) ? $user_id : bbp_get_current_user_id(); 641 642 // Filter and return 643 return (bool) apply_filters( 'bbp_is_user_keymaster', user_can( $user_id, 'keep_gate' ), $_user_id, $user_id ); 644 } 645 646 /** 630 647 * Does a user have a profile for the current site 631 648 * … … 637 654 * @uses bbp_get_user_id() To verify the user ID 638 655 * @uses get_userdata() To get the user's data 639 * @uses is_super_admin() To determine if user can see inactive users656 * @uses bbp_is_user_keymaster() To determine if user can see inactive users 640 657 * @uses bbp_is_user_inactive() To check if user is spammer or deleted 641 658 * @uses apply_filters() To allow override of this functions result … … 658 675 $retval = false; 659 676 660 // User is inactive, and current user is not a super admin661 } elseif ( ! is_super_admin() && bbp_is_user_inactive( $user->ID ) ) {677 // User is inactive, and current user is not a keymaster 678 } elseif ( ! bbp_is_user_keymaster() && bbp_is_user_inactive( $user->ID ) ) { 662 679 $retval = false; 663 680 } -
trunk/includes/users/functions.php
r4715 r4783 859 859 * @uses wpdb::get_blog_prefix() To get the blog prefix 860 860 * @uses is_network_admin() To check if the user is the network admin 861 * @uses is_super_admin() To check if the user is super admin862 861 * @uses revoke_super_admin() To revoke super admin priviledges 863 862 * @uses grant_super_admin() To grant super admin priviledges … … 1093 1092 * 1094 1093 * @uses is_user_logged_in() To check if user is logged in 1095 * @uses is_super_admin() To check if user is a super admin1094 * @uses bbp_is_user_keymaster() To check if user is a keymaster 1096 1095 * @uses current_user_can() To check if the current user can spectate 1097 1096 * @uses is_bbpress() To check if in a bbPress section of the site … … 1100 1099 function bbp_forum_enforce_blocked() { 1101 1100 1102 // Bail if not logged in or super admin1103 if ( ! is_user_logged_in() || is_super_admin() ) {1101 // Bail if not logged in or keymaster 1102 if ( ! is_user_logged_in() || bbp_is_user_keymaster() ) { 1104 1103 return; 1105 1104 } -
trunk/includes/users/template-tags.php
r4775 r4783 46 46 47 47 // Currently viewing or editing a user 48 } elseif ( ( true == $displayed_user_fallback ) && !empty( $bbp->displayed_user->ID ) ) {48 } elseif ( ( true === $displayed_user_fallback ) && !empty( $bbp->displayed_user->ID ) ) { 49 49 $bbp_user_id = $bbp->displayed_user->ID; 50 50 51 51 // Maybe fallback on the current_user ID 52 } elseif ( ( true == $current_user_fallback ) && !empty( $bbp->current_user->ID ) ) {52 } elseif ( ( true === $current_user_fallback ) && !empty( $bbp->current_user->ID ) ) { 53 53 $bbp_user_id = $bbp->current_user->ID; 54 54 … … 471 471 * @param int $user_id 472 472 * @uses bbp_get_user_id() to verify the user ID 473 * @uses is_super_admin() to check if user is a super admin473 * @uses bbp_is_user_keymaster() to check if user is a keymaster 474 474 * @uses bbp_is_user_inactive() to check if user is inactive 475 475 * @uses user_can() to check if user has special capabilities … … 484 484 485 485 // Capes earn Vinz Clortho status 486 if ( is_super_admin( $user_id ) ) {486 if ( bbp_is_user_keymaster( $user_id ) ) { 487 487 $role = __( 'Key Master', 'bbpress' ); 488 488 … … 1058 1058 1059 1059 // Only keymasters can set other keymasters 1060 if ( ! current_user_can( 'keep_gate') )1060 if ( ! bbp_is_user_keymaster() ) 1061 1061 unset( $dynamic_roles[ bbp_get_keymaster_role() ] ); ?> 1062 1062 … … 1474 1474 * @uses bbp_get_user_id() 1475 1475 * @uses current_user_can() 1476 * @uses is_super_admin()1476 * @uses bbp_is_user_keymaster() 1477 1477 * @uses bbp_is_forum_public() 1478 1478 * @uses bbp_is_forum_private() … … 1497 1497 $retval = false; 1498 1498 1499 // User is a super admin1500 if ( is_super_admin() ) {1499 // User is a keymaster 1500 if ( bbp_is_user_keymaster() ) { 1501 1501 $retval = true; 1502 1502 … … 1522 1522 * @since bbPress (r3127) 1523 1523 * 1524 * @uses is_super_admin()1524 * @uses bbp_is_user_keymaster() 1525 1525 * @uses is_user_logged_in() 1526 1526 * @uses bbp_allow_anonymous() … … 1536 1536 $retval = false; 1537 1537 1538 // Always allow super admins1539 if ( is_super_admin() ) {1538 // Always allow keymasters 1539 if ( bbp_is_user_keymaster() ) { 1540 1540 $retval = true; 1541 1541 … … 1558 1558 * @since bbPress (r3549) 1559 1559 * 1560 * @uses is_super_admin()1560 * @uses bbp_is_user_keymaster() 1561 1561 * @uses bbp_is_user_active() 1562 1562 * @uses current_user_can() … … 1570 1570 $retval = false; 1571 1571 1572 // Always allow super admins1573 if ( is_super_admin() ) {1572 // Always allow keymasters 1573 if ( bbp_is_user_keymaster() ) { 1574 1574 $retval = true; 1575 1575 … … 1588 1588 * @since bbPress (r3127) 1589 1589 * 1590 * @uses is_super_admin()1590 * @uses bbp_is_user_keymaster() 1591 1591 * @uses is_user_logged_in() 1592 1592 * @uses bbp_allow_anonymous() … … 1602 1602 $retval = false; 1603 1603 1604 // Always allow super admins1605 if ( is_super_admin() ) {1604 // Always allow keymasters 1605 if ( bbp_is_user_keymaster() ) { 1606 1606 $retval = true; 1607 1607 … … 1620 1620 1621 1621 /** Forms *********************************************************************/ 1622 1623 /** 1624 * The following functions should be turned into mapped meta capabilities in a 1625 * future version. They exist only to remove complex logistical capability 1626 * checks from within template parts. 1627 */ 1622 1628 1623 1629 /** … … 1675 1681 * @since bbPress (r3549) 1676 1682 * 1683 * @uses bbp_is_user_keymaster() 1677 1684 * @uses bbp_is_forum_edit() 1678 1685 * @uses current_user_can() … … 1686 1693 $retval = false; 1687 1694 1688 // Always allow super admins1689 if ( is_super_admin() ) {1695 // Always allow keymasters 1696 if ( bbp_is_user_keymaster() ) { 1690 1697 $retval = true; 1691 1698 … … 1708 1715 * @since bbPress (r3127) 1709 1716 * 1717 * @uses bbp_is_user_keymaster() 1710 1718 * @uses bbp_is_topic_edit() 1711 1719 * @uses current_user_can() … … 1721 1729 $retval = false; 1722 1730 1723 // Always allow super admins1724 if ( is_super_admin() ) {1731 // Always allow keymasters 1732 if ( bbp_is_user_keymaster() ) { 1725 1733 $retval = true; 1726 1734 … … 1743 1751 * @since bbPress (r3127) 1744 1752 * 1753 * @uses bbp_is_user_keymaster() 1745 1754 * @uses bbp_is_topic_edit() 1746 1755 * @uses current_user_can() … … 1756 1765 $retval = false; 1757 1766 1758 // Always allow super admins1759 if ( is_super_admin() ) {1767 // Always allow keymasters 1768 if ( bbp_is_user_keymaster() ) { 1760 1769 $retval = true; 1761 1770 -
trunk/templates/default/bbpress/content-single-topic-lead.php
r4733 r4783 58 58 <?php bbp_topic_author_link( array( 'sep' => '<br />', 'show_role' => true ) ); ?> 59 59 60 <?php if ( is_super_admin() ) : ?>60 <?php if ( bbp_is_user_keymaster() ) : ?> 61 61 62 62 <?php do_action( 'bbp_theme_before_topic_author_admin_details' ); ?> -
trunk/templates/default/bbpress/loop-search-reply.php
r4579 r4783 43 43 <?php bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => true ) ); ?> 44 44 45 <?php if ( is_super_admin() ) : ?>45 <?php if ( bbp_is_user_keymaster() ) : ?> 46 46 47 47 <?php do_action( 'bbp_theme_before_reply_author_admin_details' ); ?> -
trunk/templates/default/bbpress/loop-search-topic.php
r4579 r4783 63 63 <?php bbp_topic_author_link( array( 'sep' => '<br />', 'show_role' => true ) ); ?> 64 64 65 <?php if ( is_super_admin() ) : ?>65 <?php if ( bbp_is_user_keymaster() ) : ?> 66 66 67 67 <?php do_action( 'bbp_theme_before_topic_author_admin_details' ); ?> -
trunk/templates/default/bbpress/loop-single-reply.php
r4733 r4783 45 45 <?php bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => true ) ); ?> 46 46 47 <?php if ( is_super_admin() ) : ?>47 <?php if ( bbp_is_user_keymaster() ) : ?> 48 48 49 49 <?php do_action( 'bbp_theme_before_reply_author_admin_details' ); ?>
Note: See TracChangeset
for help on using the changeset viewer.