Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 03-02-2010, 01:40 AM
cmiller1014 cmiller1014 is offline
 
Join Date: May 2004
Posts: 248
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need a real simple custom page, can you help?

We ran a promotion where the first 500 members, IF they had at least 5 posts each would be entered in a drawing. I am sure this is super simple, but I know nothing about it. How can I make a custom page, showing a list of users who are member 1-500, and have at least 5 posts?

Thanks in advance!!!!
Reply With Quote
  #2  
Old 03-02-2010, 02:11 AM
TimberFloorAu's Avatar
TimberFloorAu TimberFloorAu is offline
 
Join Date: May 2008
Location: Brisbane
Posts: 2,264
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the simple stuff is often the most complex
Reply With Quote
  #3  
Old 03-02-2010, 04:11 AM
cmiller1014 cmiller1014 is offline
 
Join Date: May 2004
Posts: 248
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's not complex at all... i've talked to several people about it. lol
Reply With Quote
  #4  
Old 03-02-2010, 11:06 PM
fdifranco fdifranco is offline
 
Join Date: Feb 2010
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure exactly what you are trying to do but here's my take on your problem.

If you just want to show a sorted list of the users that have more than 5 posts then log into your admin control panel, create a new widget of type 'PHP Direct Execution' and insert the following code:

$host = '<your host here>';
$user = '<your database userid here>';
$pass = '<your database password here';
$database = '<your database name here>';

$linkID = mysql_connect($host, $user, $pass) or die('Could not connect to host.');
mysql_select_db($database, $linkID) or die('Could not find database.');

$query = "select username, posts from user where posts>5 order by posts desc limit 0,10";
$resultID = mysql_query($query, $linkID) or die('Data not found.');

$output .= '<p>These users will be entered into the draw!</p>';
$output .= '<table>';

for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);

$szUsername = $row['username'];
$szPosts = $row['posts'];

$output .= "<tr>";
$output .= "<td>$szUsername</td>";
$output .= "<td>$szPosts</td>";
$output .= "</tr>";
}

$output .= '</table>';

After that just add the widget to whatever page you would like.

I'm not saying the code is bullet-proof but it should give you a start. In this example I am only returning the top 10. You can play around with the table to show all 500 if you prefer.

If I was going to code it up myself then I might either create a new table (or add a column to the user table if that's allowed) holding the baseline of everyone's post-count at the time you start the contest. Then if you wanted to see who has 5 new posts then you would simply subtract their baseline post count from their current post count.

Hope it helps... now if anyone wants to help me with my problem then it would be very much appreciated!

-fab
Reply With Quote
Reply

Thread Tools
Display Modes

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 11:52 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07988 seconds
  • Memory Usage 2,183KB
  • Queries Executed 13 (?)
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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete