Re: [development] Can I use an external user DB instead of the original user table in drupal DB?
I want users to provide more profile, and module profile can solve this issue. But it's not convenient to query the data, which user provides. Because the data has been saved in 'profile_fields' and 'profile_values', two tables separately.
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
On Jun 15, 2007, at 3:51 AM, andy@spiders-lair.com wrote:
I want users to provide more profile, and module profile can solve this issue. But it's not convenient to query the data, which user provides. Because the data has been saved in 'profile_fields' and 'profile_values', two tables separately.
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.
As an alternative, you could install (shameless plug) site_user_list.module. Although the primary purpose of this module is not what you're after, it has a nice side effect of being able to create a database view which will look like a proper table of all the profile data. There is some setup you would need to do (to tell it which profile columns you want in the table), but afterwards you would be able to just select data from it. There are still some cases where it might not be useful (especially if you're using MySQL < 4.1; less so if you're < 5.0) because of issues either with what the database supports, or keeping the data up- to-date; but it might help... HTH, Ricky The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.
On Jun 15, 2007, at 12:51 AM, andy@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.
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@mikeyp.net http://mikeyp.net 714.356.0168
Quoting Michael Prasuhn <mike@mikeyp.net>:
On Jun 15, 2007, at 12:51 AM, andy@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.
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.
Have you looked at http://drupal.org/project/openid for a possible solution? Earnie
2007/6/16, Earnie Boyd <earnie@users.sourceforge.net>:
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.
Have you looked at http://drupal.org/project/openid for a possible solution?
Earnie
Thank you. I will try these methods you mentioned. If the modules can solve my problem, it's the best way. Or I have to develop something myself. Huisi
participants (5)
-
andy@spiders-lair.com -
Earnie Boyd -
Huisi Wang -
Michael Prasuhn -
Richard Morse