Gallery2:Modules:logincookie - Gallery Codex
Personal tools


From Gallery Codex

Login Cookie Module
Creates a cookie on user login and deletes it on logout
Author: Dayo Akanji
Download the module files here.
Visit the Support Site for enquiries and support requests.


  • Gallery 2.3.0 and above


  • The module creates a cookie, GALLERYUID, recording the User ID on user login and deletes it on logout.
  • It is designed for a situation where a third party application needs to know whether the Gallery2 user is logged in or not.
  • A good example is when a caching webserver such as Nginx, is in use. Under the standard Gallery2 configuration, it is impossible to determine whether a request reaching the webserver is from a guest or a logged in user. With the cookie attached to the request, the webserver than then be configured to serve and/or cache content accordingly. For instance, guests (requests without the GALLERYUID cookie) can be served cached content while logged in users are served fresh content. Without the ability to distinguish between the two sets of users, it will not be possible to cache any content as guests may be served pages reserved for logged in users otherwise.


  • Unpack the files into the Gallery2 modules folder.
  • No configuration needed. Just install and forget.