1

I have an "abuse" flag and I want users to be able to flag abusive users via e-mail. I have been consulting the documentation for adding flag links to pages.

Problem No. 1: I can't get the link to generate properly in the message. My code, placed in the Message field of the rules Send mail action, looks like this:

REPORT ABUSE:
<?php
$account = $node->uid;
print flag_create_link('abuse', $account); ?>

The $node variable is provided for PHP evaluation by the rules module itself. I checked the value of $node->uid by printing it out and it is printing the correct UID value.

However, this generates a link that looks like this: flag/flag/abuse/6?destination=node/add/ad-reply%3Ffield_reply_orig_node%3D7&amp;token=EYchAT6nusUXcMtnoLwA2vrGb5bphDX0oGQmjBV3LC4

And gives the error:

Bad token. You seem to have followed an invalid link.

How can I print a flag link in the e-mail?

Problem No. 2: E-mails are sent in plaintext, but flag_create_link() generates an HTML link. At worst, I can live with this.

3
  • Hi Patrick, were you able find any solution for this? I have a very similar problem. I've posted my question at drupal.stackexchange.com/questions/95289/…
    – Elin Y.
    Commented Nov 25, 2013 at 9:30
  • @ЕлинЙ. No luck yet, unfortunately. Commented Nov 25, 2013 at 11:34
  • I've done it with a dirty workaround. I changed the link type to 'confirmation form', so that the link works without token. Then, I hardcoded the link in the mail template, like <a href="<?php print $base_url . base_path() . 'flag/confirm/flag/FLAG_NAME/' . $nid; ?>">Flag this node</a>
    – Elin Y.
    Commented Nov 26, 2013 at 6:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.