Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Simple newsportal / thread overview to add to your board... Details »»
Simple newsportal / thread overview to add to your board...
Version: 1.00, by KuraFire KuraFire is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 05-05-2002 Last Update: Never Installs: 54
 
No support by the author.

Okay, this isn't really a hack, since you don't have to modify any vb-files really, but I figured this was the best place to make it public anyhow. I found it rather useful myself, so I figured others might, too.

Last update: April 28th, 2003!
** Update summary: **
The bug that could occur due to MySQL stupidity has been fixed. Version 2 of the Newsportal script is now attached in this post, you can simply overwrite the newsportal.php on your site with the one from the attached zipfile to upgrade.
From now on, no more vB files need to be adjusted nor do you have to make any database changes. If you've already done all that due to the mysql-bug in a previous stage of this hack, you can just leave it like that, it won't do any harm. If you're intent on 'cleaning' your files again, let me know if you can't get it done yourself.


Q&A:
What does this 'hack' do?

http://www.kurafire.com/newsportal.php

That's a live example of the fully functional version of the Hack (version 2). I think it speaks for itself.

The amount of newsposts & threads on the right is set in a variable at the beginning.


Is this hack hard to install?
Absolutely not. You upload the newsportal.php, you add the new templates (see zipfile), and you place a link to newsportal.php wherever you want it on your site. That's it.
You don't have to modify any vB files, nor your database.


Does this hack include my style and everything?
Yes, the newsportal page will use your headinclude, header, footer and style-colors (pagebgcolor, tableouterwidth, linkcolor, etc.) and all these settings are easily configureable. You just edit the templates like you're (hopefully) used to with all the normal vB Templates.


Version 2:
The newsportal script now uses 2 queries to get the necessary information for your News posts. One for all thread info and the postid's of the starting posts, and one for the pagetext (ie. post contents) of all those postid's. You can use 2, 20 or 200 newsposts, that won't matter, it'll always be 2 queries (though I discourage using more than 20 newsposts ). ^_^

That's it, you're all done. Have fun with the newsportal! ^_^

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 05-07-2002, 11:15 AM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I made this script basically just for my own needs, but figured others might appreciate it as well.

Man, this permissions thing is giving me a headache. Nakkid, I can't say exactly why that part of code of yours is adding 1 query for every thread, but it does suck and it's hell trying to get around it.
Reply With Quote
  #33  
Old 05-07-2002, 04:37 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well i'm not sure, why there is sometimes an error and sometimes not

i think you can solve this problem, with making an extra query for each message news, i have made it so an it works:

PHP Code:
$newsql $DB_site->query("SELECT thread.threadid as tid, thread.title as ttitle, thread.replycount as treply, thread.postusername as user, thread.postuserid as userid, thread.dateline as dateline FROM thread WHERE forumid=$newsforum GROUP BY thread.threadid ORDER BY thread.threadid DESC LIMIT $newslimit");
if (!
$newsql) {
  
// use this only to check whether it works on your board, 
  // after all tests turn successful you can remove it if you want (remove entire IF-statement of course)
  
echo "<p>Could not get news records.";
  exit;
}

