Contact form 7 plugin wordpress - How to send email of filled values only - wordpress

I have a form that has some optional fields but if a user doesn't fill them out the label of the input will be sent in the email and they will be empty. so for example if a user doesn't enter a city field the email will say City:
Is there a way to set conditionals where if a user doesn't enter optional fields the label wont be sent?
http://wordpress.org/plugins/contact-form-7/

Short answer: yes, but.
Long answer: Wpcf7 has events for on send and others that you can hook into to extract and manipulate the data it has at the time. It's not a well documented aspect of the plug in, because it's really intended for the developer themselves to use, but you can write add_hook commands into your functions . php file and then use your own functions to change the output.
I think the send hook is called "wpcf7_send" so you can write a function like this:
function beforesend($obj) {
//manipulation of message here
}
add_hook('wpcf7_send', 'beforesend');
It's only a starting point but by exploring a bit you can find the hook names, and class structures you need.

Related

Shopware5 order confirmation email event

After a long investigation, I am not able to find the correct event to use JUST before the order confirmation email is sent.
I need to add a value in the s_order_attributes table which will be included in the email template.
I tried many events (e.g. checkout) but they are all triggered after the email ones.
thanks !
Looking at the code when the email is sent I assume there are two events you can try. You can either try Shopware_Modules_Order_SendMail_FilterVariables or sOrder::sendMail::before. These are executed right before the sending. If the attributes are not loaded from the database anymore in that moment you can set the public variables in sOrder to change the values that get into the mail. This might help you out as well but I prefer the FilterVariables event as it gives you direct access to the variables.

Is there any way to attach the current data (as a .csv file) in PloneFormGen to a mailer?

We use PloneFormGen 1.7.12 using Plone 4.3.3. I have a request to include the current data in the email that the form is sending. We normally give editors access to the data to download, but the people he wants to send these to are not editors and I don't want to give them editor's permissions.
If it can't be added to the mailer, I guess I could create a role and give it just enough permissions for an authenticated user to download data. Would it work to copy the authenticated permissions over to a new role and add the PloneFormGen: Download Saved Input permission as well? I really don't like creating extra roles. In addition we would need to set up accounts for these people.
AFAIK not without coding :-)
Create a new DataSaveAdapter content type
Best way ist to inherit from the existing one and add a new field:
from Products.PloneFormGen.content.saveDataAdapter import FormSaveDataAdapter
SendDataAdapterSchema = FormSaveDataAdapter.schema.copy() + atapi.Schema((
atapi.StringField(
name='csv_recipients',
required=False,
widget=atapi.LinesWidget(
label=_(u'label_csv_recipients', default=u'CSV recipients'),
)
)
))
class SendDataAdapter(FormSaveDataAdapter):
implements(IPloneFormGenActionAdapter)
...
schema = SendDataAdapterSchema
...
The SaveDataAdapter provides a onSuccess method, where you can hook in and send your email
class SendDataAdapter(FormSaveDataAdapter):
...
def onSuccess(self, fields, REQUEST=None, loopstop=False):
""" saves input data and initiates mail"""
super(SendDataAdapter, self).onSuccess(fields, REQUEST, loopstop)
self.send_csv() # This is where you may implement sending the email.
Of course it needs some work to get it done (registering content type, etc.), but this should point you in the right direction.
Not really sure about your requirements, but in case you want to send the single-record in CSV-format as a mail when a form is submitted, you can customize the template of the mailer-adapter, like this:
<tal:block repeat="field options/wrappedFields | nothing">
"<span tal:replace="structure python:field.htmlValue(request)" />",
</tal:block>
Note, that this only works, if the mail's format is HTML, in plain text tal:repeat comes in the way, adding linebreaks between the values.
If you want to give a group of users permissions to view and download a save-adapter, go to PFG's controlpanel (append /prefs_pfg_permits to the site's URL), where it says "Download Saved Input" check the box for "Reader", then assign "Can edit"-permissioins via the sharing-tab of your save-adapter to the users and groups you want to be privileged.

Google Form email notification

I'm looking to have the information submitted on a google form to be on the email notification that I receive. I have tried several things but I can't seem to get it to work. Any ideas?
Create a new form in Google Docs, if you haven’t done that yet, add the necessary fields to the form and save your changes. Now go back to Google Docs and open the spreadsheet corresponding to that particular form.
Choose Tools > Notification rules... and select the option that says Notify me when... A user submits a form. You can also set how frequently you would like to be notified – right away or with daily digest.
Reference: https://support.google.com/docs/answer/91588
To get the notification in your email, you can refer to the this Google add-on.
Also to enable the data or responses to appear in notification you have to enter a script in the form. which basically tries to extract the columns from the spreadsheet. Sample:
var p = SpreadsheetApp.getActiveSheet();
var column = p.getRange(1,1,1,s.getLastColumn()).getValues()[0];
I hope you build the script by yourself!

Post Data in Meteor router.go

How to send post data in meteor.go . I have tried parameters and query parameters to send the data but the data is displayed with the url .
Is there any way to send post data ?Currently i am using this
`Router.go('smsVerification', {mobile_no:options.mobile_no});
The short answer to this is that you can't use Iron Router, the Session variable, or a client-only Collection to accomplish this. An easy -- but inelegant -- way around this is to persist the data to the server. You can add a handler to whatever button or link sends the user to that page to store the data you want to store -- probably directly to the users Collection -- then read that data back out on the page they're being linked to. If you wanted to be really fancy about it you could add something that, when the user logs in or out, deletes this information.

Wordpress Plug-in - Trigger e-mail based on a specific date

I currently have a registration form for people to signup and pick a date for an "appointment". They get sent an e-mail right after filling it up with the details. I need another e-mail to be sent a day before their chosen date to remind them, but that can't be fulfilled by plugins I currently have.
Does anyone know of any Wordpress plug-in that allows the sending of an e-mail message (with a template and user specific data) based on a specified date?
Any piece of information or advice would be highly appreciated. Thanks!
How I would approach this would be with Wordpresses event scheduling. When a user submits the form to schedule their appointment, set a new action for the reminder email:
// Set this when you send the confirmation email
// Set the $unix_timestamp to be whenever you want the reminder to be sent.
// Args can be an array of the data you will need. Such as the users email/appt date
$args = array(
'email' => 'email#email.com'
);
wp_schedule_single_event($unix_timestamp, 'set_reminder', $args);
Now we have to catch that, and create a function to actually create and send the email (assuming you use a similar process):
add_action('set_reminder','do_reminder');
function do_reminder($args) {
// $email = $args['email'], etc.
// send reminder email.
}
I recommend Wysija Newsletters. You http://wordpress.org/extend/plugins/wysija-newsletters/. You can use template and user specific data in your email with this plugin.
If you are comfortable with writing your own code(I guess you are more or less ok with that), you can use the WordPress Schedule API(okay, maybe that's not the official name, but it works). Basically it's kind of a cron-job, but for WordPress. It has one downside though - it will only trigger on time, if WordPress is rendered(in other words accessed, so that it's code will execute). That can be easily fixed by adding a simple cron-job to your hosting account, that will simply access your home page every X hours.
You can find useful information on the API here.
Basically what you should have inside of your scheduled function is to get the records of people that should be sent reminder emails(you should probably store additional information about whether a reminder email has been sent or not) and send them the emails. I don't know what is the way you're storing the information from the registration form, but if you are using a Custom Post Type, then things should be pretty easy for you.

Resources