News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

Main Menu

Latest Posts in board index question?

Started by sschefer, May 02, 2014, 02:30:17 PM

Previous topic - Next topic

sschefer

I'm running 2.0.7 with the default theme.

I have parent boards with child boards that have child boards. If I post at the second child the new post does not show up in recent posts in the parent. They do show in the first child just not the parent. It's logical that they don't but I'd really like to modify the logic so that when a person logs on and gets the home (board index) they will see that there is activity in the parent forum.

Has anybody seen a mod for this or maybe done one themselves. I didn't see anything that fit the bill in the currently available mods.

Of course there's always a good chance that I've missed a setting that already takes care of the problem. I think I've looked at all the options but maybe I missed it. If that's the case could someone guide me to it.

Thanks in advance for helping.


kat

How about having a portal, as your front page? I believe most portals have a pre-configured "Latest posts" block, which shows all recent posts. Or, you can configure which board's posts do and don't appear. Simple Portal sure does and I wouldn't be at all surprised if all the others do, too. :)

margarett

There is this mod
http://custom.simplemachines.org/mods/index.php?mod=3009

Please note that the current behavior was implemented for performance reasons.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sschefer

Quote from: margarett on May 02, 2014, 04:05:27 PM
There is this mod
http://custom.simplemachines.org/mods/index.php?mod=3009

Please note that the current behavior was implemented for performance reasons.

Thank you. That's a step in the right direction. I now have the correct totals at the parent level. I will have a look at the portal suggestion also.

sschefer

Quote from: K@ on May 02, 2014, 02:54:32 PM
How about having a portal, as your front page? I believe most portals have a pre-configured "Latest posts" block, which shows all recent posts. Or, you can configure which board's posts do and don't appear. Simple Portal sure does and I wouldn't be at all surprised if all the others do, too. :)

I'll look into this, it makes sense that it would be a good solution. Thank you.

sschefer

As it turns out, although the portal solution did look promising, in the end it simply masked the issue. Having been at this stuff for many years I know the dangers of that so I'll choose to not go down that path.

Any other ideas? 


margarett

Didn't the mod I pointed you fixed the issue?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sschefer

Quote from: margarett on May 03, 2014, 03:21:06 AM
Didn't the mod I pointed you fixed the issue?

The mod took care of the post count totals. It now correctly totals the topics and posts in all of the child boards and displays them at the Parent level. That's a big improvement but comes at an overhead price since it naturally needs to re-total on each refresh. I'm self-hosted and have a strong data server on a fiber backbone so it's not an issue for me. I would hesitate to run it in a an environment with the data siting on the localhost.

I went back to looking at different portals and found EzPortal. It seems to be better at accommodating the problem than the others I tried. I also commented out the "UNREAD TOPICS" text/action that appeared on the right side of the forum/category headers which makes it less noticeably incorrect.

Now, I'd like to either fix the recent posts info at the parent level when children/grandchildren/great grandchildren exist or remove it completely. Removing it would stop the "Why didn't my post show up on the board index?" questions. Ideally, it could be fixed to work correctly because that will cause the end user to be more curious and make the board appear more active.

I'm fairly sure I've located the template where it's occurring and will take a look at it on my test server. If you can think of a quick change I can make that would certainly speed up the process. You can have a look at the forum to see what I'm speaking off at: http://norcalfish.com/smf/ [nofollow]

sschefer

QuoteNow, I'd like to either fix the recent posts info at the parent level when children/grandchildren/great grandchildren exist or remove it completely. Removing it would stop the "Why didn't my post show up on the board index?" questions. Ideally, it could be fixed to work correctly because that will cause the end user to be more curious and make the board appear more active.

I'm fairly sure I've located the template where it's occurring and will take a look at it on my test server.

I took care of this by 1. Changing the display name of the ezBlock to read Recent Post's but using the Recent Topics ezBlock and then commenting out the display of the recent topics in BoardIndex.template.php

<td class="lastpost">';

/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
//if (!empty($board['last_post']['id']))
// echo '
// <p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
// ', $txt['in'], ' ', $board['last_post']['link'], '<br />
// ', $txt['on'], ' ', $board['last_post']['time'],'
// </p>';
echo '
</td>


Notice I did not comment out the TD since it would fail if I did that. The root of the problem lies above this code in that it doesn't look for children beyond child_level 1 I'll take care of that next. This current fix will be removed when I have fixed and tested that.

sschefer

