Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-17-2008, 08:01 AM
soundboy's Avatar
soundboy soundboy is offline
 
Join Date: Jul 2008
Location: Australia
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Show custom profile field on page.

Ok..

It was possible in phpbb3.. and im not sure in vbulletin.. but i want to display 10 random entries from a custom profile field..

My members enter a url into a custom profile field and i want to dispaly 10 random entries from different users on my forum index..

If this is possible
Thanks in advance
Reply With Quote
  #2  
Old 07-17-2008, 11:53 AM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could use a mysql statement like this...(I think)

Code:
"select fieldNUMBER from ".TABLE_PREFIX."userfield order by rand() limit 10"
Change NUMBER to the actual field number.
Reply With Quote
  #3  
Old 07-17-2008, 12:37 PM
psylenced psylenced is offline
 
Join Date: May 2008
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You wouldnt want to run that query per post. Each page load would hit the db 10-20 times per page per user.
Reply With Quote
  #4  
Old 07-17-2008, 01:04 PM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What does that have to do with the question? He wants to show it once on his forumhome not per post.
Reply With Quote
  #5  
Old 07-18-2008, 03:00 AM
soundboy's Avatar
soundboy soundboy is offline
 
Join Date: Jul 2008
Location: Australia
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RLShare View Post
You could use a mysql statement like this...(I think)

Code:
"select fieldNUMBER from ".TABLE_PREFIX."userfield order by rand() limit 10"
Change NUMBER to the actual field number.
thanks, how would i implement this? Sorry, im only new to vbulletin (im a phpbb coder but wanting to code vb)
Reply With Quote
  #6  
Old 07-18-2008, 03:28 AM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would use the vb database manager to run the query and gather the info like so....


PHP Code:
$fields=$vbulletin->db->query_read("select fieldNumber from ".TABLE_PREFIX."userfield order by rand() limit 10"); 
Then loop through the data and structure it however you want using the $vbulletin->db->fetch_array() function...
ex....
PHP Code:
while($field $vbulletin->db->fetch_array($fields)){
///Process data...


You would want to put this in a plugin that hooks the proper location, more then likely the forumhome_start hook location since you want to display it on the forumhome template... Usually format and place all the data into a variable and then edit the template of which your plugin is hooking and add that variable. VB also has Template hooks where you can add data to pre-defined variables that will get displayed in the templates without ever editing a template.
Reply With Quote
  #7  
Old 07-18-2008, 03:33 AM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is a sample plugin that draws in a profile field and places it in a table so you can get an idea of how to do it...Edit the plugin and change the field6 in the query to the one that corresponds to your forum before you import the plugin.

You would then need to edit your forumHome template and find $navbar then place $pb_fields right under it.
Attached Files
File Type: xml vbulletin-plugins.xml (795 Bytes, 10 views)
Reply With Quote
  #8  
Old 07-18-2008, 03:35 AM
soundboy's Avatar
soundboy soundboy is offline
 
Join Date: Jul 2008
Location: Australia
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i still dont understand..

so do i put the info in my file (index.php) ?
i need further steps, sorry

EDIT: i will try that plugin you made thanks

--------------- Added [DATE]1216356491[/DATE] at [TIME]1216356491[/TIME] ---------------

ok.. i edited the plugin and ran it..
also edited my template..
and im getting no result showing up?
Reply With Quote
  #9  
Old 07-18-2008, 03:58 AM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

All that means is there is an extra '<' somewhere in the code that there should not be. Its not in the plugin unless you edited the html in the plugin.
Reply With Quote
  #10  
Old 07-18-2008, 04:01 AM
soundboy's Avatar
soundboy soundboy is offline
 
Join Date: Jul 2008
Location: Australia
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok! i got it but.. its on the forum homepage..
I am running vbdrupal, how would i be able to get it on that page?

also its displaying empty tables.. how can i make it so it doesnt show null fields? or empty fields?
Many thanks mate
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 04:19 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
  • Page Generation 0.05754 seconds
  • Memory Usage 2,282KB
  • Queries Executed 14 (?)
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
  • (2)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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
  • (1)postbit_attachment
  • (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_postinfo_query
  • fetch_postinfo
  • 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
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete