Changeset 13156
- Timestamp:
- 11/25/2021 12:30:33 AM (3 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/classes/class-bp-groups-component.php
r13144 r13156 111 111 */ 112 112 public function __construct() { 113 $features = array(); 114 if ( bp_is_active( 'friends' ) ) { 115 $features[] = 'invitations'; 116 } 117 113 118 parent::start( 114 119 'groups', … … 117 122 array( 118 123 'adminbar_myaccount_order' => 70, 119 'search_query_arg' => 'groups_search', 124 'search_query_arg' => 'groups_search', 125 'features' => $features, 120 126 ) 121 127 ); … … 393 399 } 394 400 395 // If friends component is active, add invitations.396 if ( bp_is_active( ' friends' ) ) {401 // If invitations are enabled, add invitations. 402 if ( bp_is_active( 'groups', 'invitations' ) ) { 397 403 $this->group_creation_steps['group-invites'] = array( 398 404 'name' => _x( 'Invites', 'Group screen nav', 'buddypress' ), … … 608 614 ); 609 615 610 // Add the Group Invites nav item. 611 $sub_nav[] = array( 612 'name' => __( 'Invitations', 'buddypress' ), 613 'slug' => 'invites', 614 'parent_url' => $groups_link, 615 'parent_slug' => $slug, 616 'screen_function' => 'groups_screen_group_invites', 617 'user_has_access' => $access, 618 'position' => 30 619 ); 616 if ( bp_is_active( 'groups', 'invitations' ) ) { 617 // Add the Group Invites nav item. 618 $sub_nav[] = array( 619 'name' => __( 'Invitations', 'buddypress' ), 620 'slug' => 'invites', 621 'parent_url' => $groups_link, 622 'parent_slug' => $slug, 623 'screen_function' => 'groups_screen_group_invites', 624 'user_has_access' => $access, 625 'position' => 30 626 ); 627 } 620 628 621 629 parent::setup_nav( $main_nav, $sub_nav ); … … 706 714 } 707 715 708 if ( bp_is_active( ' friends' ) && bp_groups_user_can_send_invites() ) {716 if ( bp_is_active( 'groups', 'invitations' ) ) { 709 717 $sub_nav[] = array( 710 718 'name' => _x( 'Send Invites', 'My Group screen nav', 'buddypress' ), … … 834 842 $groups_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ); 835 843 836 // Pending group invites.837 $count = groups_get_invite_count_for_user();838 844 $title = _x( 'Groups', 'My Account Groups', 'buddypress' ); 839 845 $pending = _x( 'No Pending Invites', 'My Account Groups sub nav', 'buddypress' ); 840 846 841 if ( $count ) { 842 $title = sprintf( 843 /* translators: %s: Group invitation count for the current user */ 844 _x( 'Groups %s', 'My Account Groups nav', 'buddypress' ), 845 '<span class="count">' . bp_core_number_format( $count ) . '</span>' 846 ); 847 848 $pending = sprintf( 849 /* translators: %s: Group invitation count for the current user */ 850 _x( 'Pending Invites %s', 'My Account Groups sub nav', 'buddypress' ), 851 '<span class="count">' . bp_core_number_format( $count ) . '</span>' 852 ); 847 if ( bp_is_active( 'groups', 'invitations' ) ) { 848 // Pending group invites. 849 $count = groups_get_invite_count_for_user(); 850 if ( $count ) { 851 $title = sprintf( 852 /* translators: %s: Group invitation count for the current user */ 853 _x( 'Groups %s', 'My Account Groups nav', 'buddypress' ), 854 '<span class="count">' . bp_core_number_format( $count ) . '</span>' 855 ); 856 857 $pending = sprintf( 858 /* translators: %s: Group invitation count for the current user */ 859 _x( 'Pending Invites %s', 'My Account Groups sub nav', 'buddypress' ), 860 '<span class="count">' . bp_core_number_format( $count ) . '</span>' 861 ); 862 } 853 863 } 854 864 … … 871 881 872 882 // Invitations. 873 $wp_admin_nav[] = array( 874 'parent' => 'my-account-' . $this->id, 875 'id' => 'my-account-' . $this->id . '-invites', 876 'title' => $pending, 877 'href' => trailingslashit( $groups_link . 'invites' ), 878 'position' => 30 879 ); 883 if ( bp_is_active( 'groups', 'invitations' ) ) { 884 $wp_admin_nav[] = array( 885 'parent' => 'my-account-' . $this->id, 886 'id' => 'my-account-' . $this->id . '-invites', 887 'title' => $pending, 888 'href' => trailingslashit( $groups_link . 'invites' ), 889 'position' => 30 890 ); 891 } 880 892 881 893 // Create a Group. -
trunk/src/bp-templates/bp-legacy/buddypress/groups/create.php
r12375 r13156 173 173 <?php endif; ?> 174 174 175 <fieldset class="group-create-invitations"> 176 177 <legend><?php _e( 'Group Invitations', 'buddypress' ); ?></legend> 178 179 <p><?php _e( 'Which members of this group are allowed to invite others?', 'buddypress' ); ?></p> 180 181 <div class="radio"> 182 183 <label for="group-invite-status-members"><input type="radio" name="group-invite-status" id="group-invite-status-members" value="members"<?php bp_group_show_invite_status_setting( 'members' ); ?> /> <?php _e( 'All group members', 'buddypress' ); ?></label> 184 185 <label for="group-invite-status-mods"><input type="radio" name="group-invite-status" id="group-invite-status-mods" value="mods"<?php bp_group_show_invite_status_setting( 'mods' ); ?> /> <?php _e( 'Group admins and mods only', 'buddypress' ); ?></label> 186 187 <label for="group-invite-status-admins"><input type="radio" name="group-invite-status" id="group-invite-status-admins" value="admins"<?php bp_group_show_invite_status_setting( 'admins' ); ?> /> <?php _e( 'Group admins only', 'buddypress' ); ?></label> 188 189 </div> 190 191 </fieldset> 175 <?php if ( bp_is_active( 'groups', 'invitations' ) ): ?> 176 177 <fieldset class="group-create-invitations"> 178 179 <legend><?php _e( 'Group Invitations', 'buddypress' ); ?></legend> 180 181 <p><?php _e( 'Which members of this group are allowed to invite others?', 'buddypress' ); ?></p> 182 183 <div class="radio"> 184 185 <label for="group-invite-status-members"><input type="radio" name="group-invite-status" id="group-invite-status-members" value="members"<?php bp_group_show_invite_status_setting( 'members' ); ?> /> <?php _e( 'All group members', 'buddypress' ); ?></label> 186 187 <label for="group-invite-status-mods"><input type="radio" name="group-invite-status" id="group-invite-status-mods" value="mods"<?php bp_group_show_invite_status_setting( 'mods' ); ?> /> <?php _e( 'Group admins and mods only', 'buddypress' ); ?></label> 188 189 <label for="group-invite-status-admins"><input type="radio" name="group-invite-status" id="group-invite-status-admins" value="admins"<?php bp_group_show_invite_status_setting( 'admins' ); ?> /> <?php _e( 'Group admins only', 'buddypress' ); ?></label> 190 191 </div> 192 193 </fieldset> 194 195 <?php endif; ?> 192 196 193 197 <?php -
trunk/src/bp-templates/bp-legacy/buddypress/groups/single/admin/group-settings.php
r12082 r13156 81 81 <?php endif; ?> 82 82 83 <fieldset class="group-create-invitations">84 83 85 <legend><?php _e( 'Group Invitations', 'buddypress' ); ?></legend>84 <?php if ( bp_is_active( 'groups', 'invitations' ) ): ?> 86 85 87 < p><?php _e( 'Which members of this group are allowed to invite others?', 'buddypress' ); ?></p>86 <fieldset class="group-create-invitations"> 88 87 89 <div class="radio">88 <legend><?php _e( 'Group Invitations', 'buddypress' ); ?></legend> 90 89 91 < label for="group-invite-status-members"><input type="radio" name="group-invite-status" id="group-invite-status-members" value="members"<?php bp_group_show_invite_status_setting( 'members' ); ?> /> <?php _e( 'All group members', 'buddypress' ); ?></label>90 <p><?php _e( 'Which members of this group are allowed to invite others?', 'buddypress' ); ?></p> 92 91 93 < label for="group-invite-status-mods"><input type="radio" name="group-invite-status" id="group-invite-status-mods" value="mods"<?php bp_group_show_invite_status_setting( 'mods' ); ?> /> <?php _e( 'Group admins and mods only', 'buddypress' ); ?></label>92 <div class="radio"> 94 93 95 <label for="group-invite-status-admins"><input type="radio" name="group-invite-status" id="group-invite-status-admins" value="admins"<?php bp_group_show_invite_status_setting( 'admins' ); ?> /> <?php _e( 'Group admins only', 'buddypress' ); ?></label>94 <label for="group-invite-status-members"><input type="radio" name="group-invite-status" id="group-invite-status-members" value="members"<?php bp_group_show_invite_status_setting( 'members' ); ?> /> <?php _e( 'All group members', 'buddypress' ); ?></label> 96 95 97 </div>96 <label for="group-invite-status-mods"><input type="radio" name="group-invite-status" id="group-invite-status-mods" value="mods"<?php bp_group_show_invite_status_setting( 'mods' ); ?> /> <?php _e( 'Group admins and mods only', 'buddypress' ); ?></label> 98 97 99 </fieldset> 98 <label for="group-invite-status-admins"><input type="radio" name="group-invite-status" id="group-invite-status-admins" value="admins"<?php bp_group_show_invite_status_setting( 'admins' ); ?> /> <?php _e( 'Group admins only', 'buddypress' ); ?></label> 99 100 </div> 101 102 </fieldset> 103 104 <?php endif; ?> 100 105 101 106 <?php -
trunk/src/bp-templates/bp-legacy/buddypress/groups/single/send-invites.php
r12082 r13156 15 15 do_action( 'bp_before_group_send_invites_content' ); ?> 16 16 17 <?php if ( ! bp_is_active( 'friends' ) ) : ?> 18 <div id="message" class="info"> 19 <p class="notice"><?php esc_html_e( 'Group invitations can only be extended to friends.', 'buddypress' ); ?></p> 20 </div> 17 21 <?php 18 22 /* Does the user have friends that could be invited to the group? */ 19 if ( bp_get_new_group_invite_friend_list() ) : ?>23 elseif ( bp_get_new_group_invite_friend_list() ) : ?> 20 24 21 25 <h2 class="bp-screen-reader-text"><?php _e( 'Send invites', 'buddypress' ); ?></h2> -
trunk/src/bp-templates/bp-nouveau/buddypress/groups/single/admin/group-settings.php
r12231 r13156 87 87 <?php endif; ?> 88 88 89 <?php if ( bp_is_active( 'groups', 'invitations' ) ): ?> 90 89 91 <fieldset class="radio group-invitations"> 90 92 <legend><?php esc_html_e( 'Group Invitations', 'buddypress' ); ?></legend> … … 109 111 </fieldset> 110 112 113 <?php endif; ?> 114 111 115 </div><!-- // .group-settings-selections --> -
trunk/src/bp-templates/bp-nouveau/includes/groups/classes.php
r13094 r13156 260 260 'position' => 10, 261 261 ), 262 'invites' => array(263 'name' => _x( 'Invite', 'My Group screen nav', 'buddypress' ),264 'slug' => 'send-invites',265 'parent_slug' => $this->group->slug,266 'position' => 70,267 ),268 262 'manage' => array( 269 263 'name' => _x( 'Manage', 'My Group screen nav', 'buddypress' ), … … 273 267 ), 274 268 ); 269 270 if ( bp_is_active( 'groups', 'invitations' ) ) { 271 $nav_items['invites'] = array( 272 'name' => _x( 'Invite', 'My Group screen nav', 'buddypress' ), 273 'slug' => 'send-invites', 274 'parent_slug' => $this->group->slug, 275 'position' => 70, 276 ); 277 } 275 278 276 279 // Make sure only global front.php will be checked. -
trunk/src/bp-templates/bp-nouveau/includes/groups/functions.php
r13108 r13156 102 102 return apply_filters( 'bp_nouveau_groups_disallow_all_members_invites', $default ); 103 103 } 104 105 /** 106 * Activate the Groups invitations feature if any member can be invited. 107 * 108 * @since 10.0.0 109 * 110 * @param bool True if any member can be invited. False otherwise. 111 */ 112 function bp_nouveau_is_groups_invitations_active() { 113 return ! bp_nouveau_groups_disallow_all_members_invites(); 114 } 115 add_filter( 'bp_is_groups_invitations_active', 'bp_nouveau_is_groups_invitations_active' ); 104 116 105 117 /** … … 311 323 312 324 /** 313 * @since 3.0.0 325 * Rename the Group invite step. 326 * 327 * @since 3.0.0 328 * @since 10.0.0 The function is no more creating a Group invite step. 329 * 330 * @param array $steps The Group create steps. 331 * @return array The Group create steps. 314 332 */ 315 333 function bp_nouveau_group_invites_create_steps( $steps = array() ) { 316 if ( bp_is_active( 'friends' ) && isset( $steps['group-invites'] ) ) { 317 // Simply change the name 334 if ( isset( $steps['group-invites'] ) ) { 318 335 $steps['group-invites']['name'] = _x( 'Invite', 'Group invitations menu title', 'buddypress' ); 319 return $steps; 320 } 321 322 // Add the create step if friends component is not active 323 $steps['group-invites'] = array( 324 'name' => _x( 'Invite', 'Group invitations menu title', 'buddypress' ), 325 'position' => 30, 326 ); 336 } 327 337 328 338 return $steps; … … 330 340 331 341 /** 332 * @since 3.0.0 342 * Rename the Group Invites nav. 343 * 344 * @since 3.0.0 345 * @since 10.0.0 The function is no longer creating a Group invite nav. 333 346 */ 334 347 function bp_nouveau_group_setup_nav() { … … 337 350 } 338 351 339 // Simply change the name 340 if ( bp_is_active( 'friends' ) ) { 352 if ( bp_is_active( 'groups', 'invitations' ) ) { 341 353 $bp = buddypress(); 342 354 … … 346 358 bp_get_current_group_slug() 347 359 ); 348 349 // Create the Subnav item for the group350 } else {351 $current_group = groups_get_current_group();352 $group_link = bp_get_group_permalink( $current_group );353 354 bp_core_new_subnav_item( array(355 'name' => _x( 'Invite', 'Group invitations menu title', 'buddypress' ),356 'slug' => 'send-invites',357 'parent_url' => $group_link,358 'parent_slug' => $current_group->slug,359 'screen_function' => 'groups_screen_group_invite',360 'item_css_id' => 'invite',361 'position' => 70,362 'user_has_access' => $current_group->user_has_access,363 'no_access_url' => $group_link,364 ) );365 360 } 366 361 }
Note: See TracChangeset
for help on using the changeset viewer.