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

Reply
 
Thread Tools Display Modes
  #1  
Old 06-29-2006, 08:14 AM
rin rin is offline
 
Join Date: Aug 2004
Location: Mainland of China
Posts: 109
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Query Database to see if new Posts have been made (Forumhome)

Hello,

I am working on a new Theme for my forums and I am using static HTML for my index!
That said, I can not use the regular lightbulb function of vBulletin.
To see what my page looks like, please go here:

http://www.kawaiination.com/uplo

You can see what I would like to have if you browse to the BLUE category, the Offtopic forum.
Something like "New Posts in Off Topic / Chit Chat (Post funny and ...)"

Can someone help me how I can handle this? I found the function dealing with the regular lightbulbs in /includes/functions_forumlist.php
But I don't know how I can do so I can use it in my HTML Page.

Thanks for any help.

Currently using vBulletin 3.0.X But planning to upgrade at a given time.
Reply With Quote
  #2  
Old 06-29-2006, 04:44 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perhaps take a look at how this mod does it and adapt as required.

https://vborg.vbsupport.ru/showthread.php?t=75320
Reply With Quote
  #3  
Old 06-29-2006, 05:31 PM
rin rin is offline
 
Join Date: Aug 2004
Location: Mainland of China
Posts: 109
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello,

thanks for the hint. I read through the TXT and think you mean this one, right?
Code:
$postcount = $DB_site->query_first("SELECT COUNT(dateline) as pcount FROM ".TABLE_PREFIX."post WHERE dateline > ".$bbuserinfo['lastvisit']." ");
Basically, what I would do is:
Get the last post from the forum and check if it is newer or older than the last visit of the user?

If this is the way it works, would this in any kind be inferior to the way an unhacked vBulletin handles the lightbulbs?

I have tried to use your hack on a 3.5.4 forum. It does not work. It won't show anything in the templates.
I would assume, the if() is not working at all. Is there something I am not aware of?

Code:
unset($pcount, $rcount);
if ($bbuserinfo['userid'])
{
	$pcount = "No New Posts since your last visit.";
	$postcount = $DB_site->query_first("SELECT COUNT(dateline) as pcount FROM ".TABLE_PREFIX."post WHERE dateline > ".$bbuserinfo['lastvisit']." ");
	if ($postcount['pcount'])
	{
		if ($postcount['pcount'] == 1)
		{
			$pcount = "<a href='search.php?do=getnew'><b>1 New Post</b></a> since your last visit.";
		}
		else
		{
			$pcount = "<a href='search.php?do=getnew'><b>".$postcount['pcount']." New Posts</b></a> since your last visit.";
		}

}
Reply With Quote
  #4  
Old 06-30-2006, 07:25 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

basically you're looking for
PHP Code:
$data $db->query_first("SELECT postid, MAX(dateline) FROM post WHERE dateline > " $vbulletin->userinfo['lastvisit'] . "");

$newposts = (isset($data['postid'])) ? 'There are new posts since your last visit, why not check \'em out' FALSE
Reply With Quote
  #5  
Old 06-30-2006, 08:01 AM
rin rin is offline
 
Join Date: Aug 2004
Location: Mainland of China
Posts: 109
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks!
How can I check each forum? For example forum ids starting with 1 going till 20.
My target would be something like an array where I can ask the forum:
Code:
$newposts['$forumid']
Because I need to check if there are new posts in the forum manually for each forum.
Reply With Quote
  #6  
Old 06-30-2006, 09:36 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you'd change the query
PHP Code:
$data $db->query_first("SELECT postid, MAX(dateline) FROM post WHERE dateline > " $vbulletin->userinfo['lastvisit'] . " AND forumid = $forumid"); 
Please not, these are example queries, i'm not totally sure they'll work, though they should and there could be a cheaper way to do it, these are just off the top of my head.
Reply With Quote
  #7  
Old 07-02-2006, 12:24 PM
rin rin is offline
 
Join Date: Aug 2004
Location: Mainland of China
Posts: 109
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks a lot! I will try the last one tonight and give feedback as soon as possible.
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:03 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.04093 seconds
  • Memory Usage 2,226KB
  • 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
  • (3)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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