%name% on news

Dec 17, 2017
151
19
Hi guys!

I would like to add that the name of the user who is viewing the page is displayed with the %name% function.

Example
Hello %name% = Hello AlexstyleRetro on page News.

Thanks :)
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
In me.php is this:

<?php echo $user['username']; ?>

If I try to insert it, it goes out as it is written, Can I shorten it for the news?
News gets filtered in the database that's why it won't work. You'll need to go into where the news gets loaded and in the PHP code call to the body variable and do a replace function. Search for %username% and replace with $user[username]
 
Dec 17, 2017
151
19
News gets filtered in the database that's why it won't work. You'll need to go into where the news gets loaded and in the PHP code call to the body variable and do a replace function. Search for %username% and replace with $user[username]
You can not find anything with% username% or something like that.
 

SaW

Member
Mar 3, 2018
101
15
You'd have to write your own function that filters the news content and replaces the %username% placeholder. I assume preg_replace would do the job.
 

Users who are viewing this thread

Top