PDA

View Full Version : Some code help (Latest Posts Script)


Lt.Christy
10-30-2001, 02:15 AM
For the script of the Last Posts here
http://www.vbulletin.com/forum/showthread.php?s=&threadid=12324&perpage=15&pagenumber=1

anyone know how i might have it so instead of showing smileys by the latest post, i could show the on/off.gif depending on if its new post or not

thanks

Christy
10-30-2001, 07:30 PM
NM, I got it..thanks!

Christy
10-30-2001, 08:27 PM
Ok still need help.thought I had it

Just need the code to insert to show in my latest posts to have the icon show on or off depeneding on if its a new post from the last time it was visited

$thread[onoff] to choose the pic wethere its on or off.gif

just dont know how to make it see if its new to you.

thanks

Christy
10-31-2001, 11:53 AM
Anyone =/

MrLister
10-31-2001, 01:56 PM
? i don't quite understand what you need.....

Christy
10-31-2001, 07:21 PM
Ok, the Latest Post hack that you can put on any page, i just have mine set to show the latest subject lines. I want also to put a little image on the side that shows wether the post is new from the last ones youve read. so in this picture below

http://clanthc.virtualave.net/latestposts.gif

This would show theyve all been read, if the "v" was white it would show they were new. Im just not sure of the code to add in this script to check the last messages youve read.

Neo
10-31-2001, 07:43 PM
i see what you are saying... i just dont know where to get the piece of code.:stupid:

Neo
10-31-2001, 07:46 PM
heres that main code for it

// do light bulb
if ($bbuserinfo['lastvisitdate']=='Never') {
$forum['onoff']='on';
} else {
if ($bbuserinfo['lastvisit']<$forum['lastpost']) {
$forum['onoff']='on';
} else {
$forum['onoff']='off';
}
}

if ((!$forumperms['canpostnew'] and $showlocks) or $forum['allowposting']==0) {
$forum['onoff'].='lock';
}

// prepare template vars
if (!$showforumdescription) {
$forum['description']='';
}

Neo
10-31-2001, 07:51 PM
and where would be a piece of code that goes in the templates for it


<img src="{imagesfolder}/$forum[onoff].gif" border="0" alt="">

but as for anything eles i am not to sure

Christy
10-31-2001, 08:04 PM
Ok, this is the main part i needed




// do light bulb
if ($bbuserinfo['lastvisitdate']=='Never') {
$forum['onoff']='on';
} else {
if ($bbuserinfo['lastvisit']<$forum['lastpost']) {
$forum['onoff']='on';
} else {
$forum['onoff']='off';
}
}


Now wouldnt this be something else like thread instead of forum, since i want to see if the thread has been updated, not the forum

$forum['lastpost'])


Also shoudnt

$bbuserinfo


Have to be recognized as something

Im not a wiz at this, so thanks for going through it with me

Neo
10-31-2001, 08:58 PM
try it as it is and if it does not work just give a post and i will try and figure it out

Christy
10-31-2001, 09:14 PM
Yeah, i did do it and it just showed the black v pic(off.gif) wether theres new posts or not

Neo
10-31-2001, 10:05 PM
ok give me a little bit since it is halloween here, i think i may take a break from coding...

Christy
10-31-2001, 10:20 PM
No prob..appreciate the help

MrLister
11-01-2001, 12:48 AM
so did you get it to work? do you still need help?

Christy
11-01-2001, 01:09 AM
Still need help =/

I know its probably simple, but im not good enough with this code to know :confused:

MrLister
11-01-2001, 01:23 AM
ok i got enough time now to help you out as much as you need... ok so run by me once again what it is that you need... do you want it so that if hte post is newer then the users last visit? if yes then post the query code here and i'll edit it for you so that it shows up right..

Christy
11-01-2001, 01:32 AM
Only code I have is the Last Post script, and the code neo posted for me, not exactly sure what ya want me to post

But your exactly right on what i want, so in the pic i posted on page 1, the icon will be a white v showing theres been a new post or reply in a thread since last visit

