Search code examples
drupaldrupal-6

How do i check if a user is accessing a particular module in drupal


I do have a list of modules in D6.Is there any way by which i could probably find which module the current user is accessing.If i have a module named X and a function named Y.If a user is using the function Y could i check if the X module is being accessed by the user..??


Solution

  • You can add a watchdog call to the function in question. Monitor access in-site on the reports page then.

    Here is an example:

    global $user;
    watchdog("Access Logging",
             "Access to %func in %file by %user",
             array("%func" => __FUNCTION__,
                   "%file" => __FILE__,
                   "%user" => $user->name),
             WATCHDOG_NOTICE);