Ticket #1150: 1150.002.diff
File 1150.002.diff, 4.2 KB (added by , 12 years ago) |
---|
-
bp-themes/bp-default/groups/index.php
18 18 19 19 <form action="" method="post" id="groups-directory-form" class="dir-form"> 20 20 21 <h3><?php _e( 'Groups Directory', 'buddypress' ); ?><?php if ( is_user_logged_in() ) : ?> <a class="button" href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create' ); ?>"><?php _e( 'Create a Group', 'buddypress' ); ?></a><?php endif; ?></h3>21 <h3><?php _e( 'Groups Directory', 'buddypress' ); ?><?php if ( is_user_logged_in() && bp_user_can_create_groups() ) : ?> <a class="button" href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create' ); ?>"><?php _e( 'Create a Group', 'buddypress' ); ?></a><?php endif; ?></h3> 22 22 23 23 <div id="group-dir-search" class="dir-search" role="search"> 24 24 … … 26 26 27 27 </div><!-- #group-dir-search --> 28 28 29 <?php do_action( 'template_notices' ); ?> 30 29 31 <div class="item-list-tabs" role="navigation"> 30 32 <ul> 31 33 <li class="selected" id="groups-all"><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() ); ?>"><?php printf( __( 'All Groups (%s)', 'buddypress' ), bp_get_total_group_count() ); ?></a></li> -
bp-core/admin/bp-core-admin.php
137 137 138 138 <?php endif; ?> 139 139 140 <?php if ( bp_is_active( 'groups' ) ) : ?> 141 142 <tr> 143 <th scope="row"><?php _e( 'Restrict group creation to Site Admins?', 'buddypress' ) ?>:</th> 144 <td> 145 <input type="radio" name="bp-admin[bp_restrict_group_creation]"<?php checked( '1', get_site_option( 'bp_restrict_group_creation', '0' ) ); ?>id="bp-restrict-group-creation" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> 146 <input type="radio" name="bp-admin[bp_restrict_group_creation]"<?php checked( '0', get_site_option( 'bp_restrict_group_creation', '0' ) ); ?>id="bp-restrict-group-creation" value="0" /> <?php _e( 'No', 'buddypress' ) ?> 147 </td> 148 </tr> 149 150 <?php endif; ?> 151 140 152 <?php do_action( 'bp_core_admin_screen_fields' ) ?> 141 153 142 154 </tbody> -
bp-groups/bp-groups-actions.php
19 19 if ( !is_user_logged_in() ) 20 20 return false; 21 21 22 if ( !bp_user_can_create_groups() ) { 23 bp_core_add_message( __( 'Sorry, you are not allowed to create groups.', 'buddypress' ), 'error' ); 24 bp_core_redirect( trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() ) ); 25 } 26 22 27 // Make sure creation steps are in the right order 23 28 groups_action_sort_creation_steps(); 24 29 -
bp-groups/bp-groups-template.php
1724 1724 * Group Creation Process Template Tags 1725 1725 **/ 1726 1726 1727 /** 1728 * Determine if the current logged in user can create groups. 1729 * 1730 * @since BuddyPress {unknown} 1731 * 1732 * @uses apply_filters() To call 'bp_user_can_create_groups'. 1733 * @uses get_site_option() To retrieve value of 'bp_restrict_group_creation'. Defaults to 0. 1734 * @uses is_super_admin() To determine if current user if super admin. 1735 * 1736 * @return bool True if user can create groups. False otherwise. 1737 */ 1738 function bp_user_can_create_groups() { 1739 // Bail early if super admin 1740 if ( is_super_admin() ) 1741 return true; 1742 1743 // Get group creation option, default to 0 (allowed) 1744 $restricted = (int) get_site_option( 'bp_restrict_group_creation', 0 ); 1745 1746 // Allow by default 1747 $can_create = true; 1748 1749 // Are regular users restricted? 1750 if ( $restricted ) 1751 $can_create = false; 1752 1753 return apply_filters( 'bp_user_can_create_groups', $can_create ); 1754 } 1755 1727 1756 function bp_group_creation_tabs() { 1728 1757 global $bp; 1729 1758