![]() |
Get user via the API
Hi folks. Is there a way to use the vBulletin API to find a user based on their username, or must I search the "users" database table? If there is, would you mind pointing me at some docs, or including a code snippit?
Thanks, Nick |
Did you look at the API - http://members.vbulletin.com/api/ ? There is a function called fetch_userid_from_username listed on there.
|
You can use the function above in conjunction with fetch_userinfo get the the full info
|
Ack, I worded my question incorrectly.
I did indeed see fetch_userid_from_username() and fetch_userinfo(). However, those can only be used to get a user's info. Once you have that info, it's not possible to update it. Correct? Using the vB API, is it possible to get a "user object", through which the user's data can be updated? For example: PHP Code:
Nick |
You can pass it onto the user data manager. (See the manual about data managers.)
|
Quote:
Quote:
Other than querying the users database table, is there any other way to get a user's ID via their username? Thanks, Nick |
fetch_userinfo is in functions.php.
You can always copy functions to your plugins if you need them. |
Right, but fetch_userinfo() is only useful if one has the user's ID.
For many reasons, copying functions is not a good idea. Doing so violates the DRY principle, makes your code brittle with respect to vBulletin updates, etc. Also, it negates the whole point of having an API. |
Then all I can suggest is a quick query. I know that's what I do in some of my customized site code.
|
Thanks for your insight, Lynne. It's helpful to hear what others have done in the past.
|
All times are GMT. The time now is 07:24 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|