The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to get user picture info for use outside of vB
I don't know if anyone has an interest in this information, but I thought I'd share it.
My boss has an old, established, and huge vB site, and as part of his new web offerings, he wanted to have a main outside of vB page that showed all the site stats, latest thread posts, user pics, etc., and of course allow users to link to the relevant things on his actual vB site. And of course allow log-in shared between the two. Being new to vB, I spent some time scanning the source code, and reading a lot of posts and articles here. Finally, it became clear to me that for most of what I needed to do, I had to become intimate with vB's database. User profile pictures, from what I've found, are stored default in the database, but I think there's an option for you to move them to the file system if you wish. My bosses installation, I found, had ALL the picture's, etc., stored within the database. vB does offer image.php for display of images, and for situations where you've already got a session to work with, you might want to explore that route. Unfortunately, in my case, that wasn't an option, so I essentially duplicated the relevant parts of that in my own function. I'm going to walk through the high lites of what I did. I'm a HUGE codeigniter framework fan, so the code snippet is based on that. So, the problem is: Get a list of some of the most popular members, based on profile visits, and then pull their profile pictures ( if they have one ), and display them on our other site. To obtain MOST PROFILE VISITS, an sql statement to get you started would be: Code:
SELECT username, userid, profilevisits FROM user ORDER BY profilevisits DESC LIMIT 0,6 The userid is important, as it is needed for both pulling and displaying the picture. To obtain the picture info for these folks, some starter sql might be: Code:
SELECT filedata, filename FROM customprofilepic WHERE userid=$uid This gives you back the filename, and the actual picture data( filedata ). To show this picture, a basic PHP function might look like: PHP Code:
If you just run this function alone, it will output the picture into your bowser. If you want to use the picture in an <img> tag, you need to use the FULL url to the function. With some playing around, I was able to get everything we needed for display outside vB. Things like: Total number of users, number and content of Polls, Threads, Forums, posts, etc. vB keeps everything in the db, so it only stands to reason with proper querrying, you can get all that stuff back out. You can also pull albums, etc. belonging to users, yada, yada. Bear in mind, though, that a lot of these things have visibility settings, and in some cases privacy settings. Before you indescriminantly pull pictures and such out of the db for display, be sure you check through these and make sure you're not violating the users desired privacy . Hopefully, you found this of some use. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|