PDA

View Full Version : [AJAX] Mark Forum As Read Using New Post Icon


Nutz
11-17-2005, 10:00 PM
[AJAX] Mark Forum As Read Using New Post Icon

Description
This plug-in will allow you and your users to mark forums as read from forumhome and forumdisplay using the new post icons (see screenshot animation).


Details

1 Product
1 Phrase
2 Template Modifications


Notes
Requires 2 small template modification to forumhome_forumbit_level2_post and forumhome_forumbit_level1_post.
Big thanks to hambil (https://vborg.vbsupport.ru/member.php?u=57845) for the initial AJAX version :D

History
1.0
Initial Version

1.1
Initial AJAX Version

1.2
Refined AJAX Version

Last Words
I hope you enjoy the hack!
And don't forget to click install please :)

https://vborg.vbsupport.ru/
(https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=101101)
Thanks,
Mat

nexialys
11-18-2005, 06:08 PM
yeah, this was planned to be added to 3.5, but as people was not very happy with the result, that was trashed...

i like the idea...

Nutz
11-19-2005, 11:39 AM
I never knew that.

Thanks,
Mat

Snake
03-15-2006, 06:26 PM
It's an IPB feature as well so yeah, thanks!

BamaStangGuy
03-15-2006, 07:11 PM
You should rel="nofollow" the link to mark them

Nutz
04-17-2006, 03:36 PM
Now with AJAX, see first post for details :)

Thanks,
Mat

Apophis
04-17-2006, 03:59 PM
I installed this TODAY and then an hour later out pops the AJAX version!

I did the upgrade and everything worked flawlessly, thanks for the great plugin!

Makaveli105
04-17-2006, 07:35 PM
Installed :) great work..

any chances of making it so after you click the icon it doesnt take you to the top of the page?

hambil
04-17-2006, 07:58 PM
Installed :) great work..

any chances of making it so after you click the icon it doesnt take you to the top of the page?
I do not believe that the anchor around the img tag in the template is needed. Try removing it.

Instructions in readme:
## FIND ##

<img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="" border="0" />

##########

## REPLACE WITH ##

<if condition="$forum[statusicon] == 'new' ">
<a href="#">
<img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="$vbphrase[mark_this_forum_read_home]" title="$vbphrase[mark_this_forum_read_home]" onclick="ajaxMarkForumRead($forum[forumid])" id="mfarfh_$forum[forumid]" border="0" title=""/>
</a>
<else />
<img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="" border="0" />
</if>

###################

New instructions:
## FIND ##

<img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="" border="0" />

##########

## REPLACE WITH ##

<if condition="$forum[statusicon] == 'new' ">
<img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="$vbphrase[mark_this_forum_read_home]" title="$vbphrase[mark_this_forum_read_home]" onclick="ajaxMarkForumRead($forum[forumid])" id="mfarfh_$forum[forumid]" border="0" title=""/>
<else />
<img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="" border="0" />
</if>

###################

Let me know if that helps!

Nutz
04-17-2006, 08:01 PM
I do not believe that the anchor around the img tag in the template is needed.

Its not, I added it so that user knew that the image was also a link via the cursor.

Thanks,
Mat

Tralala
04-17-2006, 08:38 PM
Nice idea, but it seems altogether too easy to mark a forum as read when you didn't intend to do that. I know it's not as sexy as immediate AJAXy goodness, but it sure would eliminate some complaints when users inadvertently click that and see all of their unread markers lost! Maybe an interstitial warning/confirmation dialogue would make sense here.

hambil
04-17-2006, 08:41 PM
Interesting idea.

Tralala
04-17-2006, 08:47 PM
Sorry, I didn't mean any offense, and completely appreciate the hard work put in here. I was just making a suggestion for the coder, as well as pointing out a different use for that button, I suppose in the hopes of satisfying everyone's concerns.

I have edited my post accordingly.

hambil
04-17-2006, 08:49 PM
No hard feelings, thanks for the edit.

Makaveli105
04-17-2006, 09:13 PM
Thanks Hambil :D and i like the idea about the warning / confirmation. :)

Nutz
04-17-2006, 09:55 PM
How about on double click? :)

Thanks,
Mat

Makaveli105
04-18-2006, 02:24 AM
that'd be nice, making it on double click

Snake
04-18-2006, 06:16 PM
Thanks for the update!

