Changeset 6519
- Timestamp:
- 06/10/2017 08:42:23 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/users/capabilities.php
r6438 r6519 798 798 * Add a moderator to an object 799 799 * 800 * @since 2.6.0 bbPRess 801 * 802 * @param int $object_id Traditionally a forum ID, but could be useful 803 * @param int $user_id 804 * 805 * @return @mixed 806 */ 807 function bbp_add_moderator( $object_id = 0, $user_id = 0 ) { 808 return bbp_add_user_to_object( $object_id, $user_id, '_bbp_moderator_id' ); 800 * @since 2.6.0 bbPress (r6056) 801 * 802 * @param int $object_id Traditionally a post ID 803 * @param int $user_id User ID 804 * @param string $object_type Type of meta (post,term,user,comment) 805 * 806 * @return bool 807 */ 808 function bbp_add_moderator( $object_id = 0, $user_id = 0, $object_type = 'post' ) { 809 return bbp_add_user_to_object( $object_id, $user_id, '_bbp_moderator_id', $object_type ); 809 810 } 810 811 … … 812 813 * Remove a moderator user ID from an object 813 814 * 814 * @since 2.6.0 bbPress 815 * 816 * @param int $object_id 817 * @param int $user_id 815 * @since 2.6.0 bbPress (r6056) 816 * 817 * @param int $object_id Traditionally a post ID 818 * @param int $user_id User ID 819 * @param string $object_type Type of meta (post,term,user,comment) 818 820 * 819 821 * @return bool 820 822 */ 821 function bbp_remove_moderator( $object_id = 0, $user_id = 0 ) {822 return bbp_remove_user_from_object( $object_id, $user_id, '_bbp_moderator_id' );823 function bbp_remove_moderator( $object_id = 0, $user_id = 0, $object_type = 'post' ) { 824 return bbp_remove_user_from_object( $object_id, $user_id, '_bbp_moderator_id', $object_type ); 823 825 } 824 826 … … 826 828 * Get user IDs of moderators for an object 827 829 * 828 * @since 2.6.0 bbPress 829 * 830 * @param int $object_id 831 * 832 * @return mixed 833 */ 834 function bbp_get_moderator_ids( $object_id = 0 ) { 835 return bbp_get_users_for_object( $object_id, '_bbp_moderator_id' ); 830 * @since 2.6.0 bbPress (r6056) 831 * 832 * @param int $object_id Traditionally a post ID 833 * @param string $object_type Type of meta (post,term,user,comment) 834 * 835 * @return array 836 */ 837 function bbp_get_moderator_ids( $object_id = 0, $object_type = 'post' ) { 838 return bbp_get_users_for_object( $object_id, '_bbp_moderator_id', $object_type ); 836 839 } 837 840 … … 840 843 * object ID is empty. 841 844 * 842 * @since 2.6.0 bbPress 843 * 844 * @param int $object_id 845 * @since 2.6.0 bbPress (r6056) 846 * 847 * @param int $object_id Traditionally a post ID 848 * @param string $object_type Type of meta (post,term,user,comment) 845 849 * 846 850 * @return array 847 851 */ 848 function bbp_get_moderators( $object_id = 0 ) {852 function bbp_get_moderators( $object_id = 0, $object_type = 'post' ) { 849 853 850 854 // Get global moderators … … 857 861 } else { 858 862 $users = get_users( array( 859 'include' => bbp_get_moderator_ids( $object_id ),863 'include' => bbp_get_moderator_ids( $object_id, $object_type ), 860 864 ) ); 861 865 } 862 866 863 867 // Filter & return 864 return (array) apply_filters( 'bbp_get_moderators', $users, $object_id );865 } 868 return (array) apply_filters( 'bbp_get_moderators', $users, $object_id, $object_type ); 869 }
Note: See TracChangeset
for help on using the changeset viewer.