API Reference

Groups.isUserInGroup

Checks whether a user is in an group.

A simple boolean will be returned, true if the user is in the group, false otherwise.

If includeChildren is true then this function will return true if the user is in the group specified or any of its descendants.


Syntax

bool groups.isUserInGroup ( int groupID, int userID, bool includeChildren = false )

Arguments

NameTypeRequiredDefault valueDescription
groupIDintRequirednoneThe ID of the group to search the user in.
userIDintRequirednoneThe user ID that we are checking to see if they are in the group.
includeChildrenboolOptionalfalseBy default this is false. Possible values are true or false. This will treat the group ID as the parent and if it has any children it will check and return a response, 1 or 0 if the specified user ID is in the supplied group ID or any of the children groups.

Response

The response will contain 1 if the media item is in the specified group ID.

NameTypeDescriptionSuccessERROR
resultINTIf the media ID is a member of the group a response of 1 will be returned. If the media item is not a member of the group the response will be empty.<result>1</result><result/>

Sample Response

Sample REST Response
http://api.newspark.ca/services/rest/groups/isUserInGroup?groupID=[GROUP_ID]&userID=[MEDIA_ID]&includeChildren=true
<?xml version="1.0" encoding="UTF-8"?>
<result>1</result>
Sample JSON Response
{
    "status": true,
    "result": 1
}

Code examples

0 comments

Be the first to comment on isUserInGroup.

Add a Comment

  • captcha