Hello everyone,
I'm new to PHP and Drupal and I wonder how hard it would be to write a script to authenticate a user using drupal's authentication mechanism. Ideally, I'd like to pass a user name and password to that script and receive a True/False depending on whether or not that user name/password matches the ones of a user registered in my site. The script would be called from either the unix shell or from another application.
In addition to that, depending on the complexity, I also would like to have a script to check if a certain user belongs to a specified organic group (og).
Any hints on how to implement any of those scripts? Are there examples of scripts like those that I could have a look at?
Thanks in advance for your help,
Leo
On Sun, 31 Jul 2005, Leo Burd wrote:
I'm new to PHP and Drupal and I wonder how hard it would be to write a script to authenticate a user using drupal's authentication mechanism. Ideally, I'd like to pass a user name and password to that script and receive a True/False depending on whether or not that user name/password matches the ones of a user registered in my site. The script would be called from either the unix shell or from another application.
Not hard.
Call user_load($array) where $array is an array that looks like ('name' => $name, 'pass' => $pass). If the returend object has an item uid, then you were successfull.
In addition to that, depending on the complexity, I also would like to have a script to check if a certain user belongs to a specified organic group (og).
Look in og.module and call the responsible function. Otherwise you'll need to query the node_acess table directly.
Any hints on how to implement any of those scripts? Are there examples of scripts like those that I could have a look at?
There are some exapmple script that come with the devel.module in the generate subdirectory. Those are mainly for inserting stuff, though.
Cheers, Gerhard