Changeset 4179
- Timestamp:
- 08/29/2012 04:30:07 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-core-caps.php
r4173 r4179 632 632 // Administrator 633 633 case 'administrator' : 634 635 634 $caps = array( 635 636 // General caps 637 'participate', 638 'moderate', 639 'throttle', 640 'view_trash', 636 641 637 642 // Forum caps … … 664 669 'edit_topic_tags', 665 670 'delete_topic_tags', 666 'assign_topic_tags', 667 668 // Misc 669 'moderate', 670 'throttle', 671 'view_trash' 671 'assign_topic_tags' 672 672 ); 673 673 … … 763 763 return; 764 764 765 // Bail if not logged in or already a member of this site 766 if ( ! is_user_logged_in() || is_user_member_of_blog() ) 767 return; 768 765 769 // Bail if user is marked as spam or is deleted 766 770 if ( bbp_is_user_inactive() ) 767 771 return; 768 772 769 // Normal user is logged in but not a member of this site 770 if ( is_user_logged_in() && ! is_user_member_of_blog() ) { 771 772 // Assign user the default role to map caps to 773 $default_role = get_option( 'default_role' ); 774 775 // Get bbPress caps for the default role 776 $caps_for_role = bbp_get_caps_for_role( $default_role ); 777 778 // Set all caps to true 779 foreach ( $caps_for_role as $cap ) { 780 $mapped_meta_caps[$cap] = true; 781 } 782 783 // Add 'read' cap just in case 784 $mapped_meta_caps['read'] = true; 785 $mapped_meta_caps['bbp_masked'] = true; 786 787 // Allow global access caps to be manipulated 788 $mapped_meta_caps = apply_filters( 'bbp_global_access_mapped_meta_caps', $mapped_meta_caps ); 789 790 // Assign the role and mapped caps to the current user 791 $bbp = bbpress(); 792 $bbp->current_user->roles[0] = $default_role; 793 $bbp->current_user->caps = $mapped_meta_caps; 794 $bbp->current_user->allcaps = $mapped_meta_caps; 795 } 773 // Assign user the default role to map caps to 774 $default_role = get_option( 'default_role', 'subscriber' ); 775 776 // Get bbPress caps for the default role 777 $caps_for_role = bbp_get_caps_for_role( $default_role ); 778 779 // Set all caps to true 780 foreach ( $caps_for_role as $cap ) 781 $default_caps[$cap] = true; 782 783 // Add 'read' cap just in case 784 $default_caps['read'] = true; 785 $default_caps['bbp_masked'] = true; 786 787 // Allow global access caps to be manipulated 788 $default_caps = apply_filters( 'bbp_global_access_default_caps', $default_caps ); 789 790 // Assign the role and mapped caps to the current user 791 $bbp = bbpress(); 792 $bbp->current_user->roles[0] = $default_role; 793 $bbp->current_user->caps = $default_caps; 794 $bbp->current_user->allcaps = $default_caps; 796 795 } 797 796
Note: See TracChangeset
for help on using the changeset viewer.