XF 2.0 BBCode to return user viewing post

zagman76

Active member
Hello - is there a simple way to create a BBCode which will return the user's username who is viewing the post? I tried putting just {name} in the HTML replacement, but that didn't work.

Thanks!
 
Just create the bbcode button, so inserts {name} with blank html so it literally just places a {name}. After that create a new template modification for post_macros. Find:
HTML:
{{ bb_code($post.message, 'post', $post) }}
replace with:
HTML:
{{ bb_code({$post.message|replace("{name}", $xf.visitor.username)}, 'post', $post) }}
 
Top Bottom