API > Groups

Basic JavaScript object

getActivity

Gets list of activity for the certain group.

Parameters

  • groupId
    ID of a group for which is needed to get activity
  • limit
    Maximum number of activities which has to be returned. By default 5, minumum value 1, maximum value 20.
  • offsetId
    Activity ID regarding to which activities needed to be received in descending order.

Result

After success returns object with properties success and html.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Activity/views/partials/activities.twig with specified in request user.

Example


postActivity

Publishes post on a group page.

Parameters

  • groupId
    ID of a group for which is needed to get activity.

  • data
    Object with properties for publication

    Available properties:

    • message
      Message text
    • link
      Link ID to display in the post, can be received after the method call parseUrlAttachment
    • images
      Image ID array which has to be attached to the post, can be received after the call uploadImage
  • isCommunityPost
    Publiches post on behalf of a group.

Result

After success returns object with properties success and html.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Activity/views/partials/activities.twig with specified in request user.

Example


removeActivity

Remopves post on a group page.

Parameters

  • activityId
    ID of a post which has to be deleted.

Result

After success returns object which contains request status in success property.

  • success

Example


Changes group logo.

Parameters

  • groupId
    ID of a group for which is needed to change logo.

  • attachmentId
    ID of uploaded image. Can be received in method Membership.base.uploadImage

  • cropData

    Object with properties to crop an image.

    x: x-axis offset of cropped area

    y: y-axis offset of cropped area

    width: width of image cropped area

    height: height of image cropped area

Result

Returns object with properties success and image:

  • success
    Request status true in a case of success or false in a case of error.
  • images
    Image array of specified group with types: cover, logo and specified in the plugin settings sizes.

Example


Removes group logo.

Parameters

  • groupId
    ID of a group for which logo has to be deleted.

Result

Returns object which contains property with request result: success

  • success
    Request status true in a case of success or false in a case of error.

Example


changeCover

Changes group cover.

Parameters

  • groupId
    ID of a group for which cover has to be changed.

  • attachmentId
    ID of uploaded image. Can be received in method Membership.base.uploadImage

  • cropData

    Object with properties to crop an image.

    x: x-axis offset of cropped area

    y: y-axis offset of cropped area

    width: width of image cropped area

    height: height of image cropped area

Result

Returns object with properties success and image:

  • success
    Request status true in a case of success or false in a case of error.
  • images
    Image array of specified group with types: cover, logo and specified in the plugin settings sizes.

Example


removeCover

Removes group cover.

Parameters

  • groupId
    ID of a group for which cover has to be removed.

Result

Returns object which contains property with request result: success

  • success
    Request status true in a case of success or false in a case of error.

Example


join

Creates request to join a group if the group is "Closed" type, or joins the group if the group is "Open" type. Also confirms group invitation.

Parameters

  • groupId
    Group ID.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, message, status.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Groups/views/partials/groups-list.twig
  • message
    Error message in a case of unseccessful request.
  • status
    Status code of HTTP in a case of unseccessful request.

Example


leave

Cancels membership request if a group is "Closed" type or removes current user from the group if the group is "Open" type. Also cancel group invitation.

Parameters

  • groupId
    Group ID.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, message, status.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Groups/views/partials/groups-list.twig
  • message
    Error message in a case of unseccessful request.
  • status
    Status code of HTTP in a case of unseccessful request.

Example


delete

Deletes group. Available only for a user with a role of group administrator.

Parameters

  • groupId
    Group ID.

Result

Returns object which contains such properties: success and redirect in a case of success or success and message in a case of error:

  • success
    Request status true in a case of success or false in a case of error.
  • redirect
    A link to redirect user after deleting.
  • message
    Error message in a case of unseccessful request.

Example


follow

Subscrtibers user to a certain group.

Parameters

  • groupId
    ID of a group to subscribe.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, message, status.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Groups/views/partials/groups-list.twig
  • message
    Error message in a case of unseccessful request.
  • status
    Status code of HTTP.

Example


unfollow

Unsubscribes user from a certain group.

Parameters

  • groupId
    ID of a group to unsubscribe.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, message.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Groups/views/partials/groups-list.twig

Example


getUsers

Returns list of users related to a group.

Parameters

  • groupId
    ID of a group for which is needed to get a list.

  • status
    User status

    Available status for everyone

    • approved User is approved.

    Available statuses only for group administrator

    • unapproved User is waiting for approval
    • invited Invited user
    • blocked Blocked user
  • limit
    Maximum number of users which has to be returned. By default 10, minumum value 1, maximum value 20.

  • offset
    Offset needed for selecting a certain subset of users.

  • offsetId
    User ID regarding to which a list will be displayed in descending order.

  • search
    Field with user name according to which is needed to filter result.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, status.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Groups/views/partials/users-list.twig
  • status
    Status code of HTTP.

Example


removeUser

Removes user/users from a group and blocks them due to mentioned parameter.

Parameters

  • groupId
    Group ID.
  • userId
    User ID.
  • block
    Add user to a blacklist.

Result

Returns object which contains such properties: success in a case of success and status in a case of error.

  • success
    Request status true in a case of success or false in a case of error.
  • status
    Status code of HTTP.

Example


unblockUser

Unblocks user in a group.

Parameters

  • groupId
    Group ID.
  • userId
    User ID.

Result

