collapse

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Who's Online

  • Dot Guests: 71
  • Dot Hidden: 0
  • Dot Users: 1
  • Dot Users Online:

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • ♦ Ninja ZX-10RR ♦: Hmm, not so sure about it, Eliana: [link]
    May 05, 2016, 02:03:02 am
  • Eliana Tamerin: That may have faded away now, or gotten better. I hope so. I see a lot of happy phpBB users, so I have to imagine someone is having success.
    April 25, 2016, 12:48:06 am
  • Eliana Tamerin: @andy, the phpBB folks had (at one point, not sure how it is now) a specific set of rules you had to follow to get support. Anyone not found doing so would have their topic ignored.
    April 25, 2016, 12:47:40 am
  • andy: SP team is a breath of fresh air...
    April 24, 2016, 11:24:32 pm
  • andy: Yes they are difficult to deal with at SMF. I never experienced anybody like that at phpbb several years ago.
    April 24, 2016, 11:24:03 pm
  • Classic Sonic: Their team is very antagonistic and I prefer this forum and this staff far more. So kudos to SP for doing it right.
    April 24, 2016, 09:18:21 pm
  • andy: When SMF went gold there was a lot of optimism about progress and talk of 3.0.  Five years on and that soulds like SF.
    April 24, 2016, 08:37:31 pm
  • andy: Just my frustration at the slow pace of SMF. I suppose we have an alternative now.
    April 24, 2016, 08:34:38 pm
  • Burke Knight: Andy, as long as the SMF team keeps like they are doing, there's always going to be bugs, mainly due to SMF issues, because the team can't get their stuff straight.
    April 24, 2016, 08:25:41 pm
  • andy: Found another bug in Simple Portal.... SMF 2
    April 21, 2016, 03:46:54 am
  • ♦ Ninja ZX-10RR ♦: I guess it's because it works perfectly then :P Glad you enjoy it!
    April 20, 2016, 08:10:13 am
  • DJF-1975: I haven't been here in a long time. THANK YOU AGAIN for SP!
    April 20, 2016, 04:41:43 am
  • andy: my shoutbox is now working properly and users are happy...  :nervous-happy: but I'm now a minimalist SMF user - thats the way to go to avoid problems.
    April 19, 2016, 10:18:09 am
  • ♦ Ninja ZX-10RR ♦: Seeing your topic, after changing the database collation, it does :)
    April 16, 2016, 10:36:36 pm
  • ZJbrandon: oh, wow, wish my shoutbox worked. :-[
    April 14, 2016, 07:26:40 pm
  • ZJbrandon: hello, test?
    April 14, 2016, 07:26:15 pm
  • ♦ Ninja ZX-10RR ♦: I probably didn't, ema. It was like 8a.m. and still had to sleep. Yet, can't get it anyway.
    April 07, 2016, 12:50:03 pm
  • Chen Zhen: gradient waveform
    April 07, 2016, 11:19:41 am
  • * emanuele feels Ninja didn't get the reference. :P
    April 07, 2016, 04:00:33 am
  • ♦ Ninja ZX-10RR ♦: Well, probably asking would be the way to know :P Or, generally, use my other alias and search, if there is one, it's me.
    April 06, 2016, 09:11:35 pm
NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Author Topic: [Block] Advanced Unread Posts  (Read 34441 times)

0 Members and 1 Guest are viewing this topic.

Offline Chen Zhen

  • The Underdog
  • Support
  • *
  • Posts: 1187
  • Gender: Male
  • Can I borrow your underwear?
    • WebDev
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
  • Elkarte Version: None
[Block] Advanced Unread Posts
« on: September 07, 2012, 09:32:43 pm »
[Block] Advanced Unread Posts

Currently for SMF 2.0x only.

Features/specifics:
  • View unread posts/topics
  • Uses javascript pages
  • Option to enable auto refresh & time interval
  • Various settings available at top of block code

Download the attached file and install it via your package manager.

Place the following code in a custom php block:
Custom PHP block (Block Permissions ~ Members:
Code: [Select]
/* Unread Posts Block v1.4 ||  c/o Underdog @ http://askususaquestion.net */
global $settings, $sourcedir;
@require_once($sourcedir . '/PortalUnread.php');

/* Current default settings are for a full display example */
/* Recommended settings for compact display (ie. side block) :           */
/* $parameters['container_style'] = 'font-family:Helvetica;font-size:10px;   */
/* $parameters['display'] = 'compact';              */

/* --------------------------------------------BLOCK SETTINGS-------------------------------------------- */
$seconds = 60;
$auto_refresh = true; /* Change to false to disable auto refresh */

/* Basic settings */
$parameters['type'] = 'Posts'; /* Posts/Topics */
$parameters['rows'] = '5'; /* (int) Amount of posts/topics per page */
$parameters['display'] = 'full'; /* full/compact */
$parameters['show_icon'] = 'yes'; /* yes/no - Show new icon */
$parameters['full_height'] = 35; /* (int) Uniform row height for full display */
$parameters['compact_height'] = 45; /* (int) Uniform row height for compact display */
$parameters['container_class'] = 'mediumtext'; /* Set the css class for the whole container .. */
$parameters['container_style'] = 'font-family:Helvetica;font-size:12px;'; /* Set the css attributes for the whole container */
// $parameters['boards'] = '1|2|3|4'; /* Specific boards to display ... uncomment to use this option! */

/* This is the number of recent topics to select new one's from */ 
$parameters['limit'] = 30; /* (int) Maximum amount of posts/topics to display */

/* Image/Language Text  ...  set $parameters['unread_icons'] = false; to disable images & use text */
/* All images located in directory /Themes/default/images/sp */
$parameters['unread_icons'] = true;
$parameters['prev'] = 'Prev'; 
$parameters['next'] = 'Next';
$parameters['vbar_x'] = '|';
$parameters['vbar_y'] = '|';

/* Starting page */
$_SESSION['sp_current_page'] = 1;

/* --------------------------------------------END BLOCK SETTINGS-------------------------------------------- */

/* Execute & then let jQuery reset the container every xx milliseconds */
sportal_unread($parameters, false, false);

if ($auto_refresh)
echo '<script type="text/javascript" src="'.$settings['default_theme_url'].'/scripts/sp-jquery-1.3.2.min.js"></script>
<script type="text/javascript">
setInterval(function() {       
    $("#sp_content").load(location.href+" #sp_content","");
        event.stopPropagation();                       
}, '.((int)$seconds * 1000).');
</script>';

Enjoy.

[Last Update] -> Version 1.4  Jan.22/2013
« Last Edit: January 27, 2013, 01:20:02 pm by Underdog »

Offline kachan64

  • Semi Newbie
  • *
  • Posts: 16
  • Gender: Male
    • Chat 'n' Go
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: [Block] Unread Posts
« Reply #1 on: September 08, 2012, 03:59:23 am »
Thanks, Give it a try when I have time...
I stepped on a cornflake, does this make me a serial killer?

Offline Chen Zhen

  • The Underdog
  • Support
  • *
  • Posts: 1187
  • Gender: Male
  • Can I borrow your underwear?
    • WebDev
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
  • Elkarte Version: None
Re: [Block] Unread Posts
« Reply #2 on: September 12, 2012, 07:49:42 pm »
how to aply for topics?

fthkynr,

  If you look at the beginning of the block code you will see where there are various possible adjustments.
For your request, specifically:
Code: [Select]
$parameters['type'] = 'Posts';  /* Posts/Topics */

Change to:
Code: [Select]
$parameters['type'] = 'Topics';  /* Posts/Topics */

Offline fthkynr

  • Semi Newbie
  • *
  • Posts: 7
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: [Block] Unread Posts
« Reply #3 on: September 13, 2012, 10:33:28 am »
thanks

Offline TinMan

  • Semi Newbie
  • *
  • Posts: 43
    • RC Arcade
Re: [Block] Unread Posts
« Reply #4 on: November 14, 2012, 07:06:36 pm »
Is there a way to change the mouse pointer from being the "text select" pointer to the "link select" pointer when someone hovers over the page numbers?

Offline Chen Zhen

  • The Underdog
  • Support
  • *
  • Posts: 1187
  • Gender: Male
  • Can I borrow your underwear?
    • WebDev
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
  • Elkarte Version: None
Re: [Block] Unread Posts
« Reply #5 on: January 07, 2013, 02:14:49 pm »

[Block] Unread Posts v1.2

Changes:

! fixed css for page numbers



The file in the first post has been updated. Please replace your current file with the newer attachment to apply the above update.

Thank you.

Offline teos

  • Jr. Member
  • **
  • Posts: 57
  • Gender: Male
    • Cultural Heritage photographer
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Unread Posts
« Reply #6 on: January 11, 2013, 02:44:31 am »
A very nice mod in deed, thanks ...

Is it possible to exclude some categories or even include categories ?
« Last Edit: January 11, 2013, 02:47:35 am by teos »

Offline Chen Zhen

  • The Underdog
  • Support
  • *
  • Posts: 1187
  • Gender: Male
  • Can I borrow your underwear?
    • WebDev
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
  • Elkarte Version: None
Re: [Block] Unread Posts
« Reply #7 on: January 12, 2013, 11:33:47 am »
A very nice mod in deed, thanks ...

Is it possible to exclude some categories or even include categories ?

teos,

You can opt specific boards to display by adding another parameter to the block's basic settings. Board id's are separated by vertical bars.

Code: [Select]
$parameters['boards'] = '1|2|3|4';  /* Specific boards to display */

Offline teos

  • Jr. Member
  • **
  • Posts: 57
  • Gender: Male
    • Cultural Heritage photographer
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Unread Posts
« Reply #8 on: January 12, 2013, 11:42:00 am »
That is great, thanks. I'll give it a try.

Offline teos

  • Jr. Member
  • **
  • Posts: 57
  • Gender: Male
    • Cultural Heritage photographer
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Unread Posts
« Reply #9 on: January 19, 2013, 08:02:35 am »
Is it a difficult task to automate this block with a time interval, to be refreshed ?

tried with the solution provided in http://simpleportal.net/index.php?topic=11407.0

used code at the top

Code: [Select]
$page = $_SERVER['PHP_SELF'];
$sec = "30";

and below code at the buttom

Code: [Select]
header("Refresh: $sec; url=$page");

  But this solution refreshed the whole page not inside the block.

Any recommendation ?
« Last Edit: January 19, 2013, 12:20:17 pm by teos »

Offline Chen Zhen

  • The Underdog
  • Support
  • *
  • Posts: 1187
  • Gender: Male
  • Can I borrow your underwear?
    • WebDev
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
  • Elkarte Version: None
Re: [Block] Unread Posts
« Reply #10 on: January 20, 2013, 01:29:02 am »
[Block] Unread Posts v1.3

Changes:

+ jquery auto refresh (if opted in block)
+ installer for needed files

teos,

  The new update includes the feature you requested.

Offline teos

  • Jr. Member
  • **
  • Posts: 57
  • Gender: Male
    • Cultural Heritage photographer
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Unread Posts
« Reply #11 on: January 20, 2013, 02:58:20 am »
Most ever wanted mod, thumbs up !

  A minor issue though ...

  What I've done ..  Since there is no uninstall function of previous mod, I directly downloaded the 1.3 files and put into production.

   $parameters['rows'] = '5'  is set, but it displays the whole unreads in one go.
Sometimes after the third page, sometimes in the first page. ( Tested in different browsers)
Maybe a clear cache is needed.

Am I missing sonething ?

"$parameters['full_height'] = 35;   
$parameters['compact_height'] = 45


Noted that numbers do not have single queotes, is that the issue ?

Seems not,  I coded single codes this time it failed on the fifth try, returned to full display.


Hımm.. Full display happens when the threshold is reached for the refresh.



Hımmm 2   ftp'ed portalunread.php to local disk and seen that it is V1.2

extracted portalunread.php  from 1.3 package and replaced it in the server.

the result is the same.  Full page is displayed after the threshold reached.

nb. I have also shoutbox enabled in the same page for 60secs refresh. Any effect ?

« Last Edit: January 20, 2013, 04:49:21 am by teos »

Offline Chen Zhen

  • The Underdog
  • Support
  • *
  • Posts: 1187
  • Gender: Male
  • Can I borrow your underwear?
    • WebDev
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
  • Elkarte Version: None
Re: [Block] Unread Posts
« Reply #12 on: January 20, 2013, 08:09:51 am »

teos,

  The js pages & refresh must be conflicting somehow. I will have to run some tests & attempt to adjust the js to get it to work properly when time permits.
To have the block function as before until I resolve & update the issue involves editing one variable..
Code: [Select]
$auto_refresh = false;
   

Offline teos

  • Jr. Member
  • **
  • Posts: 57
  • Gender: Male
    • Cultural Heritage photographer
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Unread Posts
« Reply #13 on: January 20, 2013, 08:12:13 am »
  Thanks for your efforts. I will wait the solution deadly :-)   Everybody want to use it, very handy.

Offline teos

  • Jr. Member
  • **
  • Posts: 57
  • Gender: Male
    • Cultural Heritage photographer
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Unread Posts
« Reply #14 on: January 20, 2013, 08:49:03 am »
Another minor issue, maybe related with utf8 ,  image attached. (undefined characters before "prev" end after "next" )






Offline Chen Zhen

  • The Underdog
  • Support
  • *
  • Posts: 1187
  • Gender: Male
  • Can I borrow your underwear?
    • WebDev
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
  • Elkarte Version: None
Re: [Block] Unread Posts
« Reply #15 on: January 22, 2013, 11:40:15 pm »
[Block] Unread Posts v1.4

Changes:

! fixed block height (calculated by number of rows)
! js page controller in different container (id)
+ added images for previous, next & vertical bar
+ mouseover effect for new images/buttons

teos,

  Please try out v1.4 & let me know if it functions properly.



General notes:
  • I attempted to apply many different jQuery commands to render the table as needed without success  :ill:
  • However after messing with the css, html & javascript I was able to have it display the desired effect.
  • The jQuery used for reloading just the container works fairly well (perfectly for php.. not 100% expected behavior for javascript within the loaded container).
  • Next update: replace javascript pagination with php routine that uses jQuery to control a container id. url & $_REQUEST should be able to pass starting key of array (page#) or use jQuery to force it in url (on partial reload)

Offline FrizzleFried

  • Full Member
  • ***
  • Posts: 113
  • SMF Version: 2.0.5
  • SP Version: 2.3.5
Re: [Block] Unread Posts
« Reply #16 on: January 23, 2013, 09:23:31 am »
Dumb question likely... but do we install BOTH files from the first page or just the larger one (ADV)?

Offline phantomm

  • Support
  • *
  • Posts: 395
  • Gender: Male
  • Smile, tomorrow will be worse...
    • Polish ElkArte community
  • SMF Version: None
  • SP Version: 2.4 (Elkarte)
  • Elkarte Version: 1.0.5
Re: [Block] Unread Posts
« Reply #17 on: January 23, 2013, 01:00:35 pm »
There are two versions 1.3 and 1.4 - install one of them.

Offline Chen Zhen

  • The Underdog
  • Support
  • *
  • Posts: 1187
  • Gender: Male
  • Can I borrow your underwear?
    • WebDev
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
  • Elkarte Version: None
Re: [Block] Unread Posts
« Reply #18 on: January 23, 2013, 02:52:41 pm »

FrizzleFried,

  I omitted v1.3 to thwart confusion as v1.4 appears to work correctly for the top 5 browsers.



Forum admins may need to tweak the block's settings due to the css for specific themes as I only tested this with the default theme & 2011 theme.  The first post has had the block code updated with clearer comments to help with adjusting its settings for those that are less savvy.

Offline teos

  • Jr. Member
  • **
  • Posts: 57
  • Gender: Male
    • Cultural Heritage photographer
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Advanced Unread Posts
« Reply #19 on: January 30, 2013, 04:59:50 am »
   Tested for several days, unfortunately refresh is not taking place. Tried with different browsers ( chrome, opera, firefox ).

  The rest is functioning properly, paging etc but refresh is still an issue, from my end.

smf 2.0.3  default theme curve simple portal 2.3.5