Needs work
Project:
Token
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Apr 2008 at 16:35 UTC
Updated:
15 Jun 2010 at 15:35 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
EmanueleQuinto commentedPatch for 6.x-1.x-dev.
Comment #2
merilainen commentedShould this show up in the "available tokens" list?
I'm trying to include the possible log-message in email using Messaging and Notifications modules.
For example:
This should print something like:
A Wikipage was updated in group "Development" with title "Problems"
Log message: "Changes in the listing order"
View page http://www.example.com/wiki/problems
Comment #3
EmanueleQuinto commentedIn our site we use something like this (and it works):
Comment #4
sdsheridanGreat little patch. Just one question, and sorry if this is the wrong place for it, but it appears that only user 1 on my site actually has the "log:" field displaying on nodes, and not the regular authenticated users. I've not figured out why yet, and wondering if anyone might know.
Drupal 5.16 is the version i'm using.
Thanks in advance, Shawn
Comment #5
merilainen commentedWhat is this [node:title] syntax? I've only seen [node-title] syntax and in the patch there is no token labeled [node:log].
Comment #6
sdsheridanRe #4, never mind... figured it out myself... revisions have to be on for the node type. Works like a charm now.
Thx, shawn
Comment #7
EmanueleQuinto commentedPatch still works for 6.x-1.x-dev (2009-Apr-21).
Comment #8
merilainen commentedI can confirm that the patch works nicely.
Now I just need to find a way to force users to write that log message, which is always forgotten.
Comment #9
gregglesI think check_plain is too aggressive of a filtering function. Core uses filter_xss for this: http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/node/node.pages.in...
Comment #10
EmanueleQuinto commentedUse filter_xss instead of check_plain
Comment #11
tobias commented+1 this is very helpful - thanks! hope this patch makes it into the module.
Comment #12
smithmb commentedSubscribing
Comment #13
dave reidLet's merge this with #383606: Would like additional tokens for (core) node revision information.
Comment #14
gregglesBut #383606: Would like additional tokens for (core) node revision information is newer and has no code. This at least has some code.
So, if you want to merge lets add revision author and revision timestamp as features in here.
Comment #15
dave reidThanks greggles. Sometimes I forget to check that.
Comment #16
dave reidSide note, these tokens are available if you have the Revisioning module.
Comment #17
dave reidWe'll need to provide this in D7 first and then backport since it's not provided by core in D7.
Comment #18
EmanueleQuinto commentedDear Dave, I understand the point, but I guess someone will use the d6 version for some time yet.
A backport would make sense once the drupal 7 will be out (and used in production site), while in the time being people will stay with d6 version of this module. I'll try to work on a d7 version but, as many others, I'm still working daily with d6.
Moreover is not clear to me one point: if part of token becomes part of the core and we need a new token, would this postponed to drupal 8 on the basis that new functionalities in core should be deferred to a new major version? We'll have to wait d8 to have log messages available as token? Four lines integrated in 2011 (to be optimistic)?
Did we need to add 4 lines below on node_tokens() function (modules/node/node.tokens.inc, line 96) to have a solution for d7. It's too late?
In the meantime the attached patch works for 6.x-1.12
Comment #19
dave reidIt would be added to token.module code here in the D7 version, not in D7 core. So it would not take long for someone just to make a patch here and I can commit it after review.
Comment #20
EmanueleQuinto commentedThis patch implements log token in D7 using the tokens hook in token.tokens.inc (at least I hope, looking in the code without much testing).
In drupal 8 this maybe will be included in node_tokens() function (modules/node/node.tokens.inc, line 96) but now is definitively too late.
Comment #21
dave reidThanks for working on this! :)
You're missing the 'else' condition on your ternary. Plus I bet this should be using check_plain():
$sanitize ? check_plain($node->log) ? $node->log;
Tabs or space mis-match on the 'break'; line.
Powered by Dreditor.
Comment #22
EmanueleQuinto commentedHere we are...
Attached you'll find 3 patch:
1) d7 with filter_xss
2) d7 with check_plain
3) d6 with check_plain
Patch with filter_xss for d6 is on #18.
Initial patch (#1) uses check_plain but greggles pointed out at #9 that "check_plain is too aggressive of a filtering function. Core uses filter_xss for this". And d7 HEAD still uses filter_xss.
Melius abundare quam deficere, so both version for d6 and d7 are there...
Changed the title reflecting the patch...
Comment #23
dave reidOk I just double-checked how $node->log is filtered in core and it does use filter_xss so we'd go with that. I should have done that before, sorry. :/
Comment #24
dave reidGreat, committed an updated version of the patch with tests to CVS for all D7, D6, and D5:
http://drupal.org/cvs?commit=376874
http://drupal.org/cvs?commit=376880
http://drupal.org/cvs?commit=376900
Comment #25
dave reidComment #26
technikh commentedI don't see these tokens in 7.x-1.5 version