Advertisement
expand COM_CONTENT_SAVE_SUCCESS="Article saved." Topic is solved
Moderators: ooffick, General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
-
- Joomla! Apprentice
- Posts: 19
- Joined: Sun Jun 27, 2010 10:42 am
expand COM_CONTENT_SAVE_SUCCESS="Article saved."
How can I expand the message
COM_CONTENT_SAVE_SUCCESS="Article saved."
to something like this?
COM_CONTENT_SAVE_SUCCESS="Article saved at $Timestamp."
Reason: When editing an article, I often saved it by the "save-button" and the message will remain at top.
Sometimes it would be very useful to have the time of the last save being displayed in the message.
Is there an easy way to change it - e.c. via an override?
COM_CONTENT_SAVE_SUCCESS="Article saved."
to something like this?
COM_CONTENT_SAVE_SUCCESS="Article saved at $Timestamp."
Reason: When editing an article, I often saved it by the "save-button" and the message will remain at top.
Sometimes it would be very useful to have the time of the last save being displayed in the message.
Is there an easy way to change it - e.c. via an override?
Advertisement
-
- Joomla! Virtuoso
- Posts: 3102
- Joined: Fri Jul 05, 2013 10:35 am
- Location: Parts Unknown
Re: expand COM_CONTENT_SAVE_SUCCESS="Article saved."
Creating a language override is not enough, you need to pass the timestamp and for that you need to write some PHP code. A complex solution is a MVC override plugin that overrides the controller where the message is generated. A simpler but less reliable way is to manipulate the message queue. This should be done during onAfterDispatch or later event:
This may work from a template override but is not recommended.
Code: Select all
$app = $this->getApplication();
// Retrieve messages and clear the message queue.
$messages = $app->getMessageQueue(true);
foreach ($messages as $k => $message)
{
// Match and replace the message in question.
if ($message['message'] === $app->getLanguage()->_('COM_CONTENT_SAVE_SUCCESS'))
{
$message['message'] = $app->getLanguage()->_(sprintf('PLG_SYSTEM_EXAMPLE_SAVE_SUCCESS', $timestamp));
}
// Repopulate the message queue.
$app->enqueueMessage($message['message'], $message['type']);
}
-
- Joomla! Apprentice
- Posts: 19
- Joined: Sun Jun 27, 2010 10:42 am
Re: expand COM_CONTENT_SAVE_SUCCESS="Article saved."
Hello SharkyKZ, thank you for your answer and the quick solution. But I still have more questions.
1. I have studied this: http://joomla-templates.de/template-overrides, but unfortunately I cannot identify the correct file in which the message is displayed. I also don't have enough background knowledge to know how to implement your solution there. Can you help me with that?
More questions.
2. Isn't the override dangerous because, if I have understood correctly, the original files are no longer accessed and any updates to the Joomla core no longer take effect?
3. In that sense, overring is more of a testing thing. The better long-term solution seems to me to be modifying the Joomla core.
1. I have studied this: http://joomla-templates.de/template-overrides, but unfortunately I cannot identify the correct file in which the message is displayed. I also don't have enough background knowledge to know how to implement your solution there. Can you help me with that?
More questions.
2. Isn't the override dangerous because, if I have understood correctly, the original files are no longer accessed and any updates to the Joomla core no longer take effect?
3. In that sense, overring is more of a testing thing. The better long-term solution seems to me to be modifying the Joomla core.
- Webdongle
- Joomla! Master
- Posts: 44750
- Joined: Sat Apr 05, 2008 9:58 pm
Re: expand COM_CONTENT_SAVE_SUCCESS="Article saved."
Searching it in language override might show you the file and location?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Apprentice
- Posts: 19
- Joined: Sun Jun 27, 2010 10:42 am
Re: expand COM_CONTENT_SAVE_SUCCESS="Article saved."
... sorry I tried it in "language override" for every "site/administrator" and all languages (GB/DE) with no success.
- Webdongle
- Joomla! Master
- Posts: 44750
- Joined: Sat Apr 05, 2008 9:58 pm
Re: expand COM_CONTENT_SAVE_SUCCESS="Article saved."
You do not have the required permissions to view the files attached to this post.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Apprentice
- Posts: 19
- Joined: Sun Jun 27, 2010 10:42 am
Re: expand COM_CONTENT_SAVE_SUCCESS="Article saved."
... that is easy, the language-file isn't the problem.
I'm looking for the php-file, from which the display happens.
I'm looking for the php-file, from which the display happens.
-
- Joomla! Apprentice
- Posts: 19
- Joined: Sun Jun 27, 2010 10:42 am
Re: expand COM_CONTENT_SAVE_SUCCESS="Article saved."
Hello SharkyKZ,SharkyKZ wrote: ↑Tue Sep 24, 2024 8:28 am ....
foreach ($messages as $k => $message)
{
// Match and replace the message in question.
if ($message['message'] === $app->getLanguage()->_('COM_CONTENT_SAVE_SUCCESS'))
{
$message['message'] = $app->getLanguage()->_(sprintf('PLG_SYSTEM_EXAMPLE_SAVE_SUCCESS', $timestamp));
}
// Repopulate the message queue.
$app->enqueueMessage($message['message'], $message['type']);
}[/code]...
I want to inform you, that I now have a little Plugin running, that does the job.
I thank You for the code, because it is a central part of my plugin.
The output is now like this:
Advertisement