Herin lies the problem -
// Child of a child... just add it on...
elseif (!empty($boardIndexOptions['countChildPosts']))
{
if (!isset($parent_map))
$parent_map = array();

if (!isset($parent_map[$row_board['id_parent']]))
foreach ($this_category as $id => $board)
{
if (!isset($board['children'][$row_board['id_parent']]))
continue;

$parent_map[$row_board['id_parent']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['id_parent']]);
$parent_map[$row_board['id_board']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['id_parent']]);

break;
}

if (isset($parent_map[$row_board['id_parent']]) && !$row_board['is_redirect'])
{
$parent_map[$row_board['id_parent']][0]['posts'] += $row_board['num_posts'];
$parent_map[$row_board['id_parent']][0]['topics'] += $row_board['num_topics'];
$parent_map[$row_board['id_parent']][1]['posts'] += $row_board['num_posts'];
$parent_map[$row_board['id_parent']][1]['topics'] += $row_board['num_topics'];

continue;
}

continue;
}
// Found a child of a child - skip.
else
continue;


This was probably done due to the  potential for overloading the array. There are better way's to do this. I'll see what I can do.

But first, I'm going fishing....

sschefer

LOL, I was hoping to check in after a long weekend at the keyboard and find that someone had fixed this for me.. You guy's are terrible. You actually want me to fix it don't you...  :) :) :) :) HA. O.K. but not until tomorrow. I'm too tired tonight. ;D

Arantor

If it was just *that* that was the problem, you could turn on the option in the admin panel that sets $boardIndexOptions['countChildPosts'].

Except that only actually affects the numbers and still explicitly does not deal with the +1 level issue. For that you would need to rewrite the query to not have the limit, then look at the piece of code that performs the check, and remove the continue, then deal with the fact that this same code is used for both the board index and inside each board to show the child boards, meaning that any solution you write is probably wrong in terms of finding the right thing to update.

Add in the fact that if you have board moderators, you won't even get single-rows for each board, but multiple instances of the same row due to the left join (one row per moderator per board)

I did look at your forum. From my perspective I'd say you have *way* too many boards.
Holder of controversial views, all of which my own.


sschefer

You are correct. My post counts are correct.

Regarding the code, yes it is a bit of a challenge but nothing that a seasoned SQL programmer can't handle.

Regarding my boards, if you look at the way they are structured you will see that within a few clicks you can access specific high quality information without ever having to perform a search. It beats the heck out of searching through a bunch of hijacked threads and it dramatically reduces back end search engine loading.

I'm very happy with the way it's running right now. It's new and has only a few members. I have run other forum software in the past and was not as satisfied as I am with SMF. We actually started running Simple:Press inside of WordPress but that soon proved to be an over integrated nightmare.

Regarding the code, I've got most of it taken care of now. It's a complete overhaul and I may not actually apply it since it would mean more overhead again during updates. In reality, just commenting out the display portion of the code and then running ezPortal takes care of the problem. Considering that this is the only issue I've found I'd say you folks did a pretty darn good job.

Arantor

I should hope I was correct, having been spending time rewriting it this week (no, it won't be going into SMF 2.1, they don't want to take on board the scale of changes I would have proposed)

Yes, it is highly organised. Experience suggests that it's actually too organised and that people won't use the boards as provided. Not to mention that too many boards generally puts people off unless they're full of posts.

The reason it was done was for performance; the additional cost of doing board access checks against all the boards versus the ones just limited is non trivial.

And no, it's not just SQL that you need to deal with, especially considering the fact that the board index explicitly relies on quirks in MySQL in order to operate correctly (and is broken on MySQL 5.6+)
Holder of controversial views, all of which my own.


sschefer

QuoteAnd no, it's not just SQL that you need to deal with, especially considering the fact that the board index explicitly relies on quirks in MySQL in order to operate correctly (and is broken on MySQL 5.6+)

Yep, it sure isn't.. LOL. I've already dealt with a lot of the MySQL stuff. It's been mostly with mods that use mixed case table/column names. If I thought I had the time to invest I would pump it through VS 2012, make it run on MS SQL and do away with mods all together. Of course that breaks the fundamentals of Open Source and leaves me with a morphed system that can never be upgraded and a lot of work just to keep up with the Jones's. Maybe when I retire in a couple of years.  ;D

Thanks for your opinions on the board.


Arantor

Not to mention a complete rewrite of SMF from the ground up, having spent time looking at this before. But since you seem to know best, I'll defer to your opinion on this one.
Holder of controversial views, all of which my own.


Advertisement: