Skip to content

Block Users

Some users might start annoying others. If that’s the case, users can block others to prevent getting their notifications or requests and to limit the content that these toxic users can see.

At the moment, when a user blocks another:

  • All relationships like friend or follow between these users will be removed automatically and trying to create new ones will be ignored.
  • Blocked users won’t appear as suggested, even if they are trending.
  • Blocked users won’t see content of the other in their timelines.

In the future:

  • Notifications between these users won’t be sent.
  • Blocked users won’t be able to search for each other.
  • Blocked users won’t see content posted in specific topics or groups from each other.
  • Blocked users won’t be able to comment on activities posted by each other.


To block users use:

Communities.blockUsers(UserIdList.create("424242424242"), { () ->
    Log.d("Communities", "Successfully block users.")
}, { error ->
    Log.d("Communities", "Failed to block users: $error")
Communities.blockUsers(UserIdList.create(["32274837428"]), success: {
    print("Successfully block users.")
}, failure: { error in
    print("Failed to block users: \(error)")
    .then(() => console.log('Successfully block users.'))
    .catch((error) => console.error('Failed to block users, error: ', error))
var userIds = UserIdList.create(['user1', 'user2']);
    .then(() => print('Successfully block users.'))
    .catchError((error) => print('Failed to block users, error: $error'));


Unblock works in the same way, as Block, just use method unblockUsers:

Communities.unblockUsers(UserIdList.create("424242424242"), { () ->
    Log.d("Communities", "Successfully unblock users.")
}, { error ->
    Log.d("Communities", "Failed to unblock users: $error")
Communities.unblockUsers(UserIdList.create(["32274837428"]), success: {
    print("Successfully unblock users.")
}, failure: { error in
    print("Failed to unblock users: \(error)")
    .then(() => console.log('Successfully unblock users.'))
    .catch((error) => console.error('Failed to unblock users, error: ', error))
var userIds = UserIdList.create(['user1', 'user2']);
    .then(() => print('Successfully unblock users.'))
    .catchError((error) => print('Failed to unblock users, error: $error'));

Get Blocked Users

To get blocked users:

    { result: PagingResult<User> ->
        Log.d("Communities", "Users blocked by current user: ${result.entries}")
    }, { error: GetSocialError ->
        Log.d("Communities", "Failed to get blocked users: $error")
let pagingQuery = BlockedUsersPagingQuery.init()
pagingQuery.limit = 25

Communities.blockedUsers(pagingQuery, success: { result in
    print("Users blocked by current user: \(result.users)")
}, failure: { error in
    print("Failed to get blocked users: \(error)")
Communities.getBlockedUsers(new PagingQuery())
    .then((result) => console.log('Users blocked by current user: ', result.entries))
    .catch((error) => console.error('Failed to get blocked users, error: ', error));
var pagingQuery = PagingQuery.simpleQuery();
    .then((result) {
        print('Users blocked by current user: $result.entries');
    .catchError((error) => print('Failed to get blocked users, error: $error'));

This method uses the PagingQuery concept that is used across our SDK. Read more about this.

Give us your feedback! Was this article helpful?

😀 🙁