Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 08-02-2007, 08:12 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Something like this:
PHP Code:
// Add the usual require stuff here
$wanted_userid 9// The user id of the user you want the data from 
$userinfo fetch_userinfo($wanted_userid);

$posts $userinfo['posts'];
// $joindate = $userinfo['joindate']; // Unformatted
$joindate vbdate($userinfo['joindate']); // Formatted date e.g. Mon 29th Aug 
ef

(Untested)
Reply With Quote
  #12  
Old 08-02-2007, 08:23 PM
Pc 1203 Pc 1203 is offline
 
Join Date: May 2007
Posts: 88
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, but would I need to include any files like global.php to get that to work?

- Pc1203
Reply With Quote
  #13  
Old 08-02-2007, 08:27 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes you will need to include the global.php file from the main forum directory.
Reply With Quote
  #14  
Old 08-02-2007, 08:33 PM
Pc 1203 Pc 1203 is offline
 
Join Date: May 2007
Posts: 88
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just get a blank page. Here is my code:

Code:
<?php
chdir('/home/penguink/public_html/forums');
require_once('/home/penguink/public_html/forums/global.php');

// Add the usual require stuff here
$wanted_userid = 9; // The user id of the user you want the data from 
$userinfo = fetch_userinfo($wanted_userid);

$posts = $userinfo['posts'];
// $joindate = $userinfo['joindate']; // Unformatted
$joindate = vbdate($userinfo['joindate']); // Formatted date e.g. Mon 29th Aug 

$joindate
?>
EDIT: Stupid Me! I forgot to use the print command. It works! Thanks Alot! Do you know how to get custom profile fields, though?

EDIT2: When I look at join date I get "1177448760" for my user....
Reply With Quote
  #15  
Old 08-02-2007, 08:36 PM
EnIgMa1234 EnIgMa1234 is offline
 
Join Date: Mar 2006
Location: .:: Ireland ::.
Posts: 1,306
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to add the variables to a template
Reply With Quote
  #16  
Old 08-02-2007, 08:38 PM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to use the vbdate() function to convert the timestamp into a readable format.
Reply With Quote
  #17  
Old 08-02-2007, 08:41 PM
Pc 1203 Pc 1203 is offline
 
Join Date: May 2007
Posts: 88
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, I did that and I'm still getting the same thing. Here is my code:

Code:
<?php
chdir('/home/penguink/public_html/forums');
require_once('/home/penguink/public_html/forums/global.php');

// Add the usual require stuff here
$wanted_userid = $_GET['u']; // The user id of the user you want the data from 
$userinfo = fetch_userinfo($wanted_userid);

$posts = $userinfo['posts'];
$username = $userinfo['username'];
//$joindate = $userinfo['joindate']; // Unformatted
$joindate = vbdate($userinfo['joindate']); // Formatted date e.g. Mon 29th Aug 

print "<h1>$username</h1>";
print "Posts: $posts";
print "<br />";
print "$username Joined On: $joindate";
?>
It outputs:

Pc1203

Posts: 1044
Pc1203 Joined On: 1177448760

- Pc1203
Reply With Quote
  #18  
Old 08-02-2007, 08:41 PM
EnIgMa1234 EnIgMa1234 is offline
 
Join Date: Mar 2006
Location: .:: Ireland ::.
Posts: 1,306
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is how to use vbdate.

Code:
vbdate($vbulletin->options[dateformat], $userinfo['joindate']);
Reply With Quote
  #19  
Old 08-02-2007, 08:44 PM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sample query for profile fields:
Code:
$fields = $vbulletin->db->query_first("SELECT * FROM userfield WHERE userid =".$userid);
Then you can use $fields['fieldX'] to retrieve a particular field.

Also, you should look into cleaning the variables you're using in queries - or you'll leave this page open to SQL injection.
Reply With Quote
  #20  
Old 08-02-2007, 08:45 PM
Pc 1203 Pc 1203 is offline
 
Join Date: May 2007
Posts: 88
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:03 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
  • Page Generation 0.04109 seconds
  • Memory Usage 2,246KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete