Skip to:
Content

BuddyPress.org

Changeset 7788


Ignore:
Timestamp:
02/05/2014 06:47:20 PM (12 years ago)
Author:
johnjamesjacoby
Message:

When creating a new Group, only allow the Group creator to continue the Group creation process.

If the logged in user ID does not match the Group creator user ID, redirect back to the root group creation screen. Doing this has the added effect of resetting group creation cookies. Props Pietro Oliva. (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-actions.php

    r7561 r7788  
    6464        $bp->groups->new_group_id = $_COOKIE['bp_new_group_id'];
    6565        $bp->groups->current_group = groups_get_group( array( 'group_id' => $bp->groups->new_group_id ) );
     66
     67        // Only allow the group creator to continue to edit the new group
     68        if ( ! bp_is_group_creator( $bp->groups->current_group, bp_loggedin_user_id() ) ) {
     69            bp_core_add_message( __( 'Only the group creator may continue editing this group.', 'buddypress' ), 'error' );
     70            bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/' );
     71        }
    6672    }
    6773
Note: See TracChangeset for help on using the changeset viewer.