I am working on an event registration. We need to hide certain price set line items based on various factors. Most are based on previous field response but there is one line item that needs to be hidden if user is logged in. I found this post: https://wordpress.stackexchange.com/questions/69814/check-if-user-is-logged-in-using-jquery

But can't seem to get it to work in my custom template. I probably have some syntax wrong.

Any thoughts or a alternate solution would be appreciated.


  • maybe worth looking at how folk are doing the 'show line items to limited users, eg folk in a group' and then reverse engineer? There was a question / answer about the latter quite recently that pointed to an Extension I had not heard of previously - github.com/tadpolecc/civicrm_groupprice
    – petednz - fuzion
    Mar 14 '18 at 1:14

So I've done something similar (I used the group a user was a part of vs just a user) with a template 'extra' file that contained javescript and a quick call to the API. Not sure if this is the ideal method but it worked to show/hide some content.


Javascript Contact API - how do I 'do something' with results

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.