[development] how to intercept user login with cookie

Khalid Baheyeldin kb at 2bits.com
Tue Apr 3 17:31:05 UTC 2007

I think what you need happens in sesson.inc

function sess_read($key) {
  $user = db_fetch_object(db_query("SELECT u.*, s.* FROM {users} u INNER
JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = '%s'", $key));

  // We found the client's session record and they are an authenticated user
  if ($user && $user->uid > 0) {
    // user logged in via cookie

Not sure if there is a way to do that via a hook.

Perhaps extending hook_user to do that is a good idea.


On 4/3/07, vitamona <vitamona at gmail.com> wrote:
> hi,
> is there a way for intercept a user when login via cookie?
> For example, when a user login with a form (no cookie stored) is
> possible to intercept them with hook user:
> function hook_user($type, &$edit, &$user, $category = FALSE) {
>         if ($type == 'login') {
> Thanks a lot
> Vita

Drupal development, customization and consulting.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070403/4e016da7/attachment.htm 

More information about the development mailing list