MrLister
11-01-2001, 01:51 AM
ok yup. just post the code from the hack... the hack that you dl has a file in it.. post that

Christy
11-01-2001, 01:55 AM
edited

Neo
11-01-2001, 01:56 AM
ohh great now VB goes and changes the code on me in 2.2.0:rolleyes:

MrLister
11-01-2001, 02:02 AM
:)

MrLister
11-01-2001, 02:05 AM
i don't quite understand..... the code already does make it on or off.

if user is unregistered all are on

if user is registered and last visited 2 days ago it will light up all the ones after those 2 days and light off for all before that.

Christy
11-01-2001, 02:12 AM
Nope, it stays off even if your logged out

heres my questions from earlier

Ok, this is the main part i needed




// do light bulb
if ($bbuserinfo['lastvisitdate']=='Never') {
$forum['onoff']='on';
} else {
if ($bbuserinfo['lastvisit']<$forum['lastpost']) {
$forum['onoff']='on';
} else {
$forum['onoff']='off';
}
}


Now wouldnt this be something else like thread instead of forum, since i want to see if the thread has been updated, not the forum

$forum['lastpost'])


Also shoudnt

$bbuserinfo


Have to be recognized as something

Im not a wiz at this, so thanks for going through it with me

MrLister
11-01-2001, 02:43 AM
Now wouldnt this be something else like thread instead of forum, since i want to see if the thread has been updated, not the forum

$forum['lastpost'])

i understand what you're talking about but it's a beginner mistake. $forum is not an actual forum, it's a array (name for a query).

also
Also shoudnt

$bbuserinfo

$bbuserinfo is defined in global.php and can be used in any file. $bbuserinfo stands for your own info.. so if you put down $bbuserinfo[userid] it will show your userid or $bbuserinfo[username] is your username and $bbuserinfo[posts] is the amount of polls you have. basicaly you can do $bbuserinfo[something] anywhere and that "something" is any column from the user table.


I hope this helps you out a bit.

Christy
11-01-2001, 02:51 AM
Ok, that helps me alot, I tested it by doing


if ($bbuserinfo['username']=='Lt.Christy') {
$forum['onoff']='on';


and it worked, the images where the on.,gif

so now ain thing is, what do i use to have it check latest thread instead of


$forum['lastpost'])

MrLister
11-01-2001, 03:47 AM
go find a query that uses forums and then check your results

Christy
11-01-2001, 03:53 AM
Wouldnt this work


if ($bbuserinfo['lastvisit'] < $fd) {
$forum['onoff']='on';
} else {
$forum['onoff']='off';
}


Because of this


$fd = date($fdt,$threads[lastpost]);



it doesnt seem to work, does it not work how i have it?

MrLister
11-01-2001, 04:11 AM
i'm really sleepy... here i'll tell you what... tomorrow i'll rewrite the whole thing into a neater script using arrays and simplify it down and get it to work.

Christy
11-01-2001, 04:14 AM
Wow, really appreciate it..my bedtime too

thanks again!

Christy
11-02-2001, 10:01 PM
Hey Lister, come up with anything?

Christy
11-04-2001, 02:14 AM
Welp, I finaly did i tonight, here is end code I added


if (($threads['forumid'] == "6" || $threads['forumid'] == "9") && ($bbuserinfo['usergroupid'] <= "4")) {
echo("<img src=\"$urlimg/off.gif\">&nbsp&nbsp-Private-</nobr></td>\n");

} else {

if ($bbuserinfo['lastvisit'] < $threads['lastpost']) {
echo("<img src=\"$urlimg/on.gif\">&nbsp&nbsp<a href=\"$url/showthread.php?threadid=$threads[threadid]&goto=newpost\" style=\"color: $lc;\" title=\"$threads[title]\">$title</a></nobr></td>\n");
} else {
echo("<img src=\"$urlimg/off.gif\">&nbsp&nbsp<a href=\"$url/showthread.php?threadid=$threads[threadid]&goto=newpost\" style=\"color: $lc;\" title=\"$threads[title]\">$title</a></nobr></td>\n");
}
}