View Full Version : Simple newsportal / thread overview to add to your board...
KuraFire
05-05-2002, 10:00 PM
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! ^_^
AnkisethGallant
05-06-2002, 09:03 PM
You gotta screenshot KuraFire?
any pics? or a site in action? thanks. ;)
KuraFire
05-06-2002, 09:04 PM
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)
KuraFire
05-06-2002, 09:05 PM
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:
AnkisethGallant
05-06-2002, 09:05 PM
That actually looks pretty cool, I might just end up installing that. Nice work.
Floris
05-06-2002, 09:07 PM
Way cool, way cool, way cool. :)
KuraFire
05-06-2002, 09:15 PM
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)
Floris
05-06-2002, 09:36 PM
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 :/
KuraFire
05-06-2002, 09:44 PM
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)
zachb
05-07-2002, 02:19 AM
/me likes the hack.
Xenon
05-07-2002, 06:50 AM
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...
Floris
05-07-2002, 07:28 AM
Xenon : fnx! Would be great :)
nakkid : check the code :) I do not see many queries
KuraFire
05-07-2002, 07:57 AM
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.
Floris
05-07-2002, 08:03 AM
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 :)
KuraFire
05-07-2002, 08:07 AM
"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 :)
Floris
05-07-2002, 08:08 AM
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.
Originally posted by xiphoid
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. you cant have only 2 queries because for every thread it will do one. so if it shows 10 threads or posts, you will have 10 queries.. and so on...
KuraFire
05-07-2002, 08:41 AM
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/showthread.php?s=&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..
KuraFire
05-07-2002, 08:55 AM
Thanks, I'll have a look into it and see what I can work out. :)
:up:
KuraFire
05-07-2002, 08:59 AM
Originally posted by nakkid
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..
No, that's only the case if you run two queries per output, one to select the forum and thread, one to extract the post.
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. :)
Floris
05-07-2002, 09:23 AM
Kura does it like we wish all of those type of scripts were made. Efficient. Nice example for vBportal etc.
KuraFire
05-07-2002, 10:07 AM
Yeah I've seen a vbPortal site that had 199 queries run. :eek:
* KuraFire goes dive into adding permissions to this script, now.. :)
FlyingDutchman
05-07-2002, 10:44 AM
Originally posted by KuraFire
Yeah I've seen a vbPortal site that had 199 queries run. :eek:
we all know that VbPortal sucks :)
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 ;)
KuraFire
05-07-2002, 11:15 AM
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. :(
Xenon
05-07-2002, 04:37 PM
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:
$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
$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 :)
KuraFire
05-07-2002, 04:42 PM
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:
AndyTSJ
05-07-2002, 05:33 PM
How can I pull news from more than one forum
$newsforum = 5;
Parker Clack
05-07-2002, 05:43 PM
Kurafire:
To get the permissions issued addressed on my site I used
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
KuraFire
05-07-2002, 05:53 PM
AndyTSJ:
try replacing that line with
$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?
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 :()
AndyTSJ
05-07-2002, 05:57 PM
That works !!!!!!!!!!!!!!!!! COOL :) :)
Parker Clack
05-07-2002, 06:50 PM
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
KuraFire
05-07-2002, 07:59 PM
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/showthread.php?postid=248924#post248924
KuraFire
05-07-2002, 08:30 PM
Thanks, checking it out right away. :):up:
inetd
05-07-2002, 08:49 PM
good hack
/me installed this hack
KuraFire
05-07-2002, 08:56 PM
didn't work one bit, so far, awaiting PPN's response....
(edit: this pertaining to PPN's permissions code in the other thread)
kreftt
05-08-2002, 01:59 AM
this one is really cool
i added a few things, and now i wont need vbportal (for smaller sites) anymore :D
we shouldnt forget that vbportal has some functions that i personally wouldnt wanna code myself...
greets
kreftt
leeherron
05-08-2002, 05:01 AM
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.
kura.. if you have a chance, look at the perms included in the vbHome hack. they work, but perms = alot of queries, as firefly mention it to me earlier. PPN was kind enough to look at my hole file i wrote. i will let you know what he says about the perms, then i will post here the mods PPN did to the code, so you can insert it also in your hack.
team work. :)
here it is kura, from my file the code that works (thanks PPN):// latest threads ***************************
$doperms=$DB_site->query("SELECT canview,forumid FROM forumpermission WHERE usergroupid='$bbuserinfo[usergroupid]'");
while ($doperm = $DB_site->fetch_array($doperms)) {
$perms["$doperm[forumid]"] = $doperm;
}
$DB_site->free_result($doperms);
unset($doperm);
$forum=$DB_site->query("SELECT forumid FROM forum");
while ($forums=$DB_site->fetch_array($forum)) {
if($perms["$forums[forumid]"]["canview"] == 1 || !isset($perms["$forums[forumid]"]["canview"])) {
$forumperms[]=$forums["forumid"];
}
}
$DB_site->free_result($forum);
unset($forums);
if(!empty($forumperms)) {
$forumperms='AND forumid='.implode(' OR forumid=',$forumperms);
}
$dothreads=$DB_site->query("SELECT * FROM thread WHERE open=1 AND open<>10 $forumperms ORDER BY lastpost DESC LIMIT 10");
while ($dothread=$DB_site->fetch_array($dothreads)) {
$dots='';
if (strlen($dothread[title])>29) {
$dots='...';
}
$forumid=$dothread[forumid];
$threadid=$dothread[threadid];
$threadtitle=substr($dothread[title], 0, 32);
$lastthreadbits .= '<a href="showthread.php?s='.$session[sessionhash].'&forumid='.$forumid.'&threadid='.$threadid.'">'.$threadtitle.$dots.'</a><br>';
}
unset($dothread);i use this code in corelation with a higly modified forumdisplay.php file. it involved several mods to the tables. but the result is nice, i think:
https://vborg.vbsupport.ru/attachment.php?s=&postid=249059
try the code and let me know what you think. i will update my vbHome hack also. later on today... ;)
KuraFire
05-08-2002, 09:09 AM
I didn't use your code above nakkid, but I used PPN's new code (his former had a wrong var.name) and it works.
The first post is updated and the hack now includes permissions. Re-download if you have this installed and overwrite newsportal.php and re-set your variables, to include the permission checking (works like a charm! :D)
KuraFire
05-08-2002, 09:11 AM
Okay I just wanna say a big THANK YOU NAKKID for helping me out, sure PPN did the actual code-writing but nakkid pointed me to it and helped out nonetheless. Thanks Nakkid! :):up:
pattox2k1
05-08-2002, 10:40 AM
hey kreft on that test forum i like dat avatar............where u got it from???? or could u PLZ pm me it??????
inetd
05-08-2002, 06:44 PM
Help me!
I don't see changes in "Attachment: newsportal-hack.zip" from first post. :<
Anybody, please attach new newsportal.php. Thx!
kreftt
05-08-2002, 07:57 PM
it might help to empty your cache in internet explorer and try downloading again...
kreftt
KuraFire
05-08-2002, 09:50 PM
or you just use a Real browser and get Mozilla :D:D:D
Floris
05-09-2002, 07:54 AM
Mozilla is a real browser, but not a final version yet. (just pointing out)
About the different type of "portal" / "cms" scripts that are out now, everybody has written their own, and they have included, excluded several features. This makes it perfect for certain groups. Some do not need the bulk from vBportal and then this is just fine. Also, adding stuff that is missing is a bliss for this script. Others who do not like vBportal can pick vBhome/ vBindex and/or whatever else is out there. It all ends on support/performance/serverload and ease in use. This differs per user. I am happy enough with this one, for it won't be a part of my frontpage.
Sketch
05-10-2002, 01:13 AM
So I imagine the original file is now the completely updated and final version of this hack?
Also, can this be used on a non-vb page, such as my home page to the whole site?
Sketch
KuraFire
05-10-2002, 07:43 AM
No, it's not the final version cos this script *still* has that random bug that randomly appears, and takes not the first post out of a thread on your newsforum, but a random post. But it appears not to happen all that frequently, and some people haven't even had it (or just haven't noticed / complained about it :D).
This technically _is_ a non-vb page itself. As far as I can see, it won't work if you place it outside your vb folder (where global.php etc. are). It might, but you'll have to adjust the path, for starters. Still not sure it'll work then, you probably have to hardcode the FULL path to functions.php in your global.php first.
AndyTSJ
05-11-2002, 06:59 AM
Any fix for the bug yet. I'm using the script for news posts and instead of showing the story it is showing a reply instead.
Floris
05-11-2002, 07:59 AM
AndyTSJ -- read previous post from Kura, its explained there I think.
KuraFire
05-11-2002, 09:34 AM
Nope, I requested some MySQL-help over at vb.com but nobody has responded, and I don't know how to fix it, either :(
AndyTSJ
05-12-2002, 06:56 AM
Take a look at how it is handled in PluhNews (pluhnews.php) - that script posts the contents of the first post without posting a reply by accident.
You're right though, it doesn't happen all the time.... weird !
Darren Lewis
05-13-2002, 10:15 AM
Great work KuraFire :)
I like to be able to pull info from my vB forum database onto my webpages, but I don't want to use a portal system. I write the website in HTML, and use PHP scripts for certain areas by having "include" statements in those HTML pages (named with .php extensions rather than .html). The portals I've looked at require you to write your webpages via vB templates, which I don't want to do.
I've got your hack working on a non-vB webpage. Had to alter the templates to suit my needs (I use Tubedog's hack for the latest threads), and had to tinker a small amount with the newsportal.php script to make it work OK outside of the vB forums directory. No modifications to any of vB's own php file needed :)
I'm trying to teach myself php, and a lot of what I learn is by looking at how other people have done things, and reading these forums a lot.
If anyone's interested, and as long as KuraFire doesn't mind, I'll post the "modifications" to get it working on a non-vB page.
I've had another idea of using your script to preview the latest book review on the website homepage too. The reviews are in their own forum, so could be pulled as for a news item.
The only thing that concerns me is the "bug" that you mention. I haven't noticed it yet.
Thanks.
Darren.
Darren Lewis
05-24-2002, 12:12 PM
Originally posted by KuraFire
.... and I don't know how to fix it, either :(
Kurafire, I've sent you a PM about this. Let me know what you think :)
JTMON
05-24-2002, 02:52 PM
Originally posted by Darren Lewis
Great work KuraFire :)
I like to be able to pull info from my vB forum database onto my webpages, but I don't want to use a portal system. I write the website in HTML, and use PHP scripts for certain areas by having "include" statements in those HTML pages (named with .php extensions rather than .html). The portals I've looked at require you to write your webpages via vB templates, which I don't want to do.
I've got your hack working on a non-vB webpage. Had to alter the templates to suit my needs (I use Tubedog's hack for the latest threads), and had to tinker a small amount with the newsportal.php script to make it work OK outside of the vB forums directory. No modifications to any of vB's own php file needed :)
I'm trying to teach myself php, and a lot of what I learn is by looking at how other people have done things, and reading these forums a lot.
If anyone's interested, and as long as KuraFire doesn't mind, I'll post the "modifications" to get it working on a non-vB page.
I've had another idea of using your script to preview the latest book review on the website homepage too. The reviews are in their own forum, so could be pulled as for a news item.
The only thing that concerns me is the "bug" that you mention. I haven't noticed it yet.
Thanks.
Darren.
I understand that vbPortal is overkill for some people but you can easily write pages in html, it's built right into vbPortal.
At any rate, nice hack
KuraFire
05-24-2002, 05:00 PM
Okay, I have the bug fixed, people! :)
I will edit the first post later tonight or tomorrow, I don't have time right now but I can say this:
it requires some database work;
more importantly: if you don't want to wait X newsthreads before it'll work entirely, you will have to do some search-find-and-query work on the newsthreads you already have. But, I can safely say that once done, not a single random post will ever appear, anymore. Ever! :D
AndyTSJ
05-24-2002, 11:11 PM
Sweet :)
KuraFire
05-26-2002, 07:32 AM
It's fixed! Check the first post:
https://vborg.vbsupport.ru/showthread.php?s=&postid=248547#post248547
to see how to patch your board to remove the random bug! :):up:
Floris
05-26-2002, 08:47 AM
The first version didn't require any MySQL modification right?
So I can just upload your new file and re-add the template. Then run the query?
KuraFire
05-26-2002, 10:36 AM
Upload new file;
Template: wha? there's no template adjusting with the bug-fix...
hack newthread.php;
hack newreply.php;
upload both files
alter your database to set the existing threads' "isfirst" column to 'Y';
done.
Travis641
06-08-2002, 02:59 AM
I got it working outside the vb directory, that was easy. But how would I call it to my index.php page?
If you could include that feature it would be great!
Travis641
06-08-2002, 03:06 AM
Nevermind I was able to do it myself! :D
BigJohnson
06-08-2002, 04:19 AM
Sorry everyone . I dont no what is wrong with me today but i tried installing this and i cant get it to work. I hacked everything to what it said in the first post. I just didnt do the PHPmyadmin stuff yet. What query do i actual put in?. I tried some but i keep getting errors in my PHPmyadmin saying it doesnt no what isfirst means. What do i do?
KuraFire
06-08-2002, 09:31 AM
run this query on your database:
ALTER TABLE post ADD isfirst char(1) NOT NULL DEFAULT 'N';
and with the newthread.php and newreply.php hacks, it should work. However, it'll only work once you start making new Newsthreads, unless you edit a bunch of posts that are currently the first posts of your existing newsthreads....
chris frolic
06-11-2002, 12:19 AM
great hack, perfect for my needs! I removed the "threads" part of it, so its just a simple news updates for my main page. Thanks alot.
Ryangel
07-12-2002, 12:14 AM
hmmm I'm stumped...
So what do i need to do so that my users cant see the "Admin boards" listed on the Latest threads?
Thanks.
KuraFire
07-12-2002, 12:45 AM
The newest edition of the zip (first post attachment - clear your cache!)
has permissions support built-in, so users will only see what they're
allowed to see.
Ryangel
07-12-2002, 03:49 AM
Originally posted by KuraFire
The newest edition of the zip (first post attachment - clear your cache!)
has permissions support built-in, so users will only see what they're
allowed to see.
hmm i just downloaded it on 9 July 2002. Has it been updated?
Maybe it doesnt work because the file is not in the root directory .... I did link the path to global correctly though...
KuraFire
10-02-2002, 10:02 AM
I think you need to re-download it then...
I don't know if it'll work outside the root of the vB. I've not tested it there and so far only heard that others couldn't get it to work outside of the root, so... :/
Automated
12-24-2002, 08:10 AM
nice mod/hack/addition whatever this would be classed as!
* Automated clicks install :p
dgmayor
01-06-2003, 06:22 PM
Here's a question for ya. Is there a way to have it call the templates from a style other than the Default? Maybe by way of passing a variable in the url or something?
Reason being, is that I want to pull my news from a forum and have it display on my site, and it needs to match the site. But the thing is, it's not the "main" portion of the site.
Basically my site breaks down like this:
Index
|---Portion 1 (Guild/clan page for Game #1)
| |--Forum Category 1
|---Portion 2 (Guild/clan page for Game #2)
| |--Forum Category 2
|---Portion 3 (Guild/clan page for Game #3)
| |--Forum Category 3
|
|--Forum Home
If that makes sense. Basically each category has a different style, and thus the news will need to pull form different forums from different categories and output in different styles. Now if I have to have 3 seperate copies of newsportal.php for each mini site, then fine, but how can I have it pull from different headers? I suppose if I had 3 seperate copies of newsportal, I could hardcode 3 different template names that each contained 3 different styles, but I'm sure there can be an easier way to do this?
KuraFire
01-07-2003, 02:47 PM
you mean, you want it to _overrule_ the Style set that the User has picked?
dgmayor
01-07-2003, 05:21 PM
Well, I don't allow users to select styles on my board. Each category ties into a site with its own layout, thus each category has its own layout that blends it into the site.
www.lmalla.com and click on the Everquest logo for an example (It's the only one I have public atm). Click on forums and you'll see what I mean. When you click on forums, you're looking at a category under forumdisplay, not forumhome.
Also the news on that page is with your hack, though I have the style hardcoded in the templates atm.
KuraFire
01-07-2003, 10:28 PM
hmkay, well, it's quite easy to get a page to use a different style.
1) install freddie's User's Style in Post hack;
2) set the variable $changestyle with a styleid of choice _before_ including global.php in the file :)
you can pass the variable through the URL also...
So then you can send people from each category to see it in that cat's style. But note that each of them will still see the exact same _content_, just not in the same style :)
ForKmaN
04-13-2003, 01:44 PM
Does this work for 2.3.0?
Coz I cant find this in newthread.php:
'1')");
KuraFire
04-14-2003, 09:05 AM
Actually, you can do it without the newthread.php modification and the mysql database modification. Instead, you can use this hack WITHOUT MODIFYING ANYTHING to your site. Just open newsportal.php from the hack, and use this query at the start:
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, MIN(p.postid) as postid
FROM thread
LEFT JOIN post USING (threadid)
WHERE forumid=$newsforum
GROUP BY thread.threadid
ORDER BY thread.threadid DESC
LIMIT $newslimit
That should work fine, and you don't have to modify any files or your database anymore, with that query. :)
Robink
04-21-2003, 10:52 AM
^What you posted is another bugfix? Or it fixes the same bug? Or is it not related to the random post bug?
Or am I confused! ;)
Sharg
04-21-2003, 07:41 PM
04-14-03 at 10:05 AM KuraFire said this in Post #84 (https://vborg.vbsupport.ru/showthread.php?postid=381887#post381887)
Actually, you can do it without the newthread.php modification and the mysql database modification. Instead, you can use this hack WITHOUT MODIFYING ANYTHING to your site. Just open newsportal.php from the hack, and use this query at the start:
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, MIN(p.postid) as postid
FROM thread
LEFT JOIN post USING (threadid)
WHERE forumid=$newsforum
GROUP BY thread.threadid
ORDER BY thread.threadid DESC
LIMIT $newslimit
That should work fine, and you don't have to modify any files or your database anymore, with that query. :)
Hello, what do you mean exactly when you say to run this query at the start of the file ? Should we siply copy past this, and where ?
Thanks in advance,
Shart
Robink
04-22-2003, 07:40 AM
I think he means we replace the existing query :s
KuraFire
04-22-2003, 01:14 PM
Yeah, there's a query VERY much like that one at the start of newsportal.php, just replace it with the one you see above :)
Robink
04-22-2003, 06:51 PM
What will this new query do? Fix the bug?
KuraFire
04-22-2003, 07:05 PM
Yes.
Robink
04-24-2003, 07:09 AM
You mean the bug which is mentioned on the first page with a 3-page long solution to resolve it?
KuraFire
04-24-2003, 08:13 AM
Yes.
Robink
04-25-2003, 03:13 PM
Greatr :D :D
(PS: Add it on the first page too :))
KuraFire
04-25-2003, 03:51 PM
First post updated :)
Robink
04-25-2003, 04:10 PM
Thanks you kind Sir.
I have been postponing the release of this for days becuase the hack-removal looked scary ;)
KuraFire
04-25-2003, 04:17 PM
*grins* :)
Robink
04-25-2003, 04:45 PM
UPDATE PROCEDURE / BUG FIX:
Open newsportal.php from the attached zip-file, and use this query at the start (instead of the one that you can already find there):
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, MIN(p.postid) as postid
FROM thread
LEFT JOIN post USING (threadid)
WHERE forumid=$newsforum
GROUP BY thread.threadid
ORDER BY thread.threadid DESC
LIMIT $newslimit
First I got a DB error, saying no such table called 'p'.
I changed p to post, then it works, but the error is still there. :(
:cry: :cry: :cry: :cry:
KuraFire
04-25-2003, 04:48 PM
oh, my bad..
*fixes*
see the first post, the fix is: make it MIN(post.postid) instead of MIN(p.postid) :)
Robink
04-25-2003, 05:10 PM
Somehow, after changing that, the error remains....
Odd... *goes to kill himself*
Robink
04-25-2003, 05:12 PM
I mean the random post bug
ForKmaN
04-27-2003, 09:19 AM
just out of curiosity, this wouldnt have made my forums delete threads when i go to close them would it?
KuraFire
04-27-2003, 06:31 PM
Nope, it can't delete anything from your board.
Robink, that's .... very odd :)
Robink
04-28-2003, 09:36 AM
Darn...
Well, I used the old solution anyway...
By using isfirst='Y' and stuff.
And it works great :D
KuraFire
04-28-2003, 12:53 PM
*sighs*
mysql--
stupid, stupid mysql! :(
*goes fix newsportal.php to use entirely new approach*
ForKmaN
04-28-2003, 01:28 PM
:/
you can do it! :D
KuraFire
04-28-2003, 01:39 PM
Just did it!
^_^
</lame nike pun>
Anyhoo, see the first post, I released version 2 of the Newsportal hack, the new .php file is in the (new) attachment in the first post of this thread, you can just overwrite your online newsportal.php with that one (mind you, you'll have to check the variables at the start of the file for your personal forum id settings etc.
*sends out update*
Genocide
05-03-2003, 09:06 PM
Invalid SQL: SELECT pagetext,postid FROM post WHERE postid IN () ORDER BY postid DESC
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY postid DESC' at line 1
mysql error number: 1064
I got this message when i went to it.... so I know its somthing to do with running querys... but how and what querys?
Genocide
05-03-2003, 09:31 PM
what are the two querys every keeps saying Im must run.
I have sombody on the side ready to run them so just post
what querys I must run. Ive uploaded my newsportal to the
server and Ive added the templets in the zip file... but I havent
ran any querys because I SEE NONE. but I see people in this
thread saying they ran querys and it works great. Sombody HELP!
KuraFire
05-04-2003, 01:09 PM
Genocide, those queries are old and you no longer need to run them. So forget about all that.
You're getting an error because you've selected a Newsforum id which has no threads yet, that's why it can't find any post id's.
Robink
05-04-2003, 02:47 PM
Okay, now for some reason, on the last active threads thing, people are able to see my private forums!!
This isnt supposed to happen, right???
Robink
05-04-2003, 02:53 PM
Ofcourse, when they click on it they get a no-permission page, since the thread is in my moderator foum.
Robink
05-04-2003, 04:01 PM
Ok, sorry for the triple post, but I can give you a more detailed idea of the problem now.
I made a test account and changed its usergroup to check what happens.
I have 3 private forums, One for moderators, one for supermoderators and one for the admins.
Now, when my test account is a Registered User, in the active threads thing, he can see threads from the Mod Forum, but not from Super Mod forum or the admin Forum. When I click on the thread, it gives me the no permission screen.
When he is a moderator, he can see Mod forum titles, and read them, but cannot see threads of the supermod or Admin Forum.
When I am super mod, I can see supermod threads but not admin threads.
and when I am admin, I can see everything ....
So, now do you have any idea what the problem is?
If you want a demo go here: www.anime-fanatics.com
And there should be an active thread somewhere called "Mods please read", if you click you'll get a no perms screen.
The rest of my forums can be read by unregistered users :)
KuraFire
05-04-2003, 04:11 PM
do you use hostmasks or usergroups for making those forums private?
KuraFire
05-04-2003, 04:13 PM
err, ignore the previous post, that was made before you made your 3rd one :)
erm... I have no idea, it works fine everywhere else... and the permissions section was supplied by PPN, so.... I dunno what goes wrong there, sorry :(
Robink
05-04-2003, 04:16 PM
Ok ... :(
Thanks for the really really prompt reply !!! :D :D
OK, I realised since the problem is only with the one moderator forum being visible, can I edit the query in some way so that the mod forum with forumid = x, is visible only if usergroup id is either 5,6,7.
Or, is there any way to simply exclude teh modertor forum from the thread lists?
Thanks anyway :)
KuraFire
05-04-2003, 04:36 PM
yeah, give me the forum id of that particular forum and I'll see what I can do tomorrow from work. I can't really do much right now. Kay? :)
Robink
05-04-2003, 05:06 PM
Yeah... thanks...
the forumid is 39 ....
thanks a lot :-)
Or maybe I should make a new thread and ask other people??
Tigga
05-04-2003, 08:38 PM
Double check that your forum permissions are set correctly for those forums and that users not in your admin or mod groups don't have permission to view threads in those forums. Also be sure that "Use custom settings" at the top of the forum permissions page is checked (that seems to be a very common thing that is overlooked. ;))
KuraFire
05-05-2003, 08:08 AM
Hmm, Robink, lemme know if Tigga's tips worked or not, kay? :)
maybe a stupid comment, but I thought I had this problem too, but it was just that I hadn't refreshed my browser!!!!
Crazy Pete
05-05-2003, 04:09 PM
I'm getting this error when I try to include the news on a non-forum page. I already removed the $header and $headinclude statements from the newsthreads template, as I don't need them on the other page. When I'm already logged in and browsing the forums, everything's fine, but if I just hit the homepage (where the news in included) first, I get this error...
Warning: Cannot modify header information - headers already sent by
(output started at /home/pete/public_html/index.php:44) in
/home/pete/public_html/forums/admin/functions.php on line 1753
KuraFire
05-06-2003, 12:03 AM
this hack is a standalone, not usable as a portable hack.
If you want to include it, you'll just have to copy - paste the code for JUST THE NEWS stuff only, and hook that up into your non-forum page script.
Robink
05-06-2003, 06:28 AM
Yesterday at 04:08 AM Tigga said this in Post #118 (https://vborg.vbsupport.ru/showthread.php?postid=391421#post391421)
Double check that your forum permissions are set correctly for those forums and that users not in your admin or mod groups don't have permission to view threads in those forums. Also be sure that "Use custom settings" at the top of the forum permissions page is checked (that seems to be a very common thing that is overlooked. ;))
Its not a permissions problem, since if the user Clicks on the link It displays the No Permissions Screen. And Im certain that users cant see my private forums.
Secondly, I just tested by logging on as a Guest, and it still shows me threads from my Mod forum only on the latest threads...
So, I think changing the query of ading some condition based on usergroupid seems like the only choice.
Thanks for the help anyway, Tigga :)
KuraFire
05-06-2003, 07:26 AM
Today at 09:28 AM Robink said this in Post #123 (https://vborg.vbsupport.ru/showthread.php?postid=392097#post392097)
Its not a permissions problem, since if the user Clicks on the link It displays the No Permissions Screen. And Im certain that users cant see my private forums.
Just outta curiosity, but did you check that too?
Did you install any hack that involved your forums listing or the forum table? Or something with Host masks etc. ?
SOMETHING that might've altered your permissions structure to work differently from most boards? Cos it works for everyone else, the permission section...
Tigga
05-06-2003, 11:32 AM
Today at 03:28 AM Robink said this in Post #123 (https://vborg.vbsupport.ru/showthread.php?postid=392097#post392097)
Its not a permissions problem, since if the user Clicks on the link It displays the No Permissions Screen. And Im certain that users cant see my private forums.
You should still double check the permissions. That's a common problem people seem to have with mYvBindex, and every time it's because they don't have the permissions set properly, or they forgot to hit the "Use custom settings" button at the top. IIRC Kurafire and I use about the same method for forum permissions and it does work, but only if the permissions are set as they should be, so I'd be willing to bet that's what your problem is.
KuraFire
05-06-2003, 12:55 PM
Today at 02:32 PM Tigga said this in Post #125 (https://vborg.vbsupport.ru/showthread.php?postid=392158#post392158)
You should still double check the permissions. That's a common problem people seem to have with mYvBindex, and every time it's because they don't have the permissions set properly, or they forgot to hit the "Use custom settings" button at the top. IIRC Kurafire and I use about the same method for forum permissions and it does work, but only if the permissions are set as they should be, so I'd be willing to bet that's what your problem is.
Yeah, and it works for everyone else, and it's (I think) mostly the same section of code to check for permissions as is used in vB's own files... :/
Crazy Pete
05-06-2003, 01:38 PM
Yesterday at 09:03 PM KuraFire said this in Post #122 (https://vborg.vbsupport.ru/showthread.php?postid=391980#post391980)
this hack is a standalone, not usable as a portable hack.
If you want to include it, you'll just have to copy - paste the code for JUST THE NEWS stuff only, and hook that up into your non-forum page script.
Hmm, well I tried doing that and I got this:
Fatal error: Call to a member function on a non-object in /home/pete/public_html/testindex.php on line 117
The line in question is...
$newsql = $DB_site->query("SELECT t.threadid as tid, t.title as ttitle, t.replycount as treply, t.postusername as user, t.postuserid as userid, t.dateline as dateline, MIN(p.postid) as postid FROM thread t LEFT JOIN post p USING (threadid) WHERE forumid=$newsforum GROUP BY t.threadid ORDER BY t.threadid DESC LIMIT $newslimit");
KuraFire
05-06-2003, 03:42 PM
that means you're not using the vBulletin engine in your non-forum page.
(I think) :D
mossyuk
05-07-2003, 09:20 AM
is there no way to make it so it doesnt have to be in the /forums/ directory? I use individual team pages on my Intranet and I would like to use this script for each team but so far havent figured out how :(
Robink
05-07-2003, 09:22 AM
Yesterday at 07:02 PM Tigga said this in Post #125 (https://vborg.vbsupport.ru/showthread.php?postid=392158#post392158)
so I'd be willing to bet that's what your problem is.
You win the bet!!
The problem was that in the catagory, I set it that Registered users and guest cant see the catagory alltogether. But I hadnt set the Forum permissions. After I went and set it, the problem dissappeared! :D :D
Now the newsportal works like a charm, which I am using as my home page portal...
This is my favourite hack! Thanks KuraFire... Now my profile says that this is my fav hack too :D
KuraFire
05-07-2003, 01:24 PM
Cheers, Robink, glad you got it working :)
mossyuk -> it doesn't really have to be in your forums/ directory. Mine isn't. However, it's necessary that you adjust your vB engine/code so that it can do non-vB pages retaining vB styles.
K33nny
05-18-2003, 10:22 PM
What files would you have to edit to do that kurafire?
KuraFire
05-19-2003, 08:33 AM
I don't remember, really... at least global.php but you might also have to edit functions.php and some more files, I dunno...
noppid
05-19-2003, 05:24 PM
If I understand correctly, you're trying to run the page or code in a folder other then the forums folder. If so try the PHP chdir() fucnction in the php page to get there.
Asterik
10-21-2003, 01:15 AM
i don't know if this has been answered or not but, is there anyway to put in the person's avatar with their post? =) that would make this thing perfect!!
KuraFire
10-21-2003, 08:22 AM
Asterik: If you can wait till the vB3-version, that would help, because I don't think I'll be adding avatars to this vB2-version. the vB3 version of the Newsportal will be incredibly powerful and flexible, and also hold a lot more stuff like avatars and what not :)
Asterik
10-21-2003, 11:01 AM
yes, i can wait.... if i must ;) lol
NuclioN
10-22-2003, 02:32 PM
Is it possible to make this work?:
--text--
[ attachment ]
--text--
Because we use the attachment hack where you can put the attachment between text. :) Great hack even without avatars. Clicks install.
KuraFire
10-22-2003, 02:45 PM
Eh, you want me to support the Put Attachments Between Text hack in this?
Point me to it and I might well consider it for the vB3 Version :)
soulviv3r.php
11-07-2003, 08:41 AM
i am getting this error with it Database error in vBulletin 2.3.2:
Invalid SQL: SELECT pagetext,postid FROM post WHERE postid IN () ORDER BY postid DESC
mysql error: You have an error in your SQL syntax near ') ORDER BY postid DESC' at line 1
mysql error number: 1064
Date: Friday 07th of November 2003 05:42:42 AM
Script: http://nbk-gaming.net/lounge/lounge/newsportal.php
Referer:
KuraFire
11-07-2003, 01:50 PM
i am getting this error with it Database error in vBulletin 2.3.2:
Invalid SQL: SELECT pagetext,postid FROM post WHERE postid IN () ORDER BY postid DESC
mysql error: You have an error in your SQL syntax near ') ORDER BY postid DESC' at line 1
mysql error number: 1064
Date: Friday 07th of November 2003 05:42:42 AM
Script: http://nbk-gaming.net/lounge/lounge/newsportal.php
Referer:
Have you specified the right forumid ?
I think you're somehow getting 0 newsposts back...
Rampag33
11-08-2003, 01:59 PM
Thi is definitely the thing I've been looking for for a long time. All the other news/portal haccs add way more then I needed this is perfect thx
install.
KuraFire
11-08-2003, 04:45 PM
Thi is definitely the thing I've been looking for for a long time. All the other news/portal haccs add way more then I needed this is perfect thx
install.
You'll like my vB3 version, then :)
kuska
01-07-2004, 09:10 AM
I have the same problem as suvir3.php
Database error in vBulletin 2.3.0:
Invalid SQL: SELECT pagetext,postid FROM post WHERE postid IN () ORDER BY postid DESC
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY postid DESC' at line 1
mysql error number: 1064
Date: Wednesday 07th of January 2004 06:09:13 AM
Script: http://www.nakazdytemat.com/newsportal.php
Referer:
:( It was working fine till now. I have not made any changes to my board what so ever :( And the forim ID is correct :(
KuraFire
01-07-2004, 09:44 AM
You'll have to wait for the vB3 version of this hack, as I've stopped support for the vB2 one...
tim|evo
01-08-2004, 09:57 PM
Absolutely brilliant hack. Have ripped it apart and put it on my homepage, hope you dont mind... www.uxfest.org
Cheers.
KuraFire
01-09-2004, 08:03 AM
Not at all, thanks, glad you like it :)
jojok
01-13-2004, 12:45 AM
Database error in vBulletin 2.3.4:
Invalid SQL: SELECT pagetext,postid FROM post WHERE postid IN () ORDER BY postid DESC
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY postid DESC' at line 1
mysql error number: 1064
Date: Monday 12th of January 2004 09:53:19 PM
Script: http://www.treehillhigh.net/forum/forum/newsportal.php
Referer: http://treehillhigh.net/forum/newsportal.php
That script URL is wrong. How can I change it?
KuraFire
01-14-2004, 08:56 PM
Database error in vBulletin 2.3.4:
Invalid SQL: SELECT pagetext,postid FROM post WHERE postid IN () ORDER BY postid DESC
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY postid DESC' at line 1
mysql error number: 1064
Date: Monday 12th of January 2004 09:53:19 PM
Script: http://www.treehillhigh.net/forum/forum/newsportal.php
Referer: http://treehillhigh.net/forum/newsportal.php
That script URL is wrong. How can I change it?
Idunno, that script error is not related to my newsportal though..
jojok
01-14-2004, 09:18 PM
Yes it is.
KuraFire
01-14-2004, 09:36 PM
The error in the errormessage isn't, the fact that you get that error is probably due to a weird upgrade of the Newsportal (that or the basic install has a fault and is dependant on the earlier install, I can't say by head anymore :/)
KuraFire
01-18-2004, 10:30 AM
I had the exact same error message, my solution was simple, changed it to this.
$get = $DB_site->query("SELECT pagetext, postid FROM post"); ehm, that will get random posts from your post table! - you will not want that!
edit: I see you removed your post - realized that it wasn't doing what you wanted it to? :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.