collapse

* User Info

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

* Who's Online

  • Dot Guests: 51
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • k1mo0o: hi
    Yesterday at 08:54:15 PM
  • kiki26022003: hi
    November 24, 2014, 02:54:28 PM
  • larry007: test
    November 20, 2014, 03:17:39 PM
  • {OCS}MasterSeal: HI, WhiteEagle
    November 12, 2014, 04:20:18 AM
  • WhiteEagle: Hello all.
    November 09, 2014, 05:33:00 PM
  • {OCS}MasterSeal: Oh and I almost forgot THANK YOU SP TEAM!
    November 04, 2014, 05:02:38 AM
  • {OCS}MasterSeal: I think I'll spam the shoutbox with as many SP IS AWESOME posts as I can.. but no more than one per day :
    November 04, 2014, 04:48:39 AM
  • desertcities: How long does it take to get approval here?  I posted on 10/29, my site is down, I need help.
    November 01, 2014, 08:50:30 PM
  • Zz: hello everyone! I posted a topic recently on Custom COdind section but it is still waiting for approval. Can anyone help with this?
    November 01, 2014, 04:21:31 PM
  • {OCS}MasterSeal: WOW> I'm so impressed at the developer involvement here at SP. Great stuff. Thank you!
    October 30, 2014, 11:42:03 PM
  • [SiNaN]: Feel free to customize it to your liking, however, this is the best we can currently offer.
    October 30, 2014, 08:19:04 AM
  • xeon365: ie where username profile link.. its just getting the membergroup color directly and adding it as inline style.. would be better if it instead just added the membergroup as a css class that can be styled by the theme
    October 29, 2014, 11:00:10 PM
  • xeon365: omg why isn't membergroup got proper css class.. not dumping inline css style
    October 29, 2014, 10:58:03 PM
  • BurkeKnight: [SiNaN] old friend. Great Job. I can't wait to see what you add next. :)
    October 13, 2014, 04:13:53 PM
  • [SiNaN]: Thank you everyone, for the kind words and support. For those who are interested, check out our Donators Program: [link]
    October 13, 2014, 11:57:44 AM
  • {OCS}MasterSeal: Glad to be here, glad to use your amazing portal THank you!
    October 13, 2014, 11:33:35 AM
  • Mike Vail: I'd like to donate to you for all your wonderful work. Do you guys have a place on your site to do that? THANKS FOR EVERYTHING!
    October 13, 2014, 11:12:16 AM
  • Mstcool: Yay, an update! :D
    October 12, 2014, 01:39:17 AM
  • stanyy: You're right. I have no idea how I got to the "Archived" index. It looks too similar.
    October 03, 2014, 11:38:32 AM
  • [SiNaN]: SimplePortal 2.3.5 package is listed in Stable SimplePortal Packages category in Downloads area.
    October 03, 2014, 06:08:01 AM
Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

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

0 Members and 1 Guest are viewing this topic.

Offline Underdog

  • Support
  • *
  • Posts: 856
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
[Block] Advanced Unread Posts
« on: September 07, 2012, 07: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, 12: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, 01: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 Underdog

  • Support
  • *
  • Posts: 856
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: [Block] Unread Posts
« Reply #2 on: September 12, 2012, 05: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, 08:33:28 AM »
thanks

Offline TinMan

  • Semi Newbie
  • *
  • Posts: 43
    • RC Arcade
Re: [Block] Unread Posts
« Reply #4 on: November 14, 2012, 06: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 Underdog

  • Support
  • *
  • Posts: 856
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: [Block] Unread Posts
« Reply #5 on: January 07, 2013, 01: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, 01: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, 01:47:35 AM by teos »

Offline Underdog

  • Support
  • *
  • Posts: 856
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: [Block] Unread Posts
« Reply #7 on: January 12, 2013, 10: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, 10: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, 07: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, 11:20:17 AM by teos »

Offline Underdog

  • Support
  • *
  • Posts: 856
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: [Block] Unread Posts
« Reply #10 on: January 20, 2013, 12: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, 01: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, 03:49:21 AM by teos »

Offline Underdog

  • Support
  • *
  • Posts: 856
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: [Block] Unread Posts
« Reply #12 on: January 20, 2013, 07: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, 07: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, 07:49:03 AM »
Another minor issue, maybe related with utf8 ,  image attached. (undefined characters before "prev" end after "next" )






Offline Underdog

  • Support
  • *
  • Posts: 856
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: [Block] Unread Posts
« Reply #15 on: January 22, 2013, 10: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: 114
  • SMF Version: 2.0.5
  • SP Version: 2.3.5
Re: [Block] Unread Posts
« Reply #16 on: January 23, 2013, 08: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: 389
  • Gender: Male
  • Smile, tomorrow will be worse...
    • Polish ElkArte community
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Unread Posts
« Reply #17 on: January 23, 2013, 12:00:35 PM »
There are two versions 1.3 and 1.4 - install one of them.

Offline Underdog

  • Support
  • *
  • Posts: 856
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: [Block] Unread Posts
« Reply #18 on: January 23, 2013, 01: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, 03: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