How to completely hide the membership system, making every user an admin?

This scenario is useful mainly if you are the only user of the generated AppGini app, and don't want to have to sign in every now and then, and want to remove the 'visual clutter' of the admin link, sign out link, .. etc.

Warning The following code basically makes every user a super admin. So, NEVER use this in a public-facing or multi-user app!

  • In hooks/__global.php, add this code after the first line to set user as admin without login:
    Authentication::signInAsAdmin();
  • In hooks/footer-extras.php, add this code to hide the admin/membership related elements:
    <script>
      $j(() => {
         $j(`
             a[href="admin/pageHome.php"],
             .signed-in-as, a[href="membership_profile.php"],
             a[href="index.php?signOut=1"],
             .sign-out-menu-item,
             .user-profile-menu-item
         `).remove();
      })
    </script>
    <style>
       #admin-tools-menu-button{ visibility: hidden; }
    </style>

The code above was tested on AppGini 22.13. If it doesn't work on a different version, it might need to be modified.