Contact the website admin using an RSForm!Pro form (+entry title)

"I want to send an email to the website's administrator containing a message and the entry's title, using RSForm!Pro. "
 

Implementing this type of scenario will require the use of template overrides, as well as a little bit of custom scripting. The process of adding the RSForm!Pro form to the entry pages (through template overrides) is the same as described in the article linked below:

Send an email to the entry's owner through an RSForm!Pro form
The custom PHP code

You will need to create a text area (called message) and a hidden field (called entry_title) which will be automatically completed with the entry's title by our custom PHP code. After creating the field, head to Components >> RSForm!Pro >> Manage Forms >> edit your form >> Components >> edit the entry_title hidden field and add the following code in the its Default Value property:

      //<code>
      $entry_id = JFactory::getApplication()->input->getInt('id'); //returns the entry's id from the URL
      $db = JFactory::getDBO(); //opens a new database connection
      $db->setQuery("SELECT `title` FROM #__rsdirectory_entries WHERE `id`='".$entry_id."' "); // gets the entry's title from the database
      $entry_title = $db->loadResult();
      return $entry_title; // assigns the entry's title as the field's default value
      //</code>

What you need to do now is configure the RSForm!Pro Admin Emails in Components >> RSForm!Pro >> Manage Forms >> edit your form >> Properties >> Admin Email by placing the website administrator's email in the To field and by adding, to the email's text, the {entry_title:value} placeholder (the value stored in the hidden field by the custom PHP script in order to transmit the entry's title) and the {message:value} placeholder (in order to add the message).

Configuring RSForm!Pro emails
 

Was this article helpful?

Yes No
Sorry about that

You Should Also Read

Send an email to the entry's owner through an RSForm!Pro form