AnsweredAssumed Answered

Hide/Show Buttons for Certain user roles

Question asked by Xavier Cotto on Jul 29, 2016
Latest reply on Jul 30, 2016 by Alex Clement


Hi Team

 

We have this JS to Hide the following buttons for Teacher Roles.

 

The problem is that I have the Account Admin role but when I created a manually courses I get enrolled automatically  as a Teacher role and the JS automatically hides me those buttons.

 

Actual Code:

 

if($.inArray('teacher,ENV['current_user_roles']) === 1) {

       $('a.btn.button-sidebar-wide.delete_course_link').hide();

       $('a.btn.button-sidebar-wide.reset_course_content_button').hide();

       $("a:contains('Conclude this Course')").hide();

       $("a:contains('Export Course Content')").hide();

I

've tried also the else if but but still hidden.

 

Is there something we can identify by the user enrollment role id and define it by that user role?

 

onPage(/\/courses\/\d+\/users/

 

Then,.

 

hasAnyRole('admin', function (hasRole)

 

       $('a.btn.button-sidebar-wide.delete_course_link').show();

       $('a.btn.button-sidebar-wide.reset_course_content_button').show);

       $("a:contains('Conclude this Course')").show();

       $("a:contains('Export Course Content')").show();

 

Any help will be appreciated

 

Fede Arbelaez

Outcomes