Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Set Member group ID variable in template using JavaScript


    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>

     


    User Feedback

    Recommended Comments

    There are no comments to display.



    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...