Forum Discussion

Nconforti's avatar
Nconforti
Mentor
5 years ago

Check if user is a member of a group hub

Hi everyone, I'm currently trying to create a component which will check if a user is a member of a group hub and then if they are, display something on a page. I keep using the LiQL from https://developer.khoros.com/khoroscommunitydevdocs/docs/membership-liql-examples, but for almost each one, I get an "invalid query syntax" error. Does anyone what might be the cause?

Here is the code I'm using:

 

 

<#assign apiVersion = "2.0"/>

<#assign liql_query = "SELECT join_date, title FROM nodes WHERE user.id = '" + user.id + "' "/>
${liql_query}

<#assign users= rest(apiVersion, "/search?q=" + liql_query?url + "&restapi.response_style=view") />

<br>${users.status}
<br>${users.message}

 

 

I've also tried the following queries, but same error (invalid query syntax):

SELECT id,login FROM users WHERE node.id = 'grouphub:EAP'

SELECT login, id, join_date FROM users WHERE node.id = '<node.type>:<node.id>'

<#assign liql_query = "SELECT * FROM roles WHERE users.id = '" + user.id + "' and node.id = 'grouphub:EAP'"/>

 

I can't for the life of me figure out what is wrong with the queries. I would appreciate the help!

  • Hi Nconforti ,

    Before trying the APIs in code,  It would be great if you could just try to use the API's in the API browser, and If you ar facing the same issue there as well, i.e. invalid query syntax then you can try the following:

     

    1. Check the version of your community

    [yourdomain]/status/version and check if the API's you are using are supported for your current version

    2. The Group hubs need to be enabled on your community, if not please add a support ticket for the same as given in the following Documentation:

    https://community.khoros.com/t5/Group-Hubs/Group-to-Group-Hubs-migration/ta-p/559440

    Please Give Kudos if you find this post useful and also mark this as Accepted Solution if this is the required solution.


    Regards

    Tarun Kumar