Skip to:
Content

Ticket #6014: 6014-add-front-end-input.diff

File 6014-add-front-end-input.diff, 1.8 KB (added by dcavins, 7 months ago)

Adds a front-end input for changing group slugs, accessible only by site admins.

  • src/bp-groups/bp-groups-screens.php

    diff --git src/bp-groups/bp-groups-screens.php src/bp-groups/bp-groups-screens.php
    index c790e78..2096c71 100644
    function groups_screen_group_admin_edit_details() { 
    845845                        } elseif ( ! groups_edit_base_group_details( array( 
    846846                                'group_id'       => $_POST['group-id'], 
    847847                                'name'           => $_POST['group-name'], 
    848                                 'slug'           => null, // @TODO: Add to settings pane? If yes, editable by site admin only, or allow group admins to do this? 
     848                                'slug'           => isset( $_POST['group-slug'] ) ? $_POST['group-slug'] : null, 
    849849                                'description'    => $_POST['group-desc'], 
    850850                                'notify_members' => $group_notify_members, 
    851851                        ) ) ) { 
  • src/bp-templates/bp-legacy/buddypress/groups/single/admin/edit-details.php

    diff --git src/bp-templates/bp-legacy/buddypress/groups/single/admin/edit-details.php src/bp-templates/bp-legacy/buddypress/groups/single/admin/edit-details.php
    index ed2375a..20449c0 100644
    do_action( 'bp_before_group_details_admin' ); ?> 
    2222<label for="group-name"><?php _e( 'Group Name (required)', 'buddypress' ); ?></label> 
    2323<input type="text" name="group-name" id="group-name" value="<?php bp_group_name(); ?>" aria-required="true" /> 
    2424 
     25<?php if ( bp_current_user_can( 'bp_moderate' ) ) :     ?> 
     26        <label for="group-slug"><?php _e( 'Group Slug (required)', 'buddypress' ); ?></label> 
     27        <input type="text" name="group-slug" id="group-slug" value="<?php bp_current_group_slug(); ?>" aria-required="true" /> 
     28<?php endif; ?> 
     29 
    2530<label for="group-desc"><?php _e( 'Group Description (required)', 'buddypress' ); ?></label> 
    2631<textarea name="group-desc" id="group-desc" aria-required="true"><?php bp_group_description_editable(); ?></textarea> 
    2732