AndyB
Well-known member
Hello,
I'm creating an add-on which I would like to add an 'export' function. The way I would like to make it work is to add the code to the ControllerPublic/NewsletterSubscribe.php file.
For example the admin will invoke the export function by adding the the word export after the route.
Example:
http://www.domain.com/newslettersubscribe/export
With this URL I would like my add-on to prepare the $results and have a download dialog box appear on the admins display where he can download the $results to his computer.
Currently i have the following:
library/Andy/NewsLetterSubscribe/ControllerPublic/NewletterSubscribe
What code do I need to add?
Thank you.
I'm creating an add-on which I would like to add an 'export' function. The way I would like to make it work is to add the code to the ControllerPublic/NewsletterSubscribe.php file.
For example the admin will invoke the export function by adding the the word export after the route.
Example:
http://www.domain.com/newslettersubscribe/export
With this URL I would like my add-on to prepare the $results and have a download dialog box appear on the admins display where he can download the $results to his computer.
Currently i have the following:
library/Andy/NewsLetterSubscribe/ControllerPublic/NewletterSubscribe
PHP:
public function actionExport()
{
// get permission
if (!XenForo_Visitor::getInstance()->hasPermission('newsletterSubscribeGID', 'newsletterSubscribeID'))
{
throw $this->getNoPermissionResponseException();
}
// get database
$db = XenForo_Application::get('db');
// get data
$results = $db->fetchCol("
SELECT email
FROM xf_newsletter_subscribe
ORDER BY email ASC
");
}
What code do I need to add?
Thank you.