Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/24/2024 05:43:34 AM (11 months ago)
Author:
imath
Message:

Groups: improve group activity moderation delegation to admins & mods

  • Introduce a new BP Groups global setting to let Site Administrators decide whether group admins & mods can delete their group activities or not.
  • NB: Group creators can keep the control about who can delete their group activities using group role promotion (allow: promote some members as mods or admins. Disallow: do not promote anyone).
  • Make sure the bp_groups_filter_activity_user_can_delete() filter takes in account this setting and behaves as expected (eventually allowing group admins/mods to delete group activities).
  • Add unit tests

This ticket is a perfect example of a great collaborative work between all members of the BP Team. Great job 💪.

Props: emaralive, vapvarun, dcavins, espellcaste, needle

Fixes #8728
Closes https://github.com/buddypress/buddypress/pull/278

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-options.php

    r13533 r13870  
    6262        // Group Cover image uploads.
    6363        'bp-disable-group-cover-image-uploads' => false,
     64
     65        // Allow Group Activity Deletions.
     66        'bp-disable-group-activity-deletions'   => false,
    6467
    6568        // Allow users to delete their own accounts.
     
    587590
    588591/**
     592 * Are group activity deletions disabled?
     593 *
     594 * @since 14.0.0
     595 *
     596 * @param bool $default Optional. Fallback value if not found in the database.
     597 *                      Default: false.
     598 * @return bool True if group activity deletions are disabled, otherwise false.
     599 */
     600function bp_disable_group_activity_deletions( $default = false ) {
     601
     602    /**
     603     * Filters whether or not group creator, group admin or group mod are able to delete group activity posts.
     604     *
     605     * @since 14.0.0
     606     *
     607     * @param bool $value Whether or not group creator, group admin or group mod are able to delete group activity post.
     608     */
     609    return (bool) apply_filters( 'bp_disable_group_activity_deletions', (bool) bp_get_option( 'bp-disable-group-activity-deletions', $default ) );
     610}
     611
     612/**
    589613 * Are members able to delete their own accounts?
    590614 *
Note: See TracChangeset for help on using the changeset viewer.