JackGoa
Member
Hi, i'm trying to create an unsubscribe page for users. What I thought would be simple, has now become a nightmare and I'm ready to go jump off a cliff.
I send out some automated emails. Up to now, I have had an emailto link in the mailers for unsubscribing.
So, I want to use placeholders, build a proper link with the email inserted in the URL, like, ?e=email@domain.com (apologies to the person that owns email@domain.com).
So, user lands on the page with a form (does not record in database) with one field, email. The field is prefilled with the email address from the parameter in the URL.
So, now back at my form, I'm adding the php plugin. onAfterProcess (also tried onBeforeProcess) is set, and this is my code:
I've tried variations of: sendg_email = $emailaddie, = '$emailaddie', etc etc, but nothing works.
So the I came across: $formModel->updateFormData('send_guide___interested', 'no') as per the info popup in Fabrik, but I need to set a condition to tell it which record to update as per the email address.
I'm fresh out of ideas? Am I using the plugin wrong? Am I going about it the wrong way?
I send out some automated emails. Up to now, I have had an emailto link in the mailers for unsubscribing.
So, I want to use placeholders, build a proper link with the email inserted in the URL, like, ?e=email@domain.com (apologies to the person that owns email@domain.com).
So, user lands on the page with a form (does not record in database) with one field, email. The field is prefilled with the email address from the parameter in the URL.
So, now back at my form, I'm adding the php plugin. onAfterProcess (also tried onBeforeProcess) is set, and this is my code:
PHP:
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$emailaddie = {___email};
$query = "UPDATE send_guide SET interested = 'no' WHERE sendg_email = '.$emailaddie.'";
$db->setQuery($query);
$result = $db->execute();
I've tried variations of: sendg_email = $emailaddie, = '$emailaddie', etc etc, but nothing works.
So the I came across: $formModel->updateFormData('send_guide___interested', 'no') as per the info popup in Fabrik, but I need to set a condition to tell it which record to update as per the email address.
I'm fresh out of ideas? Am I using the plugin wrong? Am I going about it the wrong way?