is there an easy way to change the %inviter from username to another profile field [such as real name if such field is created in the profile table]?

I would be happy to provide a stipend for this code.

thnx

Comments

knseibert’s picture

Version: 4.7.x-1.4 » master
Assigned: Unassigned » knseibert
Status: Active » Needs review
StatusFileSize
new1.88 KB

Done :)
Added an additional field to the settings page in case profile.module is enabled.
This drop down menu exists of username (default) and all profile fields that are of type 'textfield'. Figured that multiline textfields or combo boxes would'nt work as inviter variable.

I have written this patch for version 5, but i think it also should work for 4.7 as well.
Feedback appreciated.

knseibert’s picture

No. It doesnt't work with 4.7. I'm working on it.

knseibert’s picture

StatusFileSize
new1.88 KB

Now it does. Patch for 4.7 attached.

p15650’s picture

That works perfectly in 4.7; didn't try 5.0

Thank you

smk-ka’s picture

Status: Needs review » Needs work

Please change 2 things:

  • Remove this line from the form item: '#extra' => $extra = 0,
  • Flip the quoting style for the query, that is, enclose the query in double quotes and the literal string in single quotes. The use of double quotes for literal strings is MySQL only! Ie. change WHERE type = "textfield" to WHERE type = 'textfield'.

Apart from these changes this patch looks good to me.
--
Stefan Kudwien
www.unleashedmind.com

knseibert’s picture

StatusFileSize
new1.85 KB

Thanks for your feedback.
Version 5.0 attached.

knseibert’s picture

StatusFileSize
new1.85 KB

Version 4.7

Tobias Maier’s picture

first of all, we dont use lines like // Feature from http://drupal.org/node/120248 in drupal.
Think about how this would mess up he code if we add this on every place...

A better solution instead of integrating yet another system for placeholder substitution is to use the token api
http://drupal.org/project/token

Integrate this and remove all overlapping, old variables in the invite module

Tobias Maier’s picture

Category: support » feature

category

knseibert’s picture

The comments were not meant to be published. Forgot to remove them.

smk-ka’s picture

@knseibert: I started looking at making a switch to token.module, just let me know if you're not doing the same...

knseibert’s picture

Nope. Not yet.

smk-ka’s picture

Title: change %inviter » Add token support (was: change %inviter)
Version: master » 5.x-1.x-dev
Assigned: knseibert » smk-ka
Status: Needs work » Needs review
StatusFileSize
new8.73 KB

This patch makes the switch to token.module.

Installation/Requirements:

  1. token version 1.6 with both patches from this issue applied.
  2. Patched invite-5.x-dev.
  3. Visit http://www.example.com/update.php to convert the old message tokens.
  4. Go to http://www.example.com/?q=admin/user/invite and play with the new tokens in the email subject and body templates.
  5. Report back :)

--
Stefan Kudwien
www.unleashedmind.com

smk-ka’s picture

Due to Token module maintainers failing either to commit the necessary patches for profile support or to communicate what's stopping them from doing so, and thus effectively blocking all development in this direction, I'm really wondering how we should proceed here.

In the past hours I've evaluated whether I could add the modified functions to Invite module, but this would result in copying half of token.module, which I surely do not want.

I am currently thinking about writing my own token replacement handler to avoid any dependency on token.module altogether, but still allowing full access to user, profile and invite-specific values.
--
Stefan Kudwien
unleashed mind

smk-ka’s picture

StatusFileSize
new9.74 KB

Re-rolled token support. This also fixes escaping of entities in invite emails.

smk-ka’s picture

StatusFileSize
new10.33 KB

Updated patch adds missing dependency information to .info file.

smk-ka’s picture

Status: Needs review » Fixed

Committed to DRUPAL-5. Remember to install token module first!
--
Stefan Kudwien
unleashed mind

Anonymous’s picture

Status: Fixed » Closed (fixed)