PDA

View Full Version : help needed with "new this week" hack


TECK
02-06-2002, 08:23 AM
i want to understand why this code does not pull the information as demanded:

copyrighted code (for now)i went with the logic. this code should grab the title and content from forum 1 and display only the last 3 threads. for some reasons, it will show ony the latest thread, not the 3 of them. can you tell me why? do i have to connect to the database with a mysql_connect and mysql_select_db?

the idea is to make a "what's new this week" side area where the script can pull the info from an invisible forum. i want to use also a comment script that will let anonymous users post what they think about the event. any help is appreciated. ty for taking the time to read this post.

Admin
02-06-2002, 08:30 AM
Change this:
$getnewsql=$DB_site->query("SELECT * FROM post WHERE threadid='$newthreadid' ORDER BY postid ASC LIMIT 1");
while ($getnew=$DB_site->fetch_array($getnewsql)) {
$newpagetext=$getnew[pagetext];
$newpagetext=bbcodeparse($newpagetext);
eval("\$newthisweek = \"".gettemplate('home_newthisweek')."\";");
}
to:
$getnewsql=$DB_site->query_first("SELECT * FROM post WHERE threadid='$newthreadid' ORDER BY postid ASC LIMIT 1");
$newpagetext=$getnew[pagetext];
$newpagetext=bbcodeparse($newpagetext);
eval("\$newthisweek .= \"".gettemplate('home_newthisweek')."\";");

TECK
02-06-2002, 08:40 AM
ty firefly.. but if i do this it will not show anymore the content of the thread.. :?:

i think you know where i'm heading..... :supwink:

Admin
02-06-2002, 09:59 AM
$getnew=$DB_site->query_first("SELECT * FROM post WHERE threadid='$newthreadid' ORDER BY postid ASC LIMIT 1");
$newpagetext=$getnew[pagetext];
$newpagetext=bbcodeparse($newpagetext);
eval("\$newthisweek .= \"".gettemplate('home_newthisweek')."\";");

TECK
02-06-2002, 11:11 PM
sorry Chen.. yesterday i was really tired. i did not see the query_first and "." change.

i tried this code:$getnewsql=$DB_site->query_first("SELECT * FROM post WHERE threadid='$newthreadid' ORDER BY postid ASC LIMIT 1");
$newtime=vbdate($timeformat,$new[dateline]);
$newdate=vbdate($dateformat,$new[dateline]);
$newpagetext=$new[pagetext];
$newpagetext=bbcodeparse($newpagetext);it's working great. once again you help people. how do you get the time to do all this? :D

i decided to remove the code for now. due to copy and paste reasons :). with this script basically you will have the same news frontpage as vbulletin.org with a little twist, right Chen? :). i will work now on the comments code and also maybe in a category module.. if Firefly is willing to help me a little.. :D

i will see if Firefly accepts for me to release the code here to everyone... but since he never decided to publish his, i will respect his way of administrating this forum. also, i know that i'm not a good PHPer as many code writers here, but i love the challange.. so far PPN and Firefly were very helpfull and pointed me into the right direction with the code. i can only say one word: thanks.

Admin
02-07-2002, 11:40 AM
Thanks. :)

I don't mind if you release the script, there are already several like this in the hacks forum. And besides, mine doesn't even work that way... ;)

TECK
02-08-2002, 01:45 AM
ok firefly ;). is it ok when i finish the code to email it to you? so you can take a look at it? i'm sure you will find some bugs. the credit will be also into it. (verified and aproved by Firefly) something like that....

i almost finished the comments.php code. i will not use any permissions on this script, so anonymous as well as registered users can post comments. the only difference will be that the anonymous user will have the IP published instead of hidden and will not be allowed to use VB code and smilies.

the comment box will be on the same page where the main news content and other's comments will be displayed. i will keep you all updated here with the progress of this project. i think alot of people will like it.

Admin
02-08-2002, 05:50 PM
You can e-mail me with it if you want, but it could take me a bit to reply. Just letting you know. :)

TECK
02-08-2002, 10:31 PM
no prob chen. don't worry about it, i'm in no rush. as long as you can spare a little of your precious time, it's great for me. also, if there are any other hackers who are willing to help me to finalise this hack (i think is a nice idea all the options that i plan to implement), please post your answer in this thread. thanks.

TECK
02-11-2002, 12:04 AM
ok firefly... i'm confused with the code present in root/forum/admin/forum.php: if ($perms[canview]==1) {
$oldprivate=0;
} else {
$oldprivate=1;
}it referrs to the private forum, that you can set from admin panel.
how would i add a private news forum only for group 6 and 7 (journalists)?

TECK
02-11-2002, 06:39 AM
FireFly... sorry. i had to post the code here, just to make sure you will get it righaway. can you get the file and after delete it from the database? or delete the post? i know about the vBulletin copyright issue.

one more time i apologise for this. :noid:
there is alot of information in the file and if i wanted to email it through the BB, i wasnt sure you will get all of it.

my email address (nakkidone@hotmail.com)

SaintDog
02-11-2002, 04:44 PM
I would be willing to help you out as far as testing the hack out once you are ready to do so. I wish I could help you fix any bugs, but I am still in the learning area with PHP & MySQL so I don't think I would be able to help out there.

But if you need testers, count me in, I will be happy to report back to you on anything I see that is not working so you can get this hacking working good.