ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Javascript Variables

December 13, 2011 12:24pm

Subscribe [2]
  • #1 / Dec 13, 2011 12:24pm

    mattgreen110

    46 posts

    Wondering if there is an easier way to do something.

    I have the calendar module from Solspace installed. One member group should only be able to access one calendar, and the other group - both of them. The calendar module doesn’t consider member group access and restrictions, either you have access to the channel or not. So I am using CP JSS & JS to to remove one calendar, which is easy.

    $(function(){ 
          $('#calendar_select select option[value="4612"]').remove();
    });

    But I want to add a conditional based on user login

    $(function(){ 
        if ($member_group != 8) {
          $('#calendar_select select option[value="4612"]').remove();
        }
    });

    Something like that, but I am wondering if there is an easy way to access the member_group variable or member_id via jquery. Does EE have a library available already? If not, what is a good suggestion on how to do this within the control panel.

    I know for the front end I could just use the {member_group} tag within an id or class, and I can use that for a variable. I don’t want to hack any front end cp template files doing that. any ideas?

    EE v2.3.1
    Calendar 1.6.3

  • #2 / Dec 14, 2011 3:12pm

    Dan Decker

    7338 posts

    Hi mattgreen110,

    I’m not entirely clear on what files you are editing to make these changes. I understand that you are wanting to restrict this access via the Control Panel, I’m just not clear on where you are making these changes. This sounds like you might be better served getting a feature request into Solspace to allow this functionality.

    But this is really outside the scope of ExpressionEngine technical support and might be better served as a discussion in Community Help.

    Cheers!

  • #3 / Dec 14, 2011 3:49pm

    mattgreen110

    46 posts

    I understand, thanks.

    I am using CP JSS & JS http://devot-ee.com/add-ons/cp-css-js

    The question was more general that could apply to anything. I have made this feature request with solspace. But that was just an example so that you could understand what I am trying to accomplish more easily, or what I am even asking about.

    I know javascript is a huge part of the control panel and it’s functionality so I was just wondering if a lot of the same global variables that are available for php like username, group_id, and other session based variables based on the user’s logged info were available using javascript. I figured it out with adding things to the core files which is a quick fix. Thanks again.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases