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

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.
Gumboots, this is on a more advanced level that I can decipher or something else is missing. I tried your code above and not even my PHP editor likes adding it. When forced into around line 177 the forum goes blank.

Can you enlighten us on what solution you found? Cabot has been gracious enough to lend his assistance, but when I'm not able to follow in your footsteps.

Statistics: Posted by SQLnovice — Mon Dec 23, 2024 4:20 pm



Viewing all articles
Browse latest Browse all 1896

Trending Articles