TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,022
  • Total Topics: 21,332
  • Online today: 725
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 646
  • Total: 646

"Mark all forums as read" on Frontpage

Started by Dylert, May 12, 2012, 10:58:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dylert

Link to my site: http://www.hellasforum.net
SMF version: SMF ver. 2.0.2
TP version: TP ver. 1.105
Default Forum Language: Norwegian

Hi! I'm trying to make a "Mark all forums as read" button or link in a block on my frontpage. I copy the link from the link the forum main page, and put it into my block. Sometimes the link works and all my forums get marked as read, and sometimes not. Which link do I have to use to get all forums marked as read every time? This is the link I have tried to use: http://hellasforum.net/index.php?action=markasread;sa=all;fd3ffc12=7c1d7e61e172f5f6c63a068a1355ddd6

Skhilled

Quote from: Dylert on May 12, 2012, 10:58:58 AM
Sometimes the link works and all my forums get marked as read, and sometimes not.

Sounds like a caching issue on your forum or in your browser. Otherwise, they should be marked as read immediately. clear the cache in your browser and in SMF and see if that helps.

IchBin

It's an issue with the session ID in the url. This part of the url:
fd3ffc12=7c1d7e61e172f5f6c63a068a1355ddd6

That is unique to each individual when they browse the forum. And it's even unique the next time you login.

You'll have to use a php block to do this. You'll need to use some code like this:


global $context, $scripturl;
echo '<a href="'. $scripturl .'?action=markasread;sa=all;'.$context['session_var'] .'='. $context['session_id'].'">Mark All Unread</a>';

Dylert

Thanks alot, IchBin! It works great! :) I have only one question: If I want to align the text to the right side of the block, how will the code be then?

ZarPrime

Hmmm, good question.  Normally, you can't align links but this may work (code added to Ichbin's code) ...

global $context, $scripturl;
echo '<a style="float: right" href="'. $scripturl .'?action=markasread;sa=all;'.$context['session_var'] .'='. $context['session_id'].'">Mark All Unread</a>';


Edit:  Hmmm, seems to work fine but shouldn't the link say "Mark All Read" rather than "Mark All Unread"?

ZarPrime

Dylert


ZarPrime

Sure.  No problem.  Topic marked solved. O0

ZarPrime

This website is proudly hosted on Crocweb Cloud Website Hosting.