Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 1959

phpBB Custom Coding • Re: [SOLVED] viewtopic-body.html - IF user is viewing own post

$
0
0
After figuring this one out - viewtopic.php?t=2655820 - I tried an alternative method of dealing with the lack of a CURRENT_USER_ID variable. This also works...

Code:

{% set currentUserId = CURRENT_USERNAME_FULL | trim('<a href="./memberlist.php?mode=viewprofile&amp;u=') | split('"')[0] %}{% if S_REGISTERED_USER and S_DISPLAY_PM and (postrow.POSTER_ID is same as currentUserId) %}<dd class="profile-inbox">
It's cleaner in one sense, in that it just calls postrow.POSTER_ID instead of postrow.POST_AUTHOR_FULL. On other other hand, it relies on running trim and split on CURRENT_USERNAME_FULL first, before running the comparison with postrow.POSTER_ID, so whether it's actually better or not is anyone's guess.

Obviously you could run trim twice, but the cleaner syntax of split('"')[0] seemed better. It avoids having to use wildcards to deal with the inline style for username colour.

Anyway, this works. Functionally it's identical to Cabot's solution, but since I had to play with this stuff to figure out something else I thought I'd use this solution.
:?: Our moderators have been requesting just this ability. But it doesn't work for me, just shows a ruined forum blank page, like the page's code is incomplete and can't be read correctly.

Although, I wasn't clear on where in viewtopic_body.html to insert this code, so I put it just above the last line, between these two:

Code:

{% EVENT viewtopic_body_online_list_after %}<!-- INCLUDE overall_footer.html -->
I tried your previous code too in the same place with the same result. The host's text editor seems to proofread the changes too as to whether the syntax belongs. Excluding the <dd class... line, the others appeared with red Xs next to them, so I fully expected the added code insert to fail (PHP 3.3.14).

Forgive me for my lack of PHP code knowledge, but none of the other posts were written in a way I could understand what needed to be changed or which file needed to be modified where. :( I throw my hands up in these cases because my chances of success are about as bright as bringing a retro encabulator online.

Statistics: Posted by SQLnovice — Sat Dec 14, 2024 8:03 pm



Viewing all articles
Browse latest Browse all 1959

Trending Articles