> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-v6-beta2-flutter-uikit.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Change Member Scope

> Learn how to change the scope (role) of a group member using the CometChat React Native SDK, including real-time and missed scope change events.

<Info>
  **Quick Reference**

  ```javascript theme={null}
  // Change member scope
  CometChat.updateGroupMemberScope("GUID", "UID", CometChat.GROUP_MEMBER_SCOPE.ADMIN);

  // Listen for scope changes
  CometChat.addGroupListener("listenerId", new CometChat.GroupListener({
    onGroupMemberScopeChanged: (message, changedUser, newScope, oldScope, changedGroup) => {}
  }));
  ```
</Info>

<Note>
  Available via: [SDK](/sdk/react-native/group-change-member-scope) | [REST API](/rest-api/group-members/change-scope)
</Note>

## Change Scope of a Group Member

In order to change the scope of a group member, you can use the `changeGroupMemberScope()`.

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={null}
    var GUID = "GUID";
    var UID = "UID";
    var scope = CometChat.GROUP_MEMBER_SCOPE.ADMIN;

    CometChat.updateGroupMemberScope(GUID, UID, scope).then(
      (response) => {
        console.log("Group member scopped changed", response);
      },
      (error) => {
        console.log("Group member scopped changed failed", error);
      }
    );
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript theme={null}
    let GUID: string = "GUID";
    let UID: string = "UID";

    CometChat.updateGroupMemberScope(
      GUID,
      UID,
      CometChat.GroupMemberScope.Admin
    ).then(
      (response: boolean) => {
        console.log("Group member scopped changed", response);
      },
      (error: CometChat.CometChatException) => {
        console.log("Group member scopped changed failed", error);
      }
    );
    ```
  </Tab>
</Tabs>

This method takes the below parameters:

| Parameter | Description                                                                                                                                                 |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `UID`     | The UID of the member whose scope you would like to change                                                                                                  |
| `GUID`    | The GUID of the group for which the member's scope needs to be changed                                                                                      |
| `scope`   | The updated scope of the member. This can be either of the 3 values: 1.`CometChat.SCOPE.ADMIN`2.`CometChat.SCOPE.MODERATOR` 3.`CometChat.SCOPE.PARTICIPANT` |

The default scope of any member is `participant`. Only the **Admin** of the group can change the scope of any participant in the group.

<Accordion title="Response">
  **On Success** — `updateGroupMemberScope()` returns a boolean:

  | Parameter  | Type    | Description                                          | Sample Value |
  | ---------- | ------- | ---------------------------------------------------- | ------------ |
  | `response` | boolean | Indicates whether the scope was successfully changed | `true`       |
</Accordion>

## Real-Time Group Member Scope Changed Events

*In other words, as a member of a group, how do I know when someone's scope is changed when my app is running?*

In order to receive real-time events for the change member scope event, you will need to override the `onGroupMemberScopeChanged()` method of the `GroupListener` class

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={null}
    var listenerID = "UNIQUE_LISTENER_ID";

    CometChat.addGroupListener(
      listenerID,
      new CometChat.GroupListener({
        onGroupMemberScopeChanged: (
          message,
          changedUser,
          newScope,
          oldScope,
          changedGroup
        ) => {
          console.log("User joined", {
            message,
            changedUser,
            newScope,
            oldScope,
            changedGroup,
          });
        },
      })
    );
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript theme={null}
    let listenerID: string = "UNIQUE_LISTENER_ID";

    CometChat.addGroupListener(
      listenerID,
      new CometChat.GroupListener({
        onGroupMemberScopeChanged: (
          message: CometChat.Action,
          changedUser: CometChat.User,
          newScope: string,
          oldScope: string,
          changedGroup: CometChat.Group
        ) => {
          console.log("User joined", {
            message,
            changedUser,
            newScope,
            oldScope,
            changedGroup,
          });
        },
      })
    );
    ```
  </Tab>
</Tabs>

<Warning>
  Always remove group listeners when the component unmounts to prevent memory leaks.

  ```javascript theme={null}
  CometChat.removeGroupListener("UNIQUE_LISTENER_ID");
  ```
</Warning>

## Missed Group Member Scope Changed Events

*In other words, as a member of a group, how do I know when someone's scope is changed when my app is not running?*

When you retrieve the list of previous messages if a member's scope has been changed for any group that the logged-in user is a member of, the list of messages will contain an `Action` message. An `Action` message is a sub-class of `BaseMessage` class.

For the group member scope changed event, in the `Action` object received, the following fields can help you get the relevant information-

1. `action` - `scopeChanged`
2. `actionOn` - User object containing the details of the user whos scope has been changed
3. `actionBy` - User object containing the details of the user who changed the scope of the member
4. `actionFor` - Group object containing the details of the group in which the member scope was changed
5. `oldScope` - The original scope of the member
6. `newScope` - The updated scope of the member

<AccordionGroup>
  <Accordion title="Best Practices">
    * Only admins can change member scope — validate roles before calling `updateGroupMemberScope()`
    * Update your local group member list after a successful scope change to keep the UI in sync
    * Handle the `onGroupMemberScopeChanged` listener to reflect scope changes made by other admins in real time
    * Consider showing a confirmation dialog before promoting a member to admin, as this grants full group control
  </Accordion>

  <Accordion title="Troubleshooting">
    * **ERR\_NOT\_A\_MEMBER**: The logged-in user is not a member of the group. Ensure the user has joined the group first.
    * **ERR\_INSUFFICIENT\_PERMISSIONS**: Only group admins can change member scope. Verify the logged-in user's role.
    * **Scope change not reflecting**: Make sure you've registered a `GroupListener` and are handling `onGroupMemberScopeChanged`.
    * **Missed events not appearing**: Fetch previous messages using `MessagesRequest` — scope change actions appear as `Action` messages in the message history.
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Kick & Ban Members" icon="user-slash" href="/sdk/react-native/group-kick-ban-members">
    Remove or restrict members from a group
  </Card>

  <Card title="Transfer Ownership" icon="arrow-right-arrow-left" href="/sdk/react-native/transfer-group-ownership">
    Transfer group ownership to another member
  </Card>

  <Card title="Retrieve Group Members" icon="users" href="/sdk/react-native/retrieve-group-members">
    Fetch the list of members in a group
  </Card>

  <Card title="Add Members" icon="user-plus" href="/sdk/react-native/group-add-members">
    Add new members to a group
  </Card>
</CardGroup>
