![]() |
Simple newsportal / thread overview to add to your board...
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 :p). ^_^ That's it, you're all done. Have fun with the newsportal! ^_^ |
You gotta screenshot KuraFire?
|
any pics? or a site in action? thanks. ;)
|
And an example of how it looks with the default configuration of the templates, and my own colors etc.
(I didn't display the header here, because I'm keeping it a secret till all goes online - this page isn't available to be viewed online at the moment, really, only on my work-in-progress board so far) |
holy [better wash my mouth][better wash my mouth][better wash my car;)][better wash my mouth] you guys are fast... :p
edit: LOL @ censoring here! :lol: |
That actually looks pretty cool, I might just end up installing that. Nice work.
|
Way cool, way cool, way cool. :)
|
Note that this 'hack' does not (yet?) incorporate Permissions, so if you don't exclude your Admin/Moderator's forum (which I expect everyone has) normal users will be able to view those forum's threads' names (not able to read the threads 'mselves of course)
|
http://www.marietje.nl/vbb/newsportal.php?s=$session[sessionhash]
As you can see, works just fine! Installation was so easy, I thought I forgot something :D Great hack! Love it! Found a little bug though. Sometimes its the second post or the last one from a news thread :/ |
dude: "$session[sessionhash] " <= this is for in your TEMPLATE, not for use on forums etc. :p:p:p
Anyhoo, yeah that bug is making me go crazy, I haven't found a pattern in it at all, and on my own system it has totally disappeared (for now, anyway). I REALLY don't know what's causing that, though... :( Might be a problem with the Query, but then again, it shouldn't be malfunctioning (it worked for me in the past, in a different page setup) |
/me likes the hack.
|
this hack looks good.
funnyly i have written such a thing for myself two days ago :) now im in the university, so i cannot download your hack, but when i'm at home, i will, and try to find the bug, because my hack doesn't have this bug, so i'd compare and perhaps find the bug |
i wonder how many queries are pulled with this hack?
i didnt downloaded the hack yet.. let me know kura... |
Xenon : fnx! Would be great :)
nakkid : check the code :) I do not see many queries |
2 queries only :)
and xenon: thanks, that'd be great. :) (I'm really baffled by the random appearance of this bug) |
no, i reffer to the full page. do an explain=1 please and let me know if it goes higher then 40.
|
Due to security and a bug in 2.2.5, that has been unset. Sorry, I can not test it. I stick with 2 queries :)
|
"Page generated in 0.8501260 seconds (17.14% PHP / 82.86% MySQL) with 14 queries "
(seems that coincidentally, the percentages check out this time, lol!) Note that if you don't run extra queries in your Header (like me) this number will be even lower :) |
looks good then :)
|
I just put back the db_mysql.php for testing this, and only 4 queries could be related to the hack, the rest is obviously through global and default vB. I removed the hack and let the page load, and had 10 instead of 12. So I stick to only 2 queries. maybe a few more for replacements and/or smilies etc.
|
i looked at your code kura.. the way is set now will also show to everyone the posts made in a private forum (if you have a private forum). you need to add some perms in there... just a thought.
|
Quote:
|
That's nonsense.
It takes 1 query to extract the firstposts of X amount of different threads on the newsforum you specify, and 1 query to extract all the threads-overview info. You can increase the amount of newsposts listed, but it won't affect the query count. Nakkid, if you read post #8 in this thread, you'll see that I already commented on that. :) (I'm not capable of adding permissions myself yet, still too much of a n00b for that, but I'm working on it :)) |
try this for perms:
https://vborg.vbsupport.ru/showthrea...threadid=38355 i didnt test it, i just put it togheter... let me know if it can help you out. :) about the queries.. if i'm correct, for every thread,forum that is checked the script will perform a query. the more forums you have the more queries you will add, etc. goes the same way with the threads. i know element that have an impressive 108 queries on his page. over 40queries your server gets on its knees if it's a busy board.. |
Thanks, I'll have a look into it and see what I can work out. :)
:up: |
Quote:
However, my query (in the newsportal.php file) uses a JOIN so that it can extract as many firstposts from a single (or multiple, if you want) forum, with only 1 single query. The JOIN worked perfectly fine in phpMyAdmin, but it seems to have a random bug when put in use through vB itself. It's still just 1 query though, trust me. :) |
ok. thanks for the info. :)
|
Kura does it like we wish all of those type of scripts were made. Efficient. Nice example for vBportal etc.
|
Yeah I've seen a vbPortal site that had 199 queries run. :eek:
[high]* KuraFire goes dive into adding permissions to this script, now.. :)[/high] |
Quote:
I think your script is pretty nice man ;) I like VbIndex a bit more (when you edit it well :D) because of it's menu... oh, well, yours is cool too, if you don't have a high-end server ;) |
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. :( |
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:
PHP Code:
try it and say it to me if it works or not. If not, i will check it a more :) |
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: |
How can I pull news from more than one forum
Code:
$newsforum = 5; |
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']) { Parker |
AndyTSJ:
try replacing that line with PHP Code:
Parker: have you tried that out as a normal registered member? come to think of it, would this piece of code work? PHP Code:
(I'm off for some things so I can't test it myself right now :() |
That works !!!!!!!!!!!!!!!!! COOL :) :)
|
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 |
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. :) |
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 |
All times are GMT. The time now is 06:41 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|