public function updateProfile()
    {
        if ($this->v["uID"] > 0) {
            // $GLOBALS["SL"]->user() returns an instance of the authenticated user...
            if ($this->v["uID"] == $GLOBALS["SL"]->REQ->uID || $this->v["user"]->hasRole('administrator')) {
                $user = User::find($GLOBALS["SL"]->REQ->uID);
                $user->name = $GLOBALS["SL"]->REQ->name;
                $user->email = $GLOBALS["SL"]->REQ->email;
                $user->save();
                $user->loadRoles();
                if ($this->v["user"]->hasRole('administrator')) {
                    if ($GLOBALS["SL"]->REQ->has('roles') && is_array($GLOBALS["SL"]->REQ->roles)
                        && sizeof($GLOBALS["SL"]->REQ->roles) > 0) {
                        foreach ($user->roles as $i => $role) {
                            if (in_array($role->DefID, $GLOBALS["SL"]->REQ->roles)) {
                                if (!$user->hasRole($role->DefSubset)) {
                                    $user->assignRole($role->DefSubset);
                                }
                            } elseif ($user->hasRole($role->DefSubset)) {
                                $user->revokeRole($role->DefSubset);
                            }
                        }
                    } else { // no roles selected, delete all that exist
                        foreach ($user->roles as $i => $role) {
                            if ($user->hasRole($role->DefSubset)) {
                                $user->revokeRole($role->DefSubset);
                            }
                        }
                    }
                }
                $this->redir('/profile/' . urlencode($user->name), true);
                return true;
            }
        }
        return false;
    }
public function updateProfile()
    {
        if ($this->v["uID"] > 0) {
            // $GLOBALS["SL"]->user() returns an instance of the authenticated user...
            if ($this->v["uID"] == $GLOBALS["SL"]->REQ->uID || $this->v["user"]->hasRole('administrator')) {
                $user = User::find($GLOBALS["SL"]->REQ->uID);
                $user->name = $GLOBALS["SL"]->REQ->name;
                $user->email = $GLOBALS["SL"]->REQ->email;
                $user->save();
                $user->loadRoles();
                if ($this->v["user"]->hasRole('administrator')) {
                    if ($GLOBALS["SL"]->REQ->has('roles') && is_array($GLOBALS["SL"]->REQ->roles)
                        && sizeof($GLOBALS["SL"]->REQ->roles) > 0) {
                        foreach ($user->roles as $i => $role) {
                            if (in_array($role->DefID, $GLOBALS["SL"]->REQ->roles)) {
                                if (!$user->hasRole($role->DefSubset)) {
                                    $user->assignRole($role->DefSubset);
                                }
                            } elseif ($user->hasRole($role->DefSubset)) {
                                $user->revokeRole($role->DefSubset);
                            }
                        }
                    } else { // no roles selected, delete all that exist
                        foreach ($user->roles as $i => $role) {
                            if ($user->hasRole($role->DefSubset)) {
                                $user->revokeRole($role->DefSubset);
                            }
                        }
                    }
                }
                $this->redir('/profile/' . urlencode($user->name), true);
                return true;
            }
        }
        return false;
    }
public function updateProfile ( ) { if ( $ this -> v [ "uID" ] > 0 ) { // $GLOBALS["SL"]->user() returns an instance of the authenticated user... if ( $ this -> v [ "uID" ] == $ GLOBALS [ "SL" ] -> REQ -> uID || $ this -> v [ "user" ] -> hasRole ( 'administrator' ) ) { $ user = User :: find ( $ GLOBALS [ "SL" ] -> REQ -> uID ) ; $ user -> name = $ GLOBALS [ "SL" ] -> REQ -> name ; $ user -> email = $ GLOBALS [ "SL" ] -> REQ -> email ; $ user -> save ( ) ; $ user -> loadRoles ( ) ; if ( $ this -> v [ "user" ] -> hasRole ( 'administrator' ) ) { if ( $ GLOBALS [ "SL" ] -> REQ -> has ( 'roles' ) && is_array ( $ GLOBALS [ "SL" ] -> REQ -> roles ) && sizeof ( $ GLOBALS [ "SL" ] -> REQ -> roles ) > 0 ) { foreach ( $ user -> roles as $ i => $ role ) { if ( in_array ( $ role -> DefID , $ GLOBALS [ "SL" ] -> REQ -> roles ) ) { if ( ! $ user -> hasRole ( $ role -> DefSubset ) ) { $ user -> assignRole ( $ role -> DefSubset ) ; } } elseif ( $ user -> hasRole ( $ role -> DefSubset ) ) { $ user -> revokeRole ( $ role -> DefSubset ) ; } } } else { // no roles selected, delete all that exist foreach ( $ user -> roles as $ i => $ role ) { if ( $ user -> hasRole ( $ role -> DefSubset ) ) { $ user -> revokeRole ( $ role -> DefSubset ) ; } } } } $ this -> redir ( '/profile/' . urlencode ( $ user -> name ) , true ) ; return true ; } } return false ; }
Update the user's profile.

@param  Request  $request
@return Response
Update the user s profile .