Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Set Member group ID variable in template using JavaScript


Recommended Posts

  • Owner

Sometimes you might want to control something based on member groups. One way to do this is to set a variable using JavaScript:

In a template to use just the primary group:

<script>
  var groupId = {expression="\IPS\Member::loggedIn()->member_group_id"};
</script>

or for all group ids (comma-separated):

<script>
  var groupIds = "{expression="implode( ',', \IPS\Member::loggedIn()->groups )"}";
</script>

 


View full record

Link to post
Share on other sites
  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...