How can I set dbasejoin "add front end option" according to ACL?

p38

Active Member
Hi all,

Is there any way I can set the "Add front end option" of a dbasejoin according to the logged in user ACL?

I want to show this option for certain logged in user levels

Paul
 
You can do that with a bit of work. The code below is an ALL or NOTHING approach. If you want to set it on a per element basis you will need to get the parent by the ID the set it's child to not display. This does them ALL for the given user group. You will need to get the current user group(s) (I am using $my in the code below for this). If the current user is not in group 8 in my example, ALL the add options on the page are hidden. You can add the code to an existing <script> tag is your site template index.php file in the <head> section. If there is not an existing <script> tag you will need to add it too:

Code:
<script>
  window.onload = function() {
     // if user not in group with ID 8
    <?php if (! isset($my->groups["8"])) { ?>
     //get all add option elements
      var addOption = document.getElementsByClassName('toggle-addoption');
      for (var i=0, currElem; currElem = addOption[i]; i++) {
        // hide the add option element
        currElem.style.display = 'none';
      }
       
    <?php } ?>
  }
</script>

Regards,
Dale
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top