05
Days
23
Hours
59
Minutes
59
Seconds


How to retrieve the owner email when using a custom form

When using a custom form built in RSForm!Pro you can easily retrieve the email address of the event owner though custom scripting. You will need to:

  • add a hidden field to your form where the email will be stored;
  • in the Default Value property of the field add the following code:
//<code>
$eventId = Joomla\CMS\Factory::getApplication()->input->getInt('id');

$db = Joomla\CMS\Factory::getDBO();
$query = "SELECT `owner` FROM #__rseventspro_events WHERE `id`=".$eventId." ";
$db->setQuery($query);
$ownerId = $db->loadResult();

$query2 = "SELECT `email` FROM #__users WHERE `id`=".$ownerId." ";
$db->setQuery($query2);
$owner = $db->loadResult();
return $owner;
//</code>

You will then be able to use the email through the hidden field's placeholder.


One person found this article helpful.


Was this article helpful?

Yes No
Sorry about that