Closed (outdated)
Project:
Forward
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
31 Aug 2013 at 14:57 UTC
Updated:
23 May 2020 at 15:23 UTC
Jump to comment: Most recent
Comments
Comment #1
john.oltman commentedThis would definitely be of interest. If you end up doing this, please ensure we don't lose the fields related to the logged in user. Just add new. On a related note, someone else mentioned Profile2 integration that might not be working. I assume you are referring to the old user profile that was deprecated in D7 but still part of core. Both are of interest.
Comment #2
glynster commentedHi thanks for the response. More than anything I was just talking about entity fields. So when using the forward a non node page or even better still setup a case for user profiles we could use tokens to pull in those fields. It is a special case but I think it would be a great one. Perhaps a new template forward--profile.php.tpl. This way we could directly input the fields we wish in there and the template would know what to print based on the UID etc.
We currently are not using Profile2. We just use the fields in general associated with the profiles.
Comment #3
glynster commentedWhere would I begin to setup the integration of tokens for this to work?
I mean the idea would be something like this:
[forward:user:field]
[forward:node:field]
[forward:taxonomy:field]
If we did it this way then whatever page is forwarded we can include these fields. Right now I can sent a user profile by using the
print $content;. The issue here is it sends everything and I want to control what fields are sent. I thought for a moment we could useprint ($user_profile['field_something']);but alas no luck.To be honest if we can be able to customize the tpl for pull it whatever user profile fields this will be perfect for our needs. We would not use this module for anything other than user profiles.
Any help or guidance would be greatly appreciated.
Comment #4
glynster commentedOK for anyone who is interested in this feature here is what we did:
Added the following code to the top of the forward.php.tpl
By doing this we were then able to pull in fields as needed but related to the link we were sharing
Worked a treat for us so hoping this can help for anyone else needing the same feature.
Comment #5
glynster commentedWhat do you think of my proposal at the end of the thread? This what we ended up implementing. I realize this is all related to the TPL but worked a treat for our needs.
Comment #6
nate covington commentedI'm trying to re-purpose the code from #4 to add node / CCK fields onto the forward.tpl.php template; having trouble. Here is the (mess of) code I've got:
In my testing, I've gotten the following text to output in my forwarded-email:
http://mysite.com/sites/default/files/styles/blog_thumb/public
(from the $new_image_url variable)
Which tells me that I've got it *partially* working, as it was able to indicate the correct folder / location... but I was never able to actually get it to spit out my image-file-name (e.g. thumbnail.png), just the path to the folder containing my image. Please let me know what I'm doing wrong?
Seems like part of this is a bit wonky, as it seems the $node variable in the template isn't the same $node variable used elsewhere in Drupal...?
Thanks!
-Nate
Comment #7
glynster commentedThis is what we used to pull in a user photo:
<a href="<?= url("user/".$account->uid, array('absolute' => TRUE)) ?>"><?php $thumbnail = theme('image_style', array('style_name' => 'image_style', 'path' => $account->picture->uri)); echo $thumbnail; ?></a>Comment #8
nate covington commentedglynster, it looks like part of your example code is missing? i took your code and this is what I tried, top of the forward.tpl.php file:
In the actual body of the email:
In testing, the email HTML spat this out:
Seems like we're close...?
Comment #9
glynster commentedHey there,
I forgot to wrap my example in code tags. Have a look above again and let me know if this works for you?
Comment #10
nate covington commentedNo luck, I am going to post my working code here:
https://drupal.org/node/2107769
Had to hack forward.module file... the $nid variable wasn't passing through to forward.tpl using your code example, so I generated my image URL in forward.module and passed it along to forward.tpl
Comment #11
john.oltman commentedThis is fixed in 8.x branch - use hook_forward_token. See the forward.api.php file for more info.
Comment #12
deanflory commentedNot sure why the version was changed if it was already fixed for D8.
Comment #13
john.oltman commentedI moved the version so anyone interested would know this has now been addressed in 8.x. But I see your point - if I have 7.x installed, and am looking for some code, I'd miss this if I had 7.x as a filter in my issue search. Moving back to original version.
Comment #14
john.oltman commented