Reviewed & tested by the community
Project:
Content Construction Kit (CCK)
Version:
6.x-2.x-dev
Component:
Token Integration
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
20 Jun 2008 at 15:25 UTC
Updated:
26 Aug 2013 at 09:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
asciikewl commentedComment #2
asciikewl commentedFor some reason the patch isn't attaching, lets try again
Comment #3
asciikewl commentedSigh, The attachments are landing up in attachment heaven. One last try and if that doesn't work, here is the diff as past of the comment (it is small enough):
Comment #4
gregglessubscribe.
@asciikewl - if you use the "attach" or preview buttons then the attachments disappear. If you just hit "post comment" they'll go through.
Comment #5
matt_paz commented+1 This is a great addition!
Comment #6
yched commentedOnly thing is that it requires a call to user_load() (which isn't cached). even if the token that is actually used doesn't need it. Do we want to go that route ?
Comment #7
gregglesWell - how about a straight query to get it.
I'm not sure how long user_load takes but I agree that we should be careful with making "expensive" tokens...
Comment #8
matt_paz commentedGood call.
Comment #9
asciikewl commentedHere it is with a query instead of the user_load. Is this still the right way to do it in D6?
Comment #10
dopry commentedhow does this patch handle multiple value user reference fields?
Comment #11
Anonymous (not verified) commentedI'd be interested in this if it in fact deal with multiple users.
Comment #12
B4n7o commentedsorry, how do i implement this code, do i make a new module and paste is, or add this to existing cade
Comment #13
clarkburbidge commentedI'd be interested in more information on how to use the user reference to gather custom profile information in addition to email. I'd love to see a generic query that I could use in the cck computed module. I also am interested in how a multi-select user field is treated.
Comment #14
smokrisThe above patch only tokenizes the first user in multi-user fields.
I've attached a new patch which concatenates email addresses (comma-separated), ready for use in an email Action for example. For the remaining fields, only the first user is tokenized.
Could this patch be reviewed for inclusion in cck?
Comment #15
Heilong commentedHi,
I applied the patch to cck and I got this output message :
Here is what I have in the .rej file :
The token "username-mail" which one I need is appearing but as I got failing messages I'm not sure i can use properly.
Comment #16
otsuarez commented@Heilong
the code do work, but since the code on the module had changed, you cannot apply the patch as it is.
this two lines (in the patch):
- $tokens['path'] = url('user/' . $item['uid']);
- $tokens['url'] = url('user/' . $item['uid'], array('absolute' => TRUE));
should be replace by this ones:
- $tokens['path'] = is_numeric($item['uid']) ? url('user/' . $item['uid']) : '';
- $tokens['url'] = is_numeric($item['uid']) ? url('user/' . $item['uid'], array('absolute' => TRUE)) : '';
so basically, you can use the code from the patch and either, create a new patch or just change the code.
regards,
osvaldo
Comment #17
markus_petrux commentedThis needs work, but since token module generates all possible values even when you may need just one, I think adding queries here to read the user mail will affect performance a lot, not to mention if this integration deals with multiple value userrefs.
So I would really say won't fix, and think about it in contrib, where this feature can be enabled or disabled on a per field basis.
Comment #18
gregglesNote that in 7.x tokens are generated on an as-needed basis so that is no longer a concern.
Note also that in 7.x there are not tokens for the cck fields in core, if anyone wants to work on that it would be great ;)
Comment #19
markus_petrux commentedRight, and I think token stuff in D7 is going to be backported to D6, so this issue could be awaken when that happens.
Comment #20
markus_petrux commentedHowever, I'm not really sure which is the issue in the Token module queue where this task is taking place. ¿?
Comment #21
tomsm commentedsubscribing
Comment #22
joetsuihk commentedA note for later comer:
as of cck 2.6, and if your user_reference only takes 1 user, #9 will work
as of cck 2.6, no matter how, user_reference token always returns first user token, which should be a bug, may refer to #15 for temp. solution.
in a way, i dont know why the development of this patch have to wait for D7...(D7 is out, we can throw D6 anyway)
Comment #23
my-family commentedsubscribe, I would appreciate the possibility of multiple users token (for Rules etc.) very much
Comment #24
ayalon commentedI have re-rolled this patch against the current version of cck.
This patch is very important for Issue / Task Management and rules. You will be able to send an email, if the assigned person has changed.
This patch is carefully tested on a live page and works well.
Please review it and commit the patch to the next release.
Comment #25
bitbaud commentedGreetings,
Can someone please tell me how to implement this patch? I haver never patched a module before.
I am using drupal 6 with CCK, tokens, and rules. I am trying to send an email to the mail addresses of mutiple users referenced by the user reference cck field. Thanks!
Clif
Comment #26
josefo@btinternet.com commentedHello,
How do I install this patch on my Drupal 6.16? Sorry for this simple question but I am quite new within using Drupal 6.16.
content.token_.inc-6x-1.13-referenced-mail.patch
Thank you.
Comment #27
gregglesPlease don't hijack issues. The answer to your question is easily found in the search: http://drupal.org/search/apachesolr_search/apply%20patch
Comment #28
mr.andrey commentedtested. works great.
Comment #29
marcp commentedThis patch still applies (with offsets), but I think the handling of multiple values belongs in a separate issue. I'd also rather see the
user_load()call than a separate SQL call -- in D7, at least,user_load()will cache user objects.But I guess what I'd really like to know is if this has any chance of getting into 6.x for CCK. It's similar to #800646: Nodereference author as token, and I think they both belong in CCK, but if there are performance concerns or other reasons why it makes sense to keep these out, then I'd be happy to create a separate "cck_reference_tokens" module where these things can live.
Any chance this (or a variant) would get into CCK 6.x?
Comment #30
marcp commentedAttached is a patch that applies cleanly to DRUPAL-6--2 but it has
user_load()and only gives you the email address of the first userreference (in the case of a multiple value userreference field).For dealing with multiple values, it seems like the Array Tokens module might be the place to go.
Note that you can apply the patch by putting it in your sites/all/modules/cck directory and running:
Comment #31
koleary commentedThis patch worked well for me. Thank you for your efforts!
Comment #32
radj commentedThis is for 6.x but I think this issue also needs to be in 7.x Fields. Is there an existing issue for 7.x? I can't find it, I always keep going back to this page.
Comment #33
Ndesign commentedhttps://drupal.org/node/2064381
Comment #34
rjs.martins commentedHi, i only have a question.
If i use the token that is created i want to know if:
The token contains only the email of the users that were selected in the referenced field?
Or
The token contains the email of all the users that exist in the referenced field, even if they were not selected?
Thanks!
Comment #35
rjs.martins commentedThe patch from #24 worked perfectly for me and it only sends email to the referenced users you select and that's what i wanted.
Thank you so much for this patch aylaon. :-)