collapse collapse

* User Info

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

* Who's Online

  • Dot Guests: 198
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM
  • phantomm: and from what I see only patch is broken, full install package is fine
    October 21, 2016, 03:44:44 PM
  • phantomm: they say it for over 3 weeks now..
    October 21, 2016, 03:43:52 PM
  • aegersz: SMF say that bug fix 2.0.13 is coming soon ...
    October 19, 2016, 06:46:12 PM
  • Chen Zhen: check that thread at a later date as that file is not a final fix
    October 10, 2016, 03:09:18 PM

* Recent Posts

Re: Need Help! Newbie! by andy
[April 17, 2018, 07:21:58 AM]


Re: Need Help! Newbie! by anieB
[April 15, 2018, 08:48:21 PM]


Re: Need Help! Newbie! by Kaede Akamatsu
[April 15, 2018, 01:41:33 PM]


Need Help! Newbie! by anieB
[April 14, 2018, 03:11:12 PM]


Re: [MOD] Edit button on blocks and custom pages by Arynews
[April 09, 2018, 05:58:09 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 45032 times)

0 Members and 1 Guest are viewing this topic.

Offline Jade Elizabeth

  • Comrade
  • *
  • Posts: 1146
  • Gender: Female
    • Jades-World
  • SMF Version: None
  • SP Version: None
Re: [Block] Advanced Unread Posts
« Reply #60 on: January 16, 2016, 04:03:39 AM »
Also if no posts are found is there a way I can hide the block?
Jade Elizabeth
(Ex Language Coordinator)
Owner of Awesome Crazy (the home of the insane),
Color Me Forum (For Adult Coloring Enthusiasts), and
Creative Burrow (A place for creative people).

Offline Jade Elizabeth

  • Comrade
  • *
  • Posts: 1146
  • Gender: Female
    • Jades-World
  • SMF Version: None
  • SP Version: None
Re: [Block] Advanced Unread Posts
« Reply #61 on: January 26, 2016, 11:56:13 AM »
I *REALLY* need this, and it's BRILLIANT....except when you try to view unread topics it doesn't load the block or the page....

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'] = 'topics'; /* 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'] = 25; /* (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:open sans;font-size:14px;'; /* Set the css attributes for the whole container */

$parameters['boards'] = '17'; /* Specific boards to display ... uncomment to use this option! */

