Hi folks,
I need to redirect to /contact on submit for a particular content-type. I need the form populated with the node title and absolute URL from the node just created.
Can anyone help me get started on how to approach this?
Thanks in advance,
Shai Gluskin
you need to alter the form and then while node submit as well need to set the url whatever you want to do.
On Sat, Feb 23, 2013 at 9:22 PM, Shai Gluskin shai@content2zero.com wrote:
Hi folks,
I need to redirect to /contact on submit for a particular content-type. I need the form populated with the node title and absolute URL from the node just created.
Can anyone help me get started on how to approach this?
Thanks in advance,
Shai Gluskin
[ Drupal support list | http://lists.drupal.org/ ]
You can also do this with the rules module. On Feb 23, 2013 11:50 AM, "Anand" ananditcrs@gmail.com wrote:
you need to alter the form and then while node submit as well need to set the url whatever you want to do.
On Sat, Feb 23, 2013 at 9:22 PM, Shai Gluskin shai@content2zero.comwrote:
Hi folks,
I need to redirect to /contact on submit for a particular content-type. I need the form populated with the node title and absolute URL from the node just created.
Can anyone help me get started on how to approach this?
Thanks in advance,
Shai Gluskin
[ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
Thanks,
Ok, Rules looks good, but How do you do the prepopulate part of the contact form?
Shai
On Feb 23, 2013, at 1:54 PM, Steve Kessler skessler@denverdataman.com wrote:
You can also do this with the rules module.
On Feb 23, 2013 11:50 AM, "Anand" ananditcrs@gmail.com wrote:
you need to alter the form and then while node submit as well need to set the url whatever you want to do.
On Sat, Feb 23, 2013 at 9:22 PM, Shai Gluskin shai@content2zero.com wrote:
Hi folks,
I need to redirect to /contact on submit for a particular content-type. I need the form populated with the node title and absolute URL from the node just created.
Can anyone help me get started on how to approach this?
Thanks in advance,
Shai Gluskin
[ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
Sorry I missed that. To pre-populate the contact form you need to write a form alter hook. http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook...
On Sat, Feb 23, 2013 at 12:13 PM, Shai Gluskin shai@content2zero.comwrote:
Thanks,
Ok, Rules looks good, but How do you do the prepopulate part of the contact form?
Shai
On Feb 23, 2013, at 1:54 PM, Steve Kessler skessler@denverdataman.com wrote:
You can also do this with the rules module. On Feb 23, 2013 11:50 AM, "Anand" ananditcrs@gmail.com wrote:
you need to alter the form and then while node submit as well need to set the url whatever you want to do.
On Sat, Feb 23, 2013 at 9:22 PM, Shai Gluskin shai@content2zero.comwrote:
Hi folks,
I need to redirect to /contact on submit for a particular content-type. I need the form populated with the node title and absolute URL from the node just created.
Can anyone help me get started on how to approach this?
Thanks in advance,
Shai Gluskin
[ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
{ "rules_service_ready_for_preliminary_review" : { "LABEL" : "Service Ready for Preliminary Review", "PLUGIN" : "reaction rule", "TAGS" : [ "email", "service" ], "REQUIRES" : [ "workflow_rules", "rules" ], "ON" : [ "workflow_state_changed" ], "IF" : [ { "workflow_check_transition" : { "node" : [ "node" ], "old_state" : { "value" : { "ANY" : "ANY" } }, "new_state" : { "value" : { "3" : "3" } } } } ], "DO" : [ { "mail_to_users_of_role" : { "roles" : { "value" : { "5" : "5" } }, "subject" : "Service Ready for Preliminary Review", "message" : "This Service is ready for your Preliminary Review: \u003Ca href=\u0022[node:url]\u0022\u003E[node:title]\u003C/a\u003E" } } ] } } Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: Shai Gluskin
Ok, Rules looks good, but How do you do the prepopulate part of the contact form?
Where does this code go? On Feb 23, 2013 2:34 PM, "Ms. Nancy Wichmann" nan_wich@bellsouth.net wrote:
{ "rules_service_ready_for_preliminary_review" : { "LABEL" : "Service Ready for Preliminary Review", "PLUGIN" : "reaction rule", "TAGS" : [ "email", "service" ], "REQUIRES" : [ "workflow_rules", "rules" ], "ON" : [ "workflow_state_changed" ], "IF" : [ { "workflow_check_transition" : { "node" : [ "node" ], "old_state" : { "value" : { "ANY" : "ANY" } }, "new_state" : { "value" : { "3" : "3" } } } } ], "DO" : [ { "mail_to_users_of_role" : { "roles" : { "value" : { "5" : "5" } }, "subject" : "Service Ready for Preliminary Review", "message" : "This Service is ready for your Preliminary Review: \u003Ca href=\u0022[node:url]\u0022\u003E[node:title]\u003C/a\u003E" } } ] } }
*Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
*From:* Shai Gluskin
Ok, Rules looks good, but How do you do the prepopulate part of the contact form?
-- [ Drupal support list | http://lists.drupal.org/ ]
This is an exported rule, so it needs to be imported.
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: Steve Kessler
Where does this code go? On Feb 23, 2013 2:34 PM, "Ms. Nancy Wichmann" nan_wich@bellsouth.net wrote:
{ "rules_service_ready_for_preliminary_review" : {
"LABEL" : "Service Ready for Preliminary Review", "PLUGIN" : "reaction rule", "TAGS" : [ "email", "service" ], "REQUIRES" : [ "workflow_rules", "rules" ], "ON" : [ "workflow_state_changed" ], "IF" : [ { "workflow_check_transition" : { "node" : [ "node" ], "old_state" : { "value" : { "ANY" : "ANY" } }, "new_state" : { "value" : { "3" : "3" } } } }
],
"DO" : [ { "mail_to_users_of_role" : { "roles" : { "value" : { "5" : "5" } }, "subject" : "Service Ready for Preliminary Review", "message" : "This Service is ready for your Preliminary Review: \u003Ca href=\u0022[node:url]\u0022\u003E[node:title]\u003C/a\u003E" } } ] } }
Nancy, Steve, and All,
Thanks much, Nancy.
For those looking at Nancy's export, note that it requires another module in addition to rules: workflow. So you couldn't just import that rule at all unless the workflow module was installed.
Also note that what it is trying to do is different from what I was asking.
I've got my functionality working! Hurray, with your help!
First let me explain that I changed my requirements after pondering the power of the Rules module. Instead of prepopulating the contact form, Rules sends the email on its own.
I added a field to the "resources" content type whose machine name is field-announce-resource. It's a numeric integer list type. The two choices I've set are: 0|No 1|Yes
In the rule, I added a condition to check to see if the value of that field is "1". If it is, then the email goes out, if not, then it doesn't.
Here is the help text I added on the Announce field:
If you choose "Yes," an email will be sent from you and signed by you to
listserve@example.com. It will include the title and URL of this resource. The email will successfully post to the listserve only if your account email here on example.com and your subscription email to the listserve are the same.
I had originally wanted the person posting the resource to be able to customize the outgoing email, but I decided an email would be better.
Here is the text for the automated email, which is put in via the rules UI:
Folks,
I have just posted a new resource at example.com: [node:title]
Check it out at: [node:url]
[node:author]
One thing I was very please about was setting up the from address of the email. I used:
[node:author] <[node:author:mail]>
which produces a well formed from Email address with the full name and email address. (Note that on the site in question the username is always the persons full name.) Using the Rules' "data selection" tool you can only select one value, so you would have to use: [node:author:mail]. Using the "direct input" method I could get the "from" field to be exactly as I wanted it.
Rules is amazing. There is some learning curve, but it is worth it.
What follows below is my rule exported. In order to properly import on your site (and of course you can change it using the rules UI after you've imported it), you need to have a content type called "resource" it needs to have a field whose machine name is "field-announce-resource" which is a numeric field where "1" means "send the email".
Thanks everyone for all the help.
Shai
{ "rules_post_to_listserve_about_new_resource" : { "LABEL" : "Post to listserve about new resource", "PLUGIN" : "reaction rule", "TAGS" : [ "email", "resources" ], "REQUIRES" : [ "rules" ], "ON" : [ "node_insert" ], "IF" : [ { "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "resource" : "resource" } } } }, { "data_is" : { "data" : [ "node:field-announce-resource" ], "value" : "1" } } ], "DO" : [ { "mail" : { "to" : "listserve@example.com", "subject" : "New Resource at Example.com", "message" : "Folks,\u000D\u000A\u000D\u000AI have just posted a new resource at example.com called: [node:title]\u000D\u000A\u000D\u000ACheck it out at: [node:url]\u000D\u000A\u000D\u000A[node:author]\u000D\u000A\u000D\u000A", "from" : "[node:author] \u003C[node:author:mail]\u003E", "language" : [ "" ] } } ] }
Shai,
I just took a very similar case a step further by letting the user add "email text" and then I use that token as well. This would let you have people use some of there own text.
-Steve On Feb 24, 2013 12:32 PM, "Shai Gluskin" shai@content2zero.com wrote:
Nancy, Steve, and All,
Thanks much, Nancy.
For those looking at Nancy's export, note that it requires another module in addition to rules: workflow. So you couldn't just import that rule at all unless the workflow module was installed.
Also note that what it is trying to do is different from what I was asking.
I've got my functionality working! Hurray, with your help!
First let me explain that I changed my requirements after pondering the power of the Rules module. Instead of prepopulating the contact form, Rules sends the email on its own.
I added a field to the "resources" content type whose machine name is field-announce-resource. It's a numeric integer list type. The two choices I've set are: 0|No 1|Yes
In the rule, I added a condition to check to see if the value of that field is "1". If it is, then the email goes out, if not, then it doesn't.
Here is the help text I added on the Announce field:
If you choose "Yes," an email will be sent from you and signed by you to
listserve@example.com. It will include the title and URL of this resource. The email will successfully post to the listserve only if your account email here on example.com and your subscription email to the listserve are the same.
I had originally wanted the person posting the resource to be able to customize the outgoing email, but I decided an email would be better.
Here is the text for the automated email, which is put in via the rules UI:
Folks,
I have just posted a new resource at example.com: [node:title]
Check it out at: [node:url]
[node:author]
One thing I was very please about was setting up the from address of the email. I used:
[node:author] <[node:author:mail]>
which produces a well formed from Email address with the full name and email address. (Note that on the site in question the username is always the persons full name.) Using the Rules' "data selection" tool you can only select one value, so you would have to use: [node:author:mail]. Using the "direct input" method I could get the "from" field to be exactly as I wanted it.
Rules is amazing. There is some learning curve, but it is worth it.
What follows below is my rule exported. In order to properly import on your site (and of course you can change it using the rules UI after you've imported it), you need to have a content type called "resource" it needs to have a field whose machine name is "field-announce-resource" which is a numeric field where "1" means "send the email".
Thanks everyone for all the help.
Shai
{ "rules_post_to_listserve_about_new_resource" : { "LABEL" : "Post to listserve about new resource", "PLUGIN" : "reaction rule", "TAGS" : [ "email", "resources" ], "REQUIRES" : [ "rules" ], "ON" : [ "node_insert" ], "IF" : [ { "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "resource" : "resource" } } } }, { "data_is" : { "data" : [ "node:field-announce-resource" ], "value" : "1" } } ], "DO" : [ { "mail" : { "to" : "listserve@example.com", "subject" : "New Resource at Example.com", "message" : "Folks,\u000D\u000A\u000D\u000AI have just posted a new resource at example.com called: [node:title]\u000D\u000A\u000D\u000ACheck it out at: [node:url]\u000D\u000A\u000D\u000A[node:author]\u000D\u000A\u000D\u000A", "from" : "[node:author] \u003C[node:author:mail]\u003E", "language" : [ "" ] } } ] }
-- [ Drupal support list | http://lists.drupal.org/ ]
Steve and all,
Rules is powerful; The possibilities endless.
I actually considered precisely what you did. But I rejected it, at least for now, because it's yet one more demand on the person filling out the form. Even as an optional field it's another decision they have to make.
I thought we'd get more people actually submitting the resource and choosing to announce it via the listserve without the custom text in the email. Just my hunch though. Certainly don't to do legitimate testing on that issue.
Shai
On Feb 24, 2013, at 3:08 PM, Steve Kessler skessler@denverdataman.com wrote:
Shai,
I just took a very similar case a step further by letting the user add "email text" and then I use that token as well. This would let you have people use some of there own text.
-Steve
On Feb 24, 2013 12:32 PM, "Shai Gluskin" shai@content2zero.com wrote:
Nancy, Steve, and All,
Thanks much, Nancy.
For those looking at Nancy's export, note that it requires another module in addition to rules: workflow. So you couldn't just import that rule at all unless the workflow module was installed.
Also note that what it is trying to do is different from what I was asking.
I've got my functionality working! Hurray, with your help!
First let me explain that I changed my requirements after pondering the power of the Rules module. Instead of prepopulating the contact form, Rules sends the email on its own.
I added a field to the "resources" content type whose machine name is field-announce-resource. It's a numeric integer list type. The two choices I've set are: 0|No 1|Yes
In the rule, I added a condition to check to see if the value of that field is "1". If it is, then the email goes out, if not, then it doesn't.
Here is the help text I added on the Announce field:
If you choose "Yes," an email will be sent from you and signed by you to listserve@example.com. It will include the title and URL of this resource. The email will successfully post to the listserve only if your account email here on example.com and your subscription email to the listserve are the same.
I had originally wanted the person posting the resource to be able to customize the outgoing email, but I decided an email would be better.
Here is the text for the automated email, which is put in via the rules UI:
Folks,
I have just posted a new resource at example.com: [node:title]
Check it out at: [node:url]
[node:author]
One thing I was very please about was setting up the from address of the email. I used:
[node:author] <[node:author:mail]>
which produces a well formed from Email address with the full name and email address. (Note that on the site in question the username is always the persons full name.) Using the Rules' "data selection" tool you can only select one value, so you would have to use: [node:author:mail]. Using the "direct input" method I could get the "from" field to be exactly as I wanted it.
Rules is amazing. There is some learning curve, but it is worth it.
What follows below is my rule exported. In order to properly import on your site (and of course you can change it using the rules UI after you've imported it), you need to have a content type called "resource" it needs to have a field whose machine name is "field-announce-resource" which is a numeric field where "1" means "send the email".
Thanks everyone for all the help.
Shai
{ "rules_post_to_listserve_about_new_resource" : { "LABEL" : "Post to listserve about new resource", "PLUGIN" : "reaction rule", "TAGS" : [ "email", "resources" ], "REQUIRES" : [ "rules" ], "ON" : [ "node_insert" ], "IF" : [ { "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "resource" : "resource" } } } }, { "data_is" : { "data" : [ "node:field-announce-resource" ], "value" : "1" } } ], "DO" : [ { "mail" : { "to" : "listserve@example.com", "subject" : "New Resource at Example.com", "message" : "Folks,\u000D\u000A\u000D\u000AI have just posted a new resource at example.com called: [node:title]\u000D\u000A\u000D\u000ACheck it out at: [node:url]\u000D\u000A\u000D\u000A[node:author]\u000D\u000A\u000D\u000A", "from" : "[node:author] \u003C[node:author:mail]\u003E", "language" : [ "" ] } } ] }
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]