Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/08/2009 08:41:08 PM (17 years ago)
Author:
apeatling
Message:

Added support for group members to be promoted/demoted to/from group admins.

File:
1 edited

Legend:

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

    r1809 r1826  
    542542    }
    543543   
    544     function promote() {
    545         // Check the users current status
    546        
    547         // Not letting mods be promoted to admins right now. In the future though yes.
    548         if ( $this->is_admin || $this->is_mod )
    549             return false;
    550        
    551         $this->is_mod = 1;
     544    function promote( $status = 'mod' ) {
     545        if ( 'mod' == $status ) {
     546            $this->is_admin = 0;
     547            $this->is_mod = 1;
     548            $this->user_title = __( 'Group Mod', 'buddypress' );
     549        }
     550       
     551        if ( 'admin' == $status ) {
     552            $this->is_admin = 1;
     553            $this->is_mod = 0;
     554            $this->user_title = __( 'Group Admin', 'buddypress' );
     555        }
     556       
    552557        return $this->save();
    553558    }
    554559   
    555     function demote() {
    556         if ( $this->is_admin )
    557             return false;
    558        
    559         if ( !$this->is_mod )
    560             return false;
    561        
     560    function demote() {     
    562561        $this->is_mod = 0;
     562        $this->is_admin = 0;
     563        $this->user_title = false;
     564       
    563565        return $this->save();       
    564566    }
Note: See TracChangeset for help on using the changeset viewer.