Scenario:
I have a table (view) of node titles, each with a "Flag me!"-link. There's a webform node attached at the bottom of the page. Would it be possible to let Webform know which of the articles on the page are flagged, and collect these titles?

Comments

quicksketch’s picture

It depends on what you mean by "let Webform know". What is it you want Webform to do when content is flagged?

perandre’s picture

I would love for webform to register the flagged node titles and include them in the email (with the rest of the fields). Any ideas?

quicksketch’s picture

Including Flagged data in the e-mail can be done fairly easily through theming the e-mails. Copy 'webform-mail.tpl.php' to your theme, clear your Drupal cache, then add whatever extra information you want.

perandre’s picture

Oh! For anonymous users, too? How would Webform know that it should send flag data from this particular page?

quicksketch’s picture

You can determine if a user is anonymous or not (while they filled out the form) by checking the global $user variable when the e-mail is sent. Webform runs all mails through the theme system individually, whether the user is anonymous or registered.

if ($GLOBALS['user']->uid) {
  print 'Information only for registered users';
}

You can determine what flagged information needs to be shown in the e-mail by checking the $node variable within webform-mail.tpl.php (which is the fully loaded Webform node).

perandre’s picture

Thanks a bunch! Looking forward to testing!

quicksketch’s picture

Status: Active » Closed (fixed)