LogicMachine Forum
Trends buttons - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: OLD visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Trends buttons (/showthread.php?tid=6260)



Trends buttons - jmir - 20.01.2026

Hi,

Is there any way to hide  butons "Graph/Data" and "Export trend data" in the trends page (not using iframe) dependeing on which user is logged?
I've tried something like this, but doesn't work:
Code:
if (window.Globals && Globals.user === 'user') {
    $('.trends .btn-group').addClass('hide');
    $('.trends .show-export').addClass('hide');
}



RE: Tends buttons - admin - 20.01.2026

username is not exposed in Trends and Schedulers. One option is to hide these buttons for all users via CSS:
Code:
.trends .show-export,
.trends .inner .btn-group {
  display: none;
}
.trends .content > div {
  padding-bottom: 0;
}

There's a different solution using .lp script to determine the username but it cannot be used in LM cloud: https://forum.logicmachine.net/showthread.php?tid=1145&pid=6820#pid6820


RE: Tends buttons - jmir - 20.01.2026

Hi, thanks!
As I don't need it using cloud I've solved using .lp file in the link you shared and this javascript:
Code:
  // Llistat d'usuaris que han de tenir hide
  var usuarisAmbHide = [
    'usuari',
    'visualitzacio',
    'demo'
  ];

  var xhttp = new XMLHttpRequest();

  xhttp.onreadystatechange = function () {
    if (xhttp.readyState === 4 && xhttp.status === 200) {

      var res = xhttp.responseText;
      res = res.trim();

      if (res !== undefined && res !== null) {

        // Comprovar si l'usuari està dins del llistat
        if (usuarisAmbHide.indexOf(res) !== -1) {

          document
            .querySelectorAll('.trends .btn-group, .trends .show-export')
            .forEach(function (el) {
              el.classList.add('hide');
            });

          console.log('hide aplicat a l’usuari:', res);
        }
      }
    }
  };

  xhttp.open('GET', '/user/user.lp', true);
  xhttp.send();