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!

4 Replies

  • 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

  • Nconforti's avatar
    Nconforti
    Mentor
    5 years ago

    Hey Tarun ,

     

    Thanks for the hint on the API browser!!

    I checked my version and I'm running 20.1 (Revision: 20.1 (20.1-release r2005011223))

    Group Hubs is enabled because I'm able to create Group Hubs and have some of them set up already. Any other idea?

  • Tarun's avatar
    Tarun
    Maven
    5 years ago

    Hey Nconforti ,

    It seems the API's mentioned by you were available in 20.3 release notes, the following is the link to the documentation:

    https://community.khoros.com/t5/Khoros-Community-Release-Notes/Khoros-Communities-20-3-Release-Notes/ba-p/578422#Apiupdates

    Once your Community is upgraded to the 20.3 version, you may be able to use these APIs.

     

    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