Ticket #1150: 1150.003.diff
File 1150.003.diff, 4.1 KB (added by , 12 years ago) |
---|
-
bp-themes/bp-default/groups/index.php
4 4 <div class="padder"> 5 5 6 6 <form action="" method="post" id="groups-directory-form" class="dir-form"> 7 <h3><?php _e( 'Groups Directory', 'buddypress' ) ?><?php if ( is_user_logged_in() ) : ?> <a class="button" href="<?php echo bp_get_root_domain() . '/' . BP_GROUPS_SLUG . '/create/' ?>"><?php _e( 'Create a Group', 'buddypress' )?></a><?php endif; ?></h3>7 <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_GROUPS_SLUG . '/create' ); ?>"><?php _e( 'Create a Group', 'buddypress' ); ?></a><?php endif; ?></h3> 8 8 9 9 <?php do_action( 'bp_before_directory_groups_content' ) ?> 10 10 … … 12 12 <?php bp_directory_groups_search_form() ?> 13 13 </div><!-- #group-dir-search --> 14 14 15 <?php do_action( 'template_notices' ); ?> 16 15 17 <div class="item-list-tabs"> 16 18 <ul> 17 19 <li class="selected" id="groups-all"><a href="<?php echo bp_get_root_domain() . '/' . BP_GROUPS_SLUG ?>"><?php printf( __( 'All Groups (%s)', 'buddypress' ), bp_get_total_group_count() ) ?></a></li> -
bp-core/bp-core-admin.php
114 114 </td> 115 115 </tr> 116 116 117 <?php if ( bp_is_active( 'groups' ) ) : ?> 118 119 <tr> 120 <th scope="row"><?php _e( 'Restrict group creation to Site Admins?', 'buddypress' ) ?>:</th> 121 <td> 122 <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' ) ?> 123 <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' ) ?> 124 </td> 125 </tr> 126 127 <?php endif; ?> 128 117 129 <?php do_action( 'bp_core_admin_screen_fields' ) ?> 130 118 131 </tbody> 119 132 </table> 120 133 -
bp-groups.php
1041 1041 if ( !is_user_logged_in() ) 1042 1042 return false; 1043 1043 1044 if ( !bp_user_can_create_groups() ) { 1045 bp_core_add_message( __( 'Sorry, you are not allowed to create groups.', 'buddypress' ), 'error' ); 1046 bp_core_redirect( trailingslashit( bp_get_root_domain() . '/' . $bp->groups->slug ) ); 1047 } 1048 1044 1049 /* Make sure creation steps are in the right order */ 1045 1050 groups_action_sort_creation_steps(); 1046 1051 -
bp-groups/bp-groups-templatetags.php
1555 1555 * Group Creation Process Template Tags 1556 1556 **/ 1557 1557 1558 /** 1559 * Determine if the current logged in user can create groups. 1560 * 1561 * @since BuddyPress {unknown} 1562 * 1563 * @uses apply_filters() To call 'bp_user_can_create_groups'. 1564 * @uses get_site_option() To retrieve value of 'bp_restrict_group_creation'. Defaults to 0. 1565 * @uses is_super_admin() To determine if current user if super admin. 1566 * 1567 * @return bool True if user can create groups. False otherwise. 1568 */ 1569 function bp_user_can_create_groups() { 1570 // Bail early if super admin 1571 if ( is_super_admin() ) 1572 return true; 1573 1574 // Get group creation option, default to 0 (allowed) 1575 $restricted = (int) get_site_option( 'bp_restrict_group_creation', 0 ); 1576 1577 // Allow by default 1578 $can_create = true; 1579 1580 // Are regular users restricted? 1581 if ( $restricted ) 1582 $can_create = false; 1583 1584 return apply_filters( 'bp_user_can_create_groups', $can_create ); 1585 } 1586 1558 1587 function bp_group_creation_tabs() { 1559 1588 global $bp; 1560 1589