2

When using the TinyMCE editor, how can I display the username at the top of an article?

  • You don't mean you want to display the article's Author's name, right? – FFrewin Aug 20 '15 at 20:26
3

You can't display dynamic data this way through an article by default, as the editors won't process php.

However, to your rescue, there are plugins for this.

You can install Nonumber's Sourcerer Plugin, and now you can write php, or other code directly in your articles.

It even supports some of the most common Joomla variables and Objects, which are ready to use. JUser is one of these, so all you need to display user data is a code inside your article like below:

{source}
<?php echo $user->username; ?>
{/source}

For more info about User Profile see: How to display user profile information?

The other way to display dynamic date in your article is to modify the article's template with an override and put all your php code in there.

Joomla Template/Layout Overrides Links

0

If you want to see the author on your website you have to change the settings of the article. System > Global Configuration > Articles and go to tab: "Articles" and look for "Show Author" and activate it.

0

Download, install and enable a plugin name DirectPHP. This plugin gives the facility to write PHP code in article. After these in your article write following code.

<?php 
   jimport( 'joomla.user.helper' ); 
   $user = JFactory::getUser();
   echo $user->username;
?>

This may help you. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.