[Solved] CNS_TOPIC_POST.tpl is receiving empty POSTER and POSTER_TITLE parameters...

Post

Posted
Rating:
#5344 (In Topic #1222)
Avatar
Standard member
jacobgkau is in the usergroup ‘Well-settled’

Where are those parameters passed into the template?

Hello all,

It came to my attention this weekend that my Conversr forums have become broken somehow. I've spent a good portion of my day trying to figure out the cause, but I'm getting nowhere fast.

The problem is that the POSTER and POSTER_TITLE parameters are being passed to CNS_TOPIC_POST.tpl as empty for some reason. As a result, the {+START,IF_NON_EMPTY,{POSTER}} statement is returning false and not displaying member info for each individual forum post. You can see an example here, where there's an empty blue column on the left side of each post where the member info is supposed to be.

Curiously enough, if I remove the IF_NON_EMPTY check, I see the member avatars only, meaning that POST_AVATAR is still being returned properly.

I see in my database (in the cms_f_posts table) that p_poster is a number, and p_poster_name_if_guest is the member's name in text. I've been mucking around in PHP files all day, including (but not limited to) cns_topicview.php, cns.php, and cns_forums.php; it's not clear to me where exactly the parameters being served to CNS_TOPIC_POST.tpl are coming from. (Searching around on the GitHub repository suggests sources/hooks/systems/preview/cns_post.php simply because it returns an array that's almost all of the parameters available in the template editor for CNS_TOPIC_POST.tpl, but I don't know why we'd be using a preview hook for the topicview page.)

This issue occurred somewhat recently, but I haven't yet pinpointed what exactly caused the problem. I'm assuming it was a recent upgrade, as I did install a minor point release last week. The only other thing I can think of would be my trying to tweak the URLs in search.php last month, but I wasn't trying to touch the forums at that point and I ended up reverting my changes anyway.

As another note, the titles on all of my topicview pages now display as "<Actual Title> - Comments - Comments - Comments - Comments…" for some reason, and every reply to a topic also has its title set to "- Comments". I have no idea if that's related or not, but I know it wasn't the case before.

I'm not a PHP guru, so any pointers in the right direction for tracking down the issue(s) would be greatly appreciated!

Edit: I just discovered that moving sources_custom to sources_custom.bak fixes this issue, so I'm now going through and trying to diff everything in my sources_custom against the plain sources versions. I expected that the issue was caused by something I changed, but I'm still on the hunt for what got updated that triggered the breakage.

Last edit: by jacobgkau

Online now: No Back to the top

Post

Posted
Rating:
#5345
Avatar
Standard member
jacobgkau is in the usergroup ‘Well-settled’
Welp, I figured it out. This commit that has something to do with multi-language support changes a few lines in cns_topicview.php, including changing from a "get_site_default_lang()" function to using a "$spacer_post_lang" variable. Since I had made a copy of cns_topicview.php in my sources_custom to support my simplified URL scheme, I didn't get the update in that file, while other parts of my website presumably did get updated in that manner. I used Meld (a diff tool) to locate the changes and copy them into my version, and everything's back to normal now.

Sorry for the noise.
Online now: No Back to the top

Post

Posted
Rating:
#5359
Avatar
Standard member
SoccerDad is in the usergroup ‘Community saint’
No apology necessary from my end Jacob: I love these types of posts as they often provide another item for my own troubleshooting checklist should an issue arise; this one is no exception, so thanx!  :thumbs:

"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved
Online now: No Back to the top
1 guest and 0 members have just viewed this.

Statistics

Users online:

mytracker, Manu, gabriel58, ManojSree, babu, Paul D, amit.nigam

Forum statistics:
  • 1,174 topics, 5,550 posts, 6,746 members
  • Our newest member is waqasf160
Birthdays:
Back to Top