Skip to:
Content

BuddyPress.org

Changeset 12405


Ignore:
Timestamp:
06/21/2019 06:45:26 PM (5 weeks ago)
Author:
imath
Message:

Introduce a new User Interface to manage Group members

Welcome to the first Core feature to use the BP REST API, although this API is not yet included in BuddyPress! For now this feature is completely silent but as soon as the BP REST API has landed into BuddyPress, you will be able to enjoy a Group member management greatly improved.

  1. Whether you prefer to manage Group members from the single Group Administration screen into the WordPress back-end or from the Group Manage screen on the front-end, you will now experience a unique interface to promote, demote, remove or ban the Group members.
  2. Very popular Group Administrators will love the new search feature to save some time to find a particular member out of their crowded Group!

On a side note, this commit also introduces the bp-api-request.js JavaScript to ease exchanges with the BP REST API.

Props espellcaste

Fixes #8045

Location:
trunk/src
Files:
6 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/admin/css/admin-rtl.css

    r11587 r12405  
    141141}
    142142
     143#group-manage-members-ui .subnav-filters .filter.last {
     144    float: left;
     145}
     146
     147#group-manage-members-ui .subnav-filters .left-menu {
     148    float: right;
     149}
     150
     151#group-manage-members-ui .subnav-filters .group-members-paginate-button:last-child {
     152    margin-left: 2em;
     153}
     154
     155#group-manage-members-ui .subnav-filters .dashicons {
     156    padding-top: 2px;
     157}
     158
     159#group-manage-members-ui .uname-column .profile-photo {
     160    margin-left: 1em;
     161}
     162
     163#bp-no-group-members .bp-feedback.info {
     164    background: #fff;
     165    border-right: 4px solid #00a0d2;
     166    box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
     167    margin: 5px 5px 2px;
     168    padding: 1px 12px;
     169}
     170
     171#bp-no-group-members .bp-feedback.info p {
     172    margin: 0.5em 0;
     173    padding: 2px;
     174}
     175
    143176@media screen and (max-width: 782px) {
    144177
  • trunk/src/bp-groups/admin/css/admin.css

    r11587 r12405  
    141141}
    142142
     143#group-manage-members-ui .subnav-filters .filter.last {
     144    float: right;
     145}
     146
     147#group-manage-members-ui .subnav-filters .left-menu {
     148    float: left;
     149}
     150
     151#group-manage-members-ui .subnav-filters .group-members-paginate-button:last-child {
     152    margin-right: 2em;
     153}
     154
     155#group-manage-members-ui .subnav-filters .dashicons {
     156    padding-top: 2px;
     157}
     158
     159#group-manage-members-ui .uname-column .profile-photo {
     160    margin-right: 1em;
     161}
     162
     163#bp-no-group-members .bp-feedback.info {
     164    background: #fff;
     165    border-left: 4px solid #00a0d2;
     166    box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
     167    margin: 5px 5px 2px;
     168    padding: 1px 12px;
     169}
     170
     171#bp-no-group-members .bp-feedback.info p {
     172    margin: 0.5em 0;
     173    padding: 2px;
     174}
     175
    143176@media screen and (max-width: 782px) {
    144177
  • trunk/src/bp-groups/bp-groups-admin.php

    r12401 r12405  
    892892 */
    893893function bp_groups_admin_edit_metabox_members( $item ) {
     894    // Use the BP REST API if it supported.
     895    if ( bp_rest_api_is_available() && bp_groups_has_manage_group_members_templates() ) {
     896        wp_enqueue_script( 'bp-group-manage-members' );
     897        wp_localize_script(
     898            'bp-group-manage-members',
     899            'bpGroupManageMembersSettings',
     900            bp_groups_get_group_manage_members_script_data( $item->id )
     901        );
     902
     903        bp_get_template_part( 'common/js-templates/group-members/index' );
     904
     905        /**
     906         * Echo out the JavaScript variable.
     907         * This seems to be required by the autocompleter, leaving this here for now...
     908         */
     909        echo '<script type="text/javascript">var group_id = "' . esc_js( $item->id ) . '";</script>';
     910        return;
     911    }
    894912
    895913    // Pull up a list of group members, so we can separate out the types
  • trunk/src/bp-groups/bp-groups-functions.php

    r12395 r12405  
    11131113
    11141114/**
     1115 * Get the Group roles.
     1116 *
     1117 * @since 5.0.0
     1118 *
     1119 * @return array The list of Group role objects.
     1120 */
     1121function bp_groups_get_group_roles() {
     1122    return array(
     1123        'admin' => (object) array(
     1124            'id'           => 'admin',
     1125            'name'         => __( 'Administrator', 'buddypress' ),
     1126            'is_admin'     => true,
     1127            'is_banned'    => false,
     1128            'is_confirmed' => true,
     1129            'is_mod'       => false,
     1130        ),
     1131        'mod' => (object) array(
     1132            'id'           => 'mod',
     1133            'name'         => __( 'Moderator', 'buddypress' ),
     1134            'is_admin'     => false,
     1135            'is_banned'    => false,
     1136            'is_confirmed' => true,
     1137            'is_mod'       => true,
     1138        ),
     1139        'member' => (object) array(
     1140            'id'           => 'member',
     1141            'name'         => __( 'Member', 'buddypress' ),
     1142            'is_admin'     => false,
     1143            'is_banned'    => false,
     1144            'is_confirmed' => true,
     1145            'is_mod'       => false,
     1146        ),
     1147        'banned' => (object) array(
     1148            'id'           => 'banned',
     1149            'name'         => __( 'Banned', 'buddypress' ),
     1150            'is_admin'     => false,
     1151            'is_banned'    => true,
     1152            'is_confirmed' => true,
     1153            'is_mod'       => false,
     1154        ),
     1155    );
     1156}
     1157
     1158/**
    11151159 * Check whether a user is an admin of a given group.
    11161160 *
  • trunk/src/bp-groups/bp-groups-template.php

    r12362 r12405  
    62186218    return apply_filters( 'bp_groups_get_profile_stats', $r['output'], $r );
    62196219}
     6220
     6221/**
     6222 * Check if the active template pack includes the Group Membership management UI templates.
     6223 *
     6224 * @since 5.0.0
     6225 *
     6226 * @return boolean True if the active template pack includes the Group Membership management UI templates.
     6227 *                 False otherwise.
     6228 */
     6229function bp_groups_has_manage_group_members_templates() {
     6230    return file_exists( bp_locate_template( 'common/js-templates/group-members/index.php' ) );
     6231}
  • trunk/src/bp-groups/classes/class-bp-groups-component.php

    r12087 r12405  
    129129            'adminbar',
    130130            'functions',
    131             'notifications'
     131            'notifications',
     132            'cssjs',
    132133        );
    133134
  • trunk/src/bp-templates/bp-nouveau/buddypress/groups/single/admin/manage-members.php

    r12156 r12405  
    44 *
    55 * @since 3.0.0
    6  * @version 3.1.0
     6 * @version 5.0.0
    77 */
    88?>
     
    1212</h2>
    1313
    14     <p class="bp-help-text"><?php esc_html_e( 'Manage your group members; promote to moderators, admins or demote or ban.', 'buddypress' ); ?></p>
     14<p class="bp-help-text"><?php esc_html_e( 'Manage your group members; promote to moderators, admins or demote or ban.', 'buddypress' ); ?></p>
     15
     16<?php if ( bp_rest_api_is_available() ) :
     17    /**
     18     * Get the templates to manage Group Members using the BP REST API.
     19     *
     20     * @since 5.0.0
     21     */
     22    bp_get_template_part( 'common/js-templates/group-members/index' );
     23
     24else : ?>
    1525
    1626    <dl class="groups-manage-members-list">
     
    120130        bp_nouveau_user_feedback( 'group-manage-members-none' );
    121131
    122     endif; ?>
     132    endif;
    123133
     134endif;
  • trunk/src/bp-templates/bp-nouveau/common-styles/_bp_groups_management.scss

    r12082 r12405  
    140140
    141141} //close .groups-manage-members-list
     142
     143#group-manage-members-ui {
     144
     145    #group-members-search-form {
     146
     147        button[type="submit"] {
     148            float: right;
     149            font-size: inherit;
     150            font-weight: 400;
     151            line-height: 1.5;
     152            text-align: center;
     153            text-transform: none;
     154
     155            span {
     156                font-family: dashicons;
     157
     158                @include font-size(18);
     159                line-height: 1.6;
     160            }
     161        }
     162    }
     163
     164    #group-members-pagination {
     165
     166        button:last-child {
     167            margin-right: 2em;
     168        }
     169    }
     170
     171    #bp-no-group-members td {
     172        border: none;
     173    }
     174}
  • trunk/src/bp-templates/bp-nouveau/common-styles/_bp_search.scss

    r12398 r12405  
    99    form.bp-dir-search-form,
    1010    form.bp-messages-search-form,
    11     form[data-bp-search].bp-invites-search-form {
     11    form[data-bp-search].bp-invites-search-form,
     12    form#group-members-search {
    1213        border: 1px solid $bp-border-color;
    1314
     
    6970    } // close form
    7071
     72    form#group-members-search {
     73
     74        &:hover {
     75            border: 1px solid darken($bp-border-color, 10%);
     76            box-shadow: inset 0 0 3px #eee;
     77        }
     78    }
     79
    7180    // this block needs to be moved really.
    7281    ul.filters {
  • trunk/src/bp-templates/bp-nouveau/css/buddypress-rtl.css

    r12398 r12405  
    25582558        float: right;
    25592559    }
     2560}
     2561
     2562#group-manage-members-ui #group-members-search-form button[type="submit"] {
     2563    float: left;
     2564    font-size: inherit;
     2565    font-weight: 400;
     2566    line-height: 1.5;
     2567    text-align: center;
     2568    text-transform: none;
     2569}
     2570
     2571#group-manage-members-ui #group-members-search-form button[type="submit"] span {
     2572    font-family: dashicons;
     2573    font-size: 18px;
     2574    line-height: 1.6;
     2575}
     2576
     2577#group-manage-members-ui #group-members-pagination button:last-child {
     2578    margin-left: 2em;
     2579}
     2580
     2581#group-manage-members-ui #bp-no-group-members td {
     2582    border: none;
    25602583}
    25612584
     
    36923715.buddypress-wrap form.bp-dir-search-form,
    36933716.buddypress-wrap form.bp-messages-search-form,
    3694 .buddypress-wrap form[data-bp-search].bp-invites-search-form {
     3717.buddypress-wrap form[data-bp-search].bp-invites-search-form,
     3718.buddypress-wrap form#group-members-search {
    36953719    border: 1px solid #eee;
    36963720    width: 100%;
     
    36993723.buddypress-wrap form.bp-dir-search-form label,
    37003724.buddypress-wrap form.bp-messages-search-form label,
    3701 .buddypress-wrap form[data-bp-search].bp-invites-search-form label {
     3725.buddypress-wrap form[data-bp-search].bp-invites-search-form label,
     3726.buddypress-wrap form#group-members-search label {
    37023727    margin: 0;
    37033728}
     
    37113736.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"],
    37123737.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="text"],
    3713 .buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"] {
     3738.buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"],
     3739.buddypress-wrap form#group-members-search input[type="search"],
     3740.buddypress-wrap form#group-members-search input[type="text"],
     3741.buddypress-wrap form#group-members-search button[type="submit"] {
    37143742    background: none;
    37153743    border: 0;
     
    37233751.buddypress-wrap form.bp-messages-search-form input[type="text"],
    37243752.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"],
    3725 .buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="text"] {
     3753.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="text"],
     3754.buddypress-wrap form#group-members-search input[type="search"],
     3755.buddypress-wrap form#group-members-search input[type="text"] {
    37263756    float: right;
    37273757    line-height: 1.5;
     
    37323762.buddypress-wrap form.bp-dir-search-form button[type="submit"],
    37333763.buddypress-wrap form.bp-messages-search-form button[type="submit"],
    3734 .buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"] {
     3764.buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"],
     3765.buddypress-wrap form#group-members-search button[type="submit"] {
    37353766    float: left;
    37363767    font-size: inherit;
     
    37453776.buddypress-wrap form.bp-dir-search-form button[type="submit"] span,
    37463777.buddypress-wrap form.bp-messages-search-form button[type="submit"] span,
    3747 .buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"] span {
     3778.buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"] span,
     3779.buddypress-wrap form#group-members-search button[type="submit"] span {
    37483780    font-family: dashicons;
    37493781    font-size: 18px;
     
    37533785.buddypress-wrap form.bp-dir-search-form button[type="submit"].bp-show,
    37543786.buddypress-wrap form.bp-messages-search-form button[type="submit"].bp-show,
    3755 .buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"].bp-show {
     3787.buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"].bp-show,
     3788.buddypress-wrap form#group-members-search button[type="submit"].bp-show {
    37563789    height: auto;
    37573790    right: 0;
     
    37633796.buddypress-wrap form.bp-dir-search-form input[type="search"]::-webkit-search-cancel-button,
    37643797.buddypress-wrap form.bp-messages-search-form input[type="search"]::-webkit-search-cancel-button,
    3765 .buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"]::-webkit-search-cancel-button {
     3798.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"]::-webkit-search-cancel-button,
     3799.buddypress-wrap form#group-members-search input[type="search"]::-webkit-search-cancel-button {
    37663800    -webkit-appearance: searchfield-cancel-button;
    37673801}
     
    37723806.buddypress-wrap form.bp-messages-search-form input[type="search"]::-webkit-search-results-decoration,
    37733807.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"]::-webkit-search-results-button,
    3774 .buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"]::-webkit-search-results-decoration {
     3808.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"]::-webkit-search-results-decoration,
     3809.buddypress-wrap form#group-members-search input[type="search"]::-webkit-search-results-button,
     3810.buddypress-wrap form#group-members-search input[type="search"]::-webkit-search-results-decoration {
    37753811    display: none;
     3812}
     3813
     3814.buddypress-wrap form#group-members-search:hover {
     3815    border: 1px solid #d5d4d4;
     3816    box-shadow: inset 0 0 3px #eee;
    37763817}
    37773818
  • trunk/src/bp-templates/bp-nouveau/css/buddypress.css

    r12398 r12405  
    25582558        float: left;
    25592559    }
     2560}
     2561
     2562#group-manage-members-ui #group-members-search-form button[type="submit"] {
     2563    float: right;
     2564    font-size: inherit;
     2565    font-weight: 400;
     2566    line-height: 1.5;
     2567    text-align: center;
     2568    text-transform: none;
     2569}
     2570
     2571#group-manage-members-ui #group-members-search-form button[type="submit"] span {
     2572    font-family: dashicons;
     2573    font-size: 18px;
     2574    line-height: 1.6;
     2575}
     2576
     2577#group-manage-members-ui #group-members-pagination button:last-child {
     2578    margin-right: 2em;
     2579}
     2580
     2581#group-manage-members-ui #bp-no-group-members td {
     2582    border: none;
    25602583}
    25612584
     
    36923715.buddypress-wrap form.bp-dir-search-form,
    36933716.buddypress-wrap form.bp-messages-search-form,
    3694 .buddypress-wrap form[data-bp-search].bp-invites-search-form {
     3717.buddypress-wrap form[data-bp-search].bp-invites-search-form,
     3718.buddypress-wrap form#group-members-search {
    36953719    border: 1px solid #eee;
    36963720    width: 100%;
     
    36993723.buddypress-wrap form.bp-dir-search-form label,
    37003724.buddypress-wrap form.bp-messages-search-form label,
    3701 .buddypress-wrap form[data-bp-search].bp-invites-search-form label {
     3725.buddypress-wrap form[data-bp-search].bp-invites-search-form label,
     3726.buddypress-wrap form#group-members-search label {
    37023727    margin: 0;
    37033728}
     
    37113736.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"],
    37123737.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="text"],
    3713 .buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"] {
     3738.buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"],
     3739.buddypress-wrap form#group-members-search input[type="search"],
     3740.buddypress-wrap form#group-members-search input[type="text"],
     3741.buddypress-wrap form#group-members-search button[type="submit"] {
    37143742    background: none;
    37153743    border: 0;
     
    37233751.buddypress-wrap form.bp-messages-search-form input[type="text"],
    37243752.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"],
    3725 .buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="text"] {
     3753.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="text"],
     3754.buddypress-wrap form#group-members-search input[type="search"],
     3755.buddypress-wrap form#group-members-search input[type="text"] {
    37263756    float: left;
    37273757    line-height: 1.5;
     
    37323762.buddypress-wrap form.bp-dir-search-form button[type="submit"],
    37333763.buddypress-wrap form.bp-messages-search-form button[type="submit"],
    3734 .buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"] {
     3764.buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"],
     3765.buddypress-wrap form#group-members-search button[type="submit"] {
    37353766    float: right;
    37363767    font-size: inherit;
     
    37453776.buddypress-wrap form.bp-dir-search-form button[type="submit"] span,
    37463777.buddypress-wrap form.bp-messages-search-form button[type="submit"] span,
    3747 .buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"] span {
     3778.buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"] span,
     3779.buddypress-wrap form#group-members-search button[type="submit"] span {
    37483780    font-family: dashicons;
    37493781    font-size: 18px;
     
    37533785.buddypress-wrap form.bp-dir-search-form button[type="submit"].bp-show,
    37543786.buddypress-wrap form.bp-messages-search-form button[type="submit"].bp-show,
    3755 .buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"].bp-show {
     3787.buddypress-wrap form[data-bp-search].bp-invites-search-form button[type="submit"].bp-show,
     3788.buddypress-wrap form#group-members-search button[type="submit"].bp-show {
    37563789    height: auto;
    37573790    left: 0;
     
    37633796.buddypress-wrap form.bp-dir-search-form input[type="search"]::-webkit-search-cancel-button,
    37643797.buddypress-wrap form.bp-messages-search-form input[type="search"]::-webkit-search-cancel-button,
    3765 .buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"]::-webkit-search-cancel-button {
     3798.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"]::-webkit-search-cancel-button,
     3799.buddypress-wrap form#group-members-search input[type="search"]::-webkit-search-cancel-button {
    37663800    -webkit-appearance: searchfield-cancel-button;
    37673801}
     
    37723806.buddypress-wrap form.bp-messages-search-form input[type="search"]::-webkit-search-results-decoration,
    37733807.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"]::-webkit-search-results-button,
    3774 .buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"]::-webkit-search-results-decoration {
     3808.buddypress-wrap form[data-bp-search].bp-invites-search-form input[type="search"]::-webkit-search-results-decoration,
     3809.buddypress-wrap form#group-members-search input[type="search"]::-webkit-search-results-button,
     3810.buddypress-wrap form#group-members-search input[type="search"]::-webkit-search-results-decoration {
    37753811    display: none;
     3812}
     3813
     3814.buddypress-wrap form#group-members-search:hover {
     3815    border: 1px solid #d5d4d4;
     3816    box-shadow: inset 0 0 3px #eee;
    37763817}
    37773818
  • trunk/src/bp-templates/bp-nouveau/includes/groups/functions.php

    r12383 r12405  
    44 *
    55 * @since 3.0.0
    6  * @version 3.1.0
     6 * @version 5.0.0
    77 */
    88
     
    6969    }
    7070
    71     if ( ! bp_is_group_invites() && ! ( bp_is_group_create() && bp_is_group_creation_step( 'group-invites' ) ) ) {
    72         return;
    73     }
    74 
    75     wp_enqueue_script( 'bp-nouveau-group-invites' );
     71    if ( bp_is_group_invites() || ( bp_is_group_create() && bp_is_group_creation_step( 'group-invites' ) ) ) {
     72        wp_enqueue_script( 'bp-nouveau-group-invites' );
     73    }
     74
     75    if ( bp_rest_api_is_available() && bp_is_group_admin_page() && bp_is_group_admin_screen( 'manage-members' ) ) {
     76        wp_enqueue_script( 'bp-group-manage-members' );
     77        wp_localize_script(
     78            'bp-group-manage-members',
     79            'bpGroupManageMembersSettings',
     80            bp_groups_get_group_manage_members_script_data( bp_get_current_group_id() )
     81        );
     82    }
    7683}
    7784
  • trunk/src/class-buddypress.php

    r12390 r12405  
    488488        require( $this->plugin_dir . 'bp-core/bp-core-loader.php'           );
    489489        require( $this->plugin_dir . 'bp-core/bp-core-customizer-email.php' );
     490        require( $this->plugin_dir . 'bp-core/bp-core-rest-api.php'         );
    490491
    491492        // Maybe load deprecated functionality (this double negative is proof positive!)
Note: See TracChangeset for help on using the changeset viewer.