/* This is the number of recent topics to select new one's from */ 
$parameters['limit'] = 10; /* (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>';

Can anyone help with this? It's making a bit of a mess of things and I really need this block to alert staff of new issues.

It also doesn't work on the recent posts, unread replies...etc pages.
Jade Elizabeth
(Ex Language Coordinator)
Owner of Awesome Crazy (the home of the insane),
Color Me Forum (For Adult Coloring Enthusiasts), and
Creative Burrow (A place for creative people).

Offline emanuele

  • Developer
  • *
  • Posts: 288
Re: [Block] Advanced Unread Posts
« Reply #62 on: January 26, 2016, 04:18:15 PM »
Did you install the package attached to the first post?

Offline Jade Elizabeth

  • Comrade
  • *
  • Posts: 1146
  • Gender: Female
    • Jades-World
  • SMF Version: None
  • SP Version: None
Re: [Block] Advanced Unread Posts
« Reply #63 on: January 27, 2016, 08:41:50 AM »
Yes :D.
Jade Elizabeth
(Ex Language Coordinator)
Owner of Awesome Crazy (the home of the insane),
Color Me Forum (For Adult Coloring Enthusiasts), and
Creative Burrow (A place for creative people).

Offline Burke Knight

  • Sr. Member
  • ****
  • Posts: 394
  • Gender: Male
  • I tell it how I see it. Don't like it? Hit Alt+F4
    • BurkeKnight Enterprises
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
Re: [Block] Advanced Unread Posts
« Reply #64 on: January 27, 2016, 10:46:59 AM »
I used to use this, too, but stopped, as it seemed to have such a large empty block for most part. Even if posts were listed, the block always seemed too big for the list. As if, the block is a set height, instead of fluid.

Offline emanuele

  • Developer
  • *
  • Posts: 288
Re: [Block] Advanced Unread Posts
« Reply #65 on: January 28, 2016, 02:25:06 AM »
I did a copy&paste of the code in your post into a block and it apparently works fine, could you give more hints on how you configured it? ;)
And "how" exactly it is failing? I'm not sure if it is on any page or just in particular ones.

Offline Jade Elizabeth

  • Comrade
  • *
  • Posts: 1146
  • Gender: Female
    • Jades-World
  • SMF Version: None
  • SP Version: None
Re: [Block] Advanced Unread Posts
« Reply #66 on: January 28, 2016, 03:59:05 AM »
Here's a video my fiance uploaded for me...

https://www.youtube.com/watch?v=yxh0t6r28-Y
Jade Elizabeth
(Ex Language Coordinator)
Owner of Awesome Crazy (the home of the insane),
Color Me Forum (For Adult Coloring Enthusiasts), and
Creative Burrow (A place for creative people).

Offline emanuele

  • Developer
  • *
  • Posts: 288
Re: [Block] Advanced Unread Posts
« Reply #67 on: January 28, 2016, 02:38:49 PM »
heh.
One of the few coding guidelines really meaningful and actually very good of SMF is "do not use the suppress error unless *really* needed".

The problem is:
Code: [Select]
Fatal error: Cannot redeclare unreadTopics() (previously declared in /.../Sources/Recent.php:423) in /.../Sources/PortalUnread.php on line 355
So the solution if rename the unreadTopics function declared in PortalUnread.php to something else, sp_unreadTopics for example, and of course change all the usages of that function inside the file and the code of the block.

Of course renaming it may reveal other similar errors.

Offline Jade Elizabeth

  • Comrade
  • *
  • Posts: 1146
  • Gender: Female
    • Jades-World
  • SMF Version: None
  • SP Version: None
Re: [Block] Advanced Unread Posts
« Reply #68 on: January 28, 2016, 11:39:21 PM »
I tried that it says there's a syntax error in the block code when i tried to save (even though there were no changes) and now it says this on pages:
Fatal error: Call to undefined function unreadtopics() in /Sources/PortalUnread.php on line 44

function sp_advUnreadTopics is what I renamed it to, in case sp_unreadTopics was in use.
Jade Elizabeth
(Ex Language Coordinator)
Owner of Awesome Crazy (the home of the insane),
Color Me Forum (For Adult Coloring Enthusiasts), and
Creative Burrow (A place for creative people).

Offline emanuele

  • Developer
  • *
  • Posts: 288
Re: [Block] Advanced Unread Posts
« Reply #69 on: January 29, 2016, 08:05:52 AM »
You have to change also the places the function is called.
So, line 44 of PortalUnread.php you will have:
Code: [Select]
unreadtopics();or something similar, and you have to put:
Code: [Select]
sp_advUnreadTopics();or alike depending how it was in origin.

Offline Jade Elizabeth

  • Comrade
  • *
  • Posts: 1146
  • Gender: Female
    • Jades-World
  • SMF Version: None
  • SP Version: None
Re: [Block] Advanced Unread Posts
« Reply #70 on: January 30, 2016, 07:11:34 AM »
No line 44 is this:
Code: [Select]
$items = $type($limit, null, $boards, 'array');


Code: [Select]
function sportal_unread($parameters, $id, $return_parameters = false)
{
global $txt, $scripturl, $settings, $context, $color_profile, $boardurl;

$block_parameters = array(
'boards' => 'boards',
'limit' => 'int',
'type' => 'select',
'display' => 'select',
);

if ($return_parameters)
return $block_parameters;

$boards = !empty($parameters['boards']) ? explode('|', $parameters['boards']) : null;
$limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
$rows = !empty($parameters['rows']) ? (int) $parameters['rows'] : 5;
$type = 'unread' . (!empty($parameters['type']) ? $parameters['type'] : 'Posts');
$display = !empty($parameters['display']) ? $parameters['display'] : 'full';
$prev = !empty($parameters['prev']) ? $parameters['prev'] : 'Prev';
$next = !empty($parameters['next']) ? $parameters['next'] : 'Next';
$vertical_bar_x = !empty($parameters['vbar_x']) ? $parameters['vbar_x'] : '|';
$vertical_bar_y = !empty($parameters['vbar_y']) ? $parameters['vbar_y'] : '|';
$images = !empty($parameters['unread_icons']) ? $parameters['unread_icons'] : false;
$items = $type($limit, null, $boards, 'array');
$row_height_full = !empty($parameters['full_height']) ? (int) $parameters['full_height'] : 35;
$row_height_compact = !empty($parameters['compact_height']) ? (int) $parameters['compact_height'] : 45;
$show_icon = !empty($parameters['show_icon']) ? $parameters['show_icon'] : 'yes';
$current_page = !empty($_SESSION['sp_current_page']) ? (int) $_SESSION['sp_current_page'] : 1;
$class = !empty($parameters['container_class']) ? $parameters['container_class'] : 'mediumtext';
$style = !empty($parameters['container_style']) ? $parameters['container_style'] : 'font-family:Helvetica;';
if ($display == 'full')
$height = ($rows+1.88) * $row_height_full;
else
$height = ($rows+0.88) * $row_height_compact;
$counter = 0;
Jade Elizabeth
(Ex Language Coordinator)
Owner of Awesome Crazy (the home of the insane),
Color Me Forum (For Adult Coloring Enthusiasts), and
Creative Burrow (A place for creative people).

Offline emanuele

  • Developer
  • *
  • Posts: 288
Re: [Block] Advanced Unread Posts
« Reply #71 on: January 31, 2016, 05:35:50 AM »
Replace everything with the attached.

Offline Jade Elizabeth

  • Comrade
  • *
  • Posts: 1146
  • Gender: Female
    • Jades-World
  • SMF Version: None
  • SP Version: None
Re: [Block] Advanced Unread Posts
« Reply #72 on: February 02, 2016, 06:23:40 PM »
Thanks so much! That works now! I wouldn't have figured that out on my own, thank you!! :D
Jade Elizabeth
(Ex Language Coordinator)
Owner of Awesome Crazy (the home of the insane),
Color Me Forum (For Adult Coloring Enthusiasts), and
Creative Burrow (A place for creative people).

Offline Portugal

  • Semi Newbie
  • *
  • Posts: 28
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Advanced Unread Posts
« Reply #73 on: May 23, 2016, 06:11:02 PM »
Instead of unread, its possibile to change for unreply??

Offline emanuele

  • Developer
  • *
  • Posts: 288
Re: [Block] Advanced Unread Posts
« Reply #74 on: May 26, 2016, 06:54:01 PM »
Possible is certainly possible. It requires to rewrite the query to fetch the "unreply" following the one used by SMF for the same function.

* emanuele hopes Chan Zhen has some moment to look into the matter.  :angel:

Offline GeneralMitch

  • Newbie
  • Posts: 3
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: None
Re: [Block] Advanced Unread Posts
« Reply #75 on: June 08, 2017, 12:26:55 PM »
I did everything installed it added the php code, however when i post a new topic or reply nothing ever shows up on the block just says    "No posts were found."

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1152
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: [Block] Advanced Unread Posts
« Reply #76 on: June 08, 2017, 08:15:14 PM »
I did everything installed it added the php code, however when i post a new topic or reply nothing ever shows up on the block just says    "No posts were found."
Did you try to set the options inside the code up or did you just blindly copy/paste it? ;)
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

▼ My job! ▼

No PMs for support unless it's a paid request. Thank you! :)
#OpIsis