API > Users

Basic JavaScript object

getActivity

Gets list of activity for the certain user.

Parameters

  • userId
    ID of a user for which you need to get activity
  • limit
    Maximum number of activity which has to be returned. By default 5, minumum value 1, maximum value 20.
  • offsetId
    ID of activity regarding to which is needed to get activity in descending order.

Result

After success returns object which contains request status in success property and template render in html property

  • 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/activites.twig with specified user in request.

Example


addFriend

Creates friend request and subscribes to user.
Or subscribes and accepts friend request if the user ID has sent the same request to this user.

Parameters

  • userId
    ID of a user to which is needed to send request or accept request from the user.

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/Users/views/partials/users-list.twig
  • message
    Error message in a case of unsuccessful request.
  • status
    Status code of HTTP

Example


removeFriend

Removes user from the friend list or cancels friend request.

Parameters

  • userId
    ID of a user who had to be removed from the friend list or whose friend request has to be cancelled.

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/Users/views/partials/users-list.twig
  • message
    Error message in a case of unsuccessful request.

Example


getFollows

Returns list of users who are followed by user.

Parameters

  • userId
    User ID for which is needed 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.

Result

Returns object with success and html properties:

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

Example


getFollowers

Returns list of users who are subcribed to a user.

Parameters

  • userId
    User ID for which is needed 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.

Result

Returns object with success and html properties:

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

Example


follow

Subscribes to specified user.

Parameters

  • userId
    ID of a user 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 if successful or false in a case of error.
  • html
    Template render membership-by-supsystic/src/Membership/Users/views/partials/users-list.twig
  • message
    Error message in a case of unsuccessful request.
  • status
    Status code of HTTP

Example


unfollow

Unsubscribes from specified user.

Parameters

  • userId
    ID of a user from which is needed 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/Users/views/partials/users-list.twig

Example


Allows to search users by first and last name.

Parameters

  • query
    Request line

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

  • offset
    Offset which is needed for selecting certain subset of users.

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

    Acceptable values

    • users-list will be rendered membership-by-supsystic/src/Membership/Users/views/partials//partials/users-list.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, 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/Users/views/partials//partials/users-list.twig or membership-by-supsystic/src/Membership/Base/partials/search-dropdown-user.twig

Example


get

Returns list of users, sorting order is specified in the plugin settings.

Parameters

  • limit
    Maximum number of users which has to be returned. By default 10, minumum value 1, maximum value 20.
  • offset
    Offset which is needed for selecting certain subset of users.

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/Users/views/partials/users-list.twig

Example


changeCover

Changes cover of current user.

Parameters

  • attachmentId
    ID of uploaded image. Look at method 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 onject which contains properties success and images

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

Example


removeCover

Removes cover of current user.

Result

Returns object which contains success property

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

Example


changeAvatar

Canges avatar of current user.

Parameters

  • attachmentId
    ID of uploaded image. Look at method 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 which contains success property and images

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

Example


removeAvatar

Removes avatar of current user.

Result

Returns object which contains success property

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

Example


saveField

Saves specified field with user information.

Parameters

  • fieldName
    Field name ID.
  • fieldName
    Value or array of values if the type field supports set of values.

Result

Returns object which contains success property

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

Example


getFriends

Returns list of user’s friends.

Parameters

  • userId
    User ID for which is needed to get a list.
  • limit
    Maximum number of users which has to be returned. By default 10, minumum value 1, maximum value 20.
  • 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 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/Users/views/partials/users-list.twig

Example


getFriendshipRequests

Returns list of friend requests.

Parameters

  • limit
    Maximum number of users which has to be returned. By default 10, minumum value 1, maximum value 20.
  • 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 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/Users/views/partials/users-list-friend-requests.twig

Example


updatePrivacy

Updates user privacy settings

Parameters

  • privacies

    Settings object which contains pairs settings name – value.

    Acceptable names of privacy settings.

    • view-about
    • view-friends
    • view-follow
    • view-followers
    • view-groups
    • post-activity
    • view-comments
    • post-comments
    • view-posts

    Acceptable values.

    • all-users
    • friends
    • friends-of-friends
    • only-me

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


changeEmail

Updates user email.

Parameters

  • email
    New email
  • password
    Current password.

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 email or error message.

Example


changePassword

Updates user password.

Parameters

  • password
    Current user password
  • newPassword
    New user password.
  • newPasswordConfirmation
    New password coinformation

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 password or error message.

Example


deleteAccount

Removes user account.

Parameters

  • password
    Current user password

Result

Returns object with properties success and redirect, 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 where user has to be redirected after deleting.
  • message
    Error message.

Example


getPosts

Returns list of user’s posts.

Parameters

  • userId
    User ID for which is needed to get a list.
  • limit
    Maximum number of posts which has to be returned. By default 10, minumum value 1, maximum value 50.
  • offsetId
    Post ID regarding to which a list will be displayed in descending order.

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/Users/views/partials/posts.twig

Example


getPosts

Returns list of user’s posts.

Parameters

  • userId
    User ID for which is needed to get a list.
  • limit
    Maximum number of posts which has to be returned. By default 10, minumum value 1, maximum value 50.
  • offsetId
    Post ID regarding to which a list will be displayed in descending order.

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/Users/views/partials/posts.twig

Example


getComments

Returns list of user comments.

Parameters

  • userId
    User ID for which is needed to get a list.
  • limit
    Maximum number of commnets which has to be returned. By default 10, minumum value 1, maximum value 50.
  • offsetId
    Comment ID regarding to which a list will be displayed in descending order.

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/Users/views/partials/comments.twig

Example


Categories
Latest Articles
Get plugins bundle today and save over 80%