Hi Ron
You need the email to be sent to User which is logged in ?
in this case you should use {user:email} in the Email action Recipients
if however, you need to send to the article author's email then you need to get the article info from the database then get the author's info then use their email address, let me know if this what you need and I will prepare the code for you
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi Ron
I have tested this code in a PHP action and it will return the author email which you can use as {var:php_action_name}
// Load Joomla's Factory class
use Joomla\CMS\Factory;
// Get the application object
$app = Factory::getApplication();
// Get the input object to retrieve the article ID from the URL
$input = $app->input;
// Check if we're in an article view and get the article ID
$option = $input->getCmd('option');
$view = $input->getCmd('view');
$articleId = null;
if ($option === 'com_content' && $view === 'article') {
$articleId = $input->getInt('id');
}
// If article ID is found, proceed to get the author's email
if ($articleId) {
// Get the database object
$db = Factory::getDbo();
// Create a query to get the article's created_by field
$query = $db->getQuery(true)
->select($db->quoteName('created_by'))
->from($db->quoteName('#__content'))
->where($db->quoteName('id') . ' = ' . (int)$articleId);
$db->setQuery($query);
$authorId = $db->loadResult();
// If author ID is found, get the author's email
if ($authorId) {
$user = Factory::getUser($authorId);
return $user->email;
}
}
return "";
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.