while (
$news=$DB_site->fetch_array($newsql)) {
    
$newstext=$DB_site->query_first("SELECT post.pagetext FROM post    WHERE post.threadid='$news[tid]' ORDER BY postid LIMIT 1");
    
$pagetext=$newstext['pagetext']; 
instead of

PHP Code:
$newsql $DB_site->query("SELECT thread.threadid as tid, thread.title as ttitle, thread.replycount as treply, thread.postusername as user, thread.postuserid as userid, thread.dateline as dateline, post.pagetext as pagetext FROM thread LEFT JOIN post USING (threadid) WHERE forumid=$newsforum GROUP BY thread.threadid ORDER BY thread.threadid DESC LIMIT $newslimit");

if (!
$newsql) {
  
// use this only to check whether it works on your board, 
  // after all tests turn successful you can remove it if you want (remove entire IF-statement of course)
  
echo "<p>Could not get news records.";
  exit;
}

while (
$news=$DB_site->fetch_array($newsql)) { 
i think it should work, but i dont tested it, just compared with my files

try it and say it to me if it works or not. If not, i will check it a more
Reply With Quote
  #34  
Old 05-07-2002, 04:42 PM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That should work fine, from what I see, but it adds a query for each news item, and I'm trying to get rid of that since I _know_ this can be done using only 2 queries.

With your code, the default setup would add 8 queries to the 10~12 that global.php runs already. Seems to me as not very efficient.

Besides, that's how my _old_ script was run. One query for the newsforum, and one for each news item..... I was hoping to _advance_

Thanks though. Well-appreciated :up:
Reply With Quote
  #35  
Old 05-07-2002, 05:33 PM
AndyTSJ AndyTSJ is offline
 
Join Date: Feb 2002
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How can I pull news from more than one forum

Code:
$newsforum = 5;
Reply With Quote
  #36  
Old 05-07-2002, 05:43 PM
Parker Clack Parker Clack is offline
 
Join Date: Oct 2001
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Kurafire:

To get the permissions issued addressed on my site I used

Code:
if (ismoderator($forumid) or $getperms['canopenclose'] or $getperms['candeletethread'] or $getperms['canmove']) {
$threadsql = $DB_site->query("SELECT lastposter, threadid, title, replycount FROM thread WHERE forumid ORDER BY lastpost DESC LIMIT $threadslimit");
} else {
$threadsql = $DB_site->query("SELECT lastposter, threadid, title, replycount FROM thread WHERE forumid $forumexclude ORDER BY lastpost DESC LIMIT $threadslimit"); 
}
in the threads section just above the array.

Parker
Reply With Quote
  #37  
Old 05-07-2002, 05:53 PM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

AndyTSJ:

try replacing that line with

PHP Code:
$newsforum "5 OR forumid=6"
where 5 and 6 are the id's of the two newsforums. I'm not sure if this really works, but it's worth a try. Let us know if it works, eh? :up:

Parker: have you tried that out as a normal registered member?

come to think of it, would this piece of code work?

PHP Code:
if ( $getperms['canview']) {
 
$threadsql DB_site->query("SELECT lastposter, threadid, title, replycount FROM thread WHERE forumid ORDER BY lastpost DESC LIMIT $threadslimit");
} else {
$threadsql $DB_site->query("SELECT lastposter, threadid, title, replycount FROM thread WHERE forumid $forumexclude ORDER BY lastpost DESC LIMIT $threadslimit"); 

? I'll test this later on, but if someone else wants to test this right away, be my guest and let us know

(I'm off for some things so I can't test it myself right now )
Reply With Quote
  #38  
Old 05-07-2002, 05:57 PM
AndyTSJ AndyTSJ is offline
 
Join Date: Feb 2002
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That works !!!!!!!!!!!!!!!!! COOL
Reply With Quote
  #39  
Old 05-07-2002, 06:50 PM
Parker Clack Parker Clack is offline
 
Join Date: Oct 2001
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Kurafire:

I tried the $getperms['canview'] before I tried what I suggested above and that didn't work.

The code that I suggested works on my board just fine and it will only allow those admins, etc. that are allowed to view a private forum see the thread listed. If you are a regular member you will not see the ones that you set up in $forumexclude.

Parker
Reply With Quote
  #40  
Old 05-07-2002, 07:59 PM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Parker: ah yes, I saw that already but the thing is, I'm one of those people who have more than the default usergroups. I have 1 category with 4 forums in it that is only accessible to users in a certain usergroup, and 1 forum elsewhere that is only accessible to users in yet Another special usergroup.
Using your code wouldn't help at all for my board, nor for people who have something similar.

However, it DOES indeed work on boards where there's only admins, S-mods and normal members, I guess. Thanks for that addition, therefore, because it will at least allow people with such board-setups to include permissions in this script already.
Reply With Quote
  #41  
Old 05-07-2002, 08:24 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

kura, PPN rewrote the perms code i had there in a much more elegant way. take a look and insert it also in your script:
https://vborg.vbsupport.ru/showthrea...924#post248924
Reply With Quote
  #42  
Old 05-07-2002, 08:30 PM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, checking it out right away. :up:
Reply With Quote
  #43  
Old 05-07-2002, 08:49 PM
inetd inetd is offline
 
Join Date: Nov 2001
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

good hack
/me installed this hack
Reply With Quote
  #44  
Old 05-07-2002, 08:56 PM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

didn't work one bit, so far, awaiting PPN's response....

(edit: this pertaining to PPN's permissions code in the other thread)
Reply With Quote
  #45  
Old 05-08-2002, 01:59 AM
kreftt's Avatar
kreftt kreftt is offline
 
Join Date: Dec 2001
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this one is really cool

i added a few things, and now i wont need vbportal (for smaller sites) anymore
we shouldnt forget that vbportal has some functions that i personally wouldnt wanna code myself...

greets

kreftt
Reply With Quote
  #46  
Old 05-08-2002, 05:01 AM
leeherron leeherron is offline
 
Join Date: Dec 2001
Location: Pensacola, FL
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I worked on a project like this a while back, never polished up enough to release. The twist I took was I had it run when someone submitted post; it created an HTML that could be served many times with no queries. The theory: thread reads = a lot, posts submissions = not as many.
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 05:56 AM.


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.08612 seconds
  • Memory Usage 2,379KB
  • Queries Executed 30 (?)
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
  • (2)bbcode_code
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (16)post_thanks_box
  • (16)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (16)post_thanks_postbit_info
  • (15)postbit
  • (16)postbit_onlinestatus
  • (16)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