akanevsky
04-18-2006, 10:16 PM
Very nice.

hotwheels
04-19-2006, 09:13 PM
great mod........I really enjoy seeing the ajax mod's.

Snake
04-22-2006, 12:42 PM
It's not working for me. :S

www.bonethugsforums.com

BamaStangGuy
04-26-2006, 01:09 AM
Just curious but would it be possible to do this within showthread so that you can mark individual threads as read?

Ziki
05-20-2006, 07:42 AM
Doesn't work in FF

Snake
05-20-2006, 09:43 AM
Yep same here.

.Tim
05-20-2006, 03:49 PM
Just curious but would it be possible to do this within showthread so that you can mark individual threads as read?

That would be very nice!


Doesn't work in FF

Yep. :(

Snake
05-20-2006, 05:37 PM
Please fix!

LordJMann
05-20-2006, 11:49 PM
Works fine in Firefox 1.5.0.3

To make it double click, change:


<if condition="$forum[statusicon] == 'new' ">
<a href="#">
<img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="$vbphrase[mark_this_forum_read_home]" title="$vbphrase[mark_this_forum_read_home]" onclick="ajaxMarkForumRead($forum[forumid])" id="mfarfh_$forum[forumid]" border="0" title=""/>
</a>
<else />
<img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="" border="0" />
</if>

to


<if condition="$forum[statusicon] == 'new' ">
<a href="#">
<img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="$vbphrase[mark_this_forum_read_home]" title="$vbphrase[mark_this_forum_read_home]" ondblclick="ajaxMarkForumRead($forum[forumid])" id="mfarfh_$forum[forumid]" border="0" title=""/>
</a>
<else />
<img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="" border="0" />
</if>

Also, I'm not sure why the href tag is in there, you can safely remove it and things work fine.

To make it show a confirmation box after clicking, edit the plugins and change:

$header .= '
<script type="text/javascript">
mfarfh_AJAX_Object = new vB_AJAX_Handler(true);

function mfarfh_AJAX_Changeimage(idd)
{

elm = document.getElementById("mfarfh_" + idd);
img = elm.src;
img = img.replace("_new", "_old");
elm.src = img;

}

function ajaxMarkForumRead(id)
{
mfarfh_AJAX_Object.send("forumdisplay.php?do=markread&f=" + id + "&mfarfh_id=" + id + "&mfarfh_ajax=true");
mfarfh_AJAX_Changeimage(id)
}
</script>
';
To:

$header .= '
<script type="text/javascript">
mfarfh_AJAX_Object = new vB_AJAX_Handler(true);

function mfarfh_AJAX_Changeimage(idd)
{

elm = document.getElementById("mfarfh_" + idd);
img = elm.src;
img = img.replace("_new", "_old");
elm.src = img;

}

function ajaxMarkForumRead(id)
{
if (confirm("Are you sure?"))
{
mfarfh_AJAX_Object.send("forumdisplay.php?do=markread&f=" + id + "&mfarfh_id=" + id + "&mfarfh_ajax=true");
mfarfh_AJAX_Changeimage(id)
}
}
</script>
';


Hope that helps.

Snake
05-21-2006, 06:56 AM
Can someone test this whether it works or not please?

Polo
07-06-2006, 12:26 PM
great hack, will definetly install :)

Snake
07-06-2006, 05:53 PM
And does it works to you if you're running on v3.5.4?

naqalone
07-06-2006, 06:26 PM
for me, it works only in forumhome (level 1), but not in forumdisplay (level2).

Pls help !
Anyway, it's very great job !

tony adams
08-16-2006, 10:08 PM
this is now in 3.6 but its a double click, will this work with 3.6 and over ride the integrated one

if not does anybody know how to change the setting in 3.6 to be single click

Ziki
09-06-2006, 07:48 PM
Best hack ever dude :)

Should be 3.5 default

JohnBee
11-07-2006, 10:08 PM
Interesting hack.
I have to ask though, what is the sense of clicking the New Post icon to off when the threads within the forums still register as unread? I don't get it... is this only to turn off the icons in the forum home?
It doesn't seem to work with IE7 btw

mhackl
11-09-2007, 02:43 PM
Is this compatible with 3.6.8, and if not is there a ported version?

Nutz
11-18-2007, 04:48 PM
Not needed, its built into 3.6.8

Thanks,
Mat.