[development] Can I use an external user DB instead of the original user table in drupal DB?

Michael Prasuhn mike at mikeyp.net
Fri Jun 15 20:53:35 UTC 2007


On Jun 15, 2007, at 12:51 AM, andy at spiders-lair.com wrote:
> Think you're missing the point of "API". Use the user_load()  
> function which loads a user, profile and all for your convience. If  
> you want to see the structure returned (and where the profile  
> fileds are) install the devel module which can display this for you.
>
> http://api.drupal.org/api/5/function/user_load

Not necessarily, I am working on a site with an integrated CRM  
(stores contacts as a custom CCK type) and the API doesn't seem to be  
able to do what I need, which is: Look up uid for a given node or  
form based on the ability to enter the contact name instead of the  
username, such as the authored by field on a new node.

This doesn't work because user_load doesn't call hook_user unless it  
finds a valid user in {users}, and node_validate doesn't call it's  
hooks until after it's thrown an error up on the authored by field. I  
know I could override the validate functions as needed, but this  
seems clunky.

I'm contemplating making a CCK field that would be able to lookup the  
name from the CRM type and then set node->uid accordingly. This  
module would probably enable hiding the original authored by  
field...but I'm not sure which is the more elegant solution.

Obviously some hook_nodeapi and hook_user examples are needed to  
display the CRM name when viewing nodes or users.


__________________
Michael Prasuhn
mike at mikeyp.net
http://mikeyp.net
714.356.0168





More information about the development mailing list