![]() |
How Would I pull Information From vBulletin?
Hi All,
I'm wondering how would I pull information from vBulletin? I would like to pull: Username Posts And Some Additional Information - Pc1203 [EDIT]Sorry, the pages are outside of vBulletin.[/EDIT] |
Are you trying to display this information on a page within vBulletin or are you using it outside of vBulletin?
|
A page outside of vBulletin.
- Pc1203 |
This might of use to you: https://vborg.vbsupport.ru/showthread.php?t=108026
|
Well, that really isn't what I wanted. I wanted to pull a users posts into an external page. And, yes I checked, vBExternal doesn't do what I'm thinking of.
- Pc1203 |
What are you trying to do specifically, because I've used a modified vBExternal in the past to display trimmed posts, with the Author's Username, and date of posting on an external page.
|
Ok, this is what I'm trying to do. I'm trying to create a small profile system for my website. In it somewhere, it says the users posts, join date, username, and some custom profile fields. Hope this is better.
- Pc1203 |
Well it's really just a matter of querying the database for the relevant information.
Place the following at the very top of the pages you're displaying information on; make sure they're PHP files as well. Code:
<?php Example: Code:
$stats = $db->query_read("SELECT threadcount, replycount FROM " . TABLE_PREFIX . "forum"); |
Ok, Thanks alot!
// I would add rep but I guess it's disabled. - Pc1203 EDIT: I get a blank page after trying this code: Code:
<?php - Pc1203 |
Bump
- Pc1203 |
Something like this:
PHP Code:
(Untested) |
Ok, but would I need to include any files like global.php to get that to work?
- Pc1203 |
Yes you will need to include the global.php file from the main forum directory.
|
I just get a blank page. Here is my code:
Code:
<?php EDIT2: When I look at join date I get "1177448760" for my user.... |
You need to add the variables to a template
|
You need to use the vbdate() function to convert the timestamp into a readable format.
|
Ok, I did that and I'm still getting the same thing. Here is my code:
Code:
<?php Pc1203 Posts: 1044 Pc1203 Joined On: 1177448760 - Pc1203 |
This is how to use vbdate.
Code:
vbdate($vbulletin->options[dateformat], $userinfo['joindate']); |
Sample query for profile fields:
Code:
$fields = $vbulletin->db->query_first("SELECT * FROM userfield WHERE userid =".$userid); Also, you should look into cleaning the variables you're using in queries - or you'll leave this page open to SQL injection. |
Ok Thanks EnIgMa1234! The date works now. Any ideas on how to get some custom profile fields?
- Pc1203 EDIT: Ok, Kirk Y. I'll try that. Also you said I should change the variables, is that what you meant? |
[sql]$fields = $vbulletin->db->query_first("SELECT * FROM userfield
WHERE userid = '" . $userid . "');[/sql] |
Kirk/Enigma: Does fetch_userinfo() not fetch custom fields?
|
I've never used it, you may be right.
|
Quote:
- Pc1203 |
If Opserty is correct in you being able to simply use $userinfo['fieldX'] in place of the query I suggested, you don't need to worry about cleaning the $_GET superglobal.
|
Yup, Opserty is correct. So I don't have to worrie about anything then, right?
- Pc1203 |
No, as long as you're not querying anything more.
|
Ok, and for future reference here is the source:
Code:
<?php - Pc1203 |
PHP Code:
PHP Code:
|
All times are GMT. The time now is 09:20 PM. |
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:
|