Returns object which contains such properties: success in a case of success and status in a case of error.

  • success
    Request status true in a case of success or false in a case of error.
  • status
    Status code of HTTP.

Example


approveUser

Confirms membership request from a user.

Parameters

  • groupId
    Group ID.
  • userId
    User ID.

Result

Returns object which contains such properties: success in a case of success and status in a case of error.

  • success
    Request status true in a case of success or false in a case of error.
  • status
    Status code of HTTP.

Example


getUsersToInvite

Returns a list of users who are not a group members and are not invited yet, if the groupId parameter is specified.

Parameters

  • groupId
    ID of a group for which is neede to get a list.

  • limit
    Maximum number of users which has to be returned. By default 10, minumum value 1, maximum value 50.

  • offsetId
    User ID regarding to which a list will be displayed in descending order.

  • search
    Field with user name according to which is needed to filter result.

  • template
    A template with the help of which a list be rendered.

    Acceptable values

    • invite-modal will be rendered membership-by-supsystic/src/Membership/Groups/views/partials/invite-modal-users.twig
    • search-dropdown will be rendered membership-by-supsystic/src/Membership/Base/partials/search-dropdown-user.twig

Result

Returns object which contains such properties: success in a case of success and html in a case of error success, status.

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Groups/views/partials/invite-modal-users.twig or membership-by-supsystic/src/Membership/Base/partials/search-dropdown-user.twig
  • status
    Status code of HTTP.

Example


invite

Sends an invitation to a user to join a group.

Parameters

  • groupId
    Group ID.

  • userId
    User ID.

  • role
    User role

    Acceptable values
    user

    Acceptable values only fro a group administrator
    administrator

Result

Returns object which contains such properties: success in a case of success, and success and status in a case of error.

  • success
    Request status true in a case of success or false in a case of error.
  • status
    Status code of HTTP.

Example


cancelInvite

Removes or calcels invitation to join a group.

Parameters

  • groupId
    Group ID.
  • userId
    User ID.

Result

Returns object which contains such properties: success in a case of success and html in a case of error success и status.

  • success
    Request status true in a case of success or false in a case of error.
  • status
    Status code of HTTP.

Example


updatePrivacy

Updates privacy settings of a group.

Parameters

Group ID.

  • privacies
    Object of settings which contains pairs setting name – value.

    Acceptable names of privacy settings.

    • type Type of a group.

      • open Open group, any user can join
      • closed Closed group, user sends membership request and group administrator has to approve it.
      • private Private group, isn’t shown anywhere and user can join it only by invitation.
    • read-activity Reading content

      • all All users can read post in a group
      • members-only Only users who joined a group can see posts
    • post-activity Publishing posts

      • all All users can publish posts
      • members-only Only users who joined a group can publish posts
      • administrators Only administrators can publish posts
    • post-comments Leaves comments to posts

      • all All users can leave comments
      • members-only Only users who joined a group can leave comments
      • administrators Only administrators can leave comments
    • invitations Invite other users to a group

      • all All users can invite other users
      • administrators Only administrators can invite other users

Result

Returns object with properties success and message:

  • success
    Request status true in a case of success or false in a case of error.
  • message
    Message about successful change of settings or error message.

Example


updateData

Updates group data.

Parameters

  • groupId
    Group ID.
  • data
    Object which contains pairs property name – value
    Acceptable properties.

    • name Group name.
    • description Group description.

Result

Returns object with properties success and message:

  • success
    Request status true in a case of success or false in a case of error.
  • message
    Message about successful change of data or error message.

Example


get

Returns list of groups.

Parameters

  • limit
    Maximum number of users which has to be returned. By default 10, minumum value 1, maximum value 50.
  • offsetId
    Group ID regarding to which a list will be displayed in descending order.
  • search
    Field with group name according to which is needed to filter result.

Result

Returns object with properties success and html

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Groups/views/partials/groups-list.twig

Example


getUserGroups

Returns a list of groups of a current user.

Parameters

  • type Type of a group..
    joined A group which user has joined.
    managed A group where user is administrator.
    invited A group where user was invited.
  • limit
    Maximum number of users which has to be returned. By default 10, minumum value 1, maximum value 50.
  • offsetId
    Group ID regarding to which a list will be displayed in descending order.
  • search
    Field with group name according to which is needed to filter result.

Result

Returns object with properties success and html:

  • success
    Request status true in a case of success or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Groups/views/partials/groups-list.twig

Example


createGroup

Creates new group.

Parameters

  • name
    Group name.
  • description
    Group description
  • type
    Group type.
    Acceptable types

    • open Open group, any user can join
    • closed Closed group, user sends membership request and group administrator has to approve it.
    • private Private group, isn’t shown anywhere and user can join it only by invitation.
  • invitedUsers
    Array with user IDs that you want to send invitations to join a group after creation of a group.

Result

Returns object with properties success, redirect and message.

  • success
    Request status true in a case of success or false in a case of error.
  • redirect
    Link to a created group.
  • message
    Message about successful group creation or error message.

Example


block

Blocks group.

Parameters

  • groupId
    Group ID.

Result

Returns object with success property.

  • success
    Request status true in a case of success or false in a case of error.

Example


unblock

Unblocks group.

Parameters

  • groupId
    Group ID.

Result

Returns object with success property.

  • success
    Request status true in a case of success or false in a case of error.

Example


Categories
Latest Articles
Obtenha os pacotes de plugins hoje e economize mais de 80%