onLoad

The onLoad handler is commonly used for simple customizations that involve redirecting users (say, to login when custom criteria are met) or defining variables that will be used later in the page.

<?php
    $_LW->REGISTERED_APPS['my_app']=[
       'title'=>'My App',
       'handlers'=>['onOutput'],
    ];

    class LiveWhaleApplicationMyApp {

      public function onLoad() {
      global $_LW;

      // Require authentication on public submissions page
      if ($_LW->page=='/submit/index.php') { // if on public submissions page
        if (!$_LW->isLiveWhaleUser() && !$_LW->isSSOAuthOnlyUser()) { // require authentication
          die(header('Location: /livewhale/?login&url=/submit/'));
        };
      };

      }

   }
?>