Could be it's there and I just haven't found it. Is there a token available to, say the Subscription module that indicates the current WB moderation state?
Here's my use case. I don't think it's so odd, so it's entirely possible I've just missed the way to do it.
I have authors & editors and publishers. When an editor or publisher changes the state, I need an email sent to the editor, the publisher and the original author. The Subscriptions module seems perfect for this, except I can't seem to find the right token to indicate the current WB moderation state.
Thanks in advance, and thanks for the great work.
Comments
Comment #1
cvining commentedOK, I've hacked a *_tokens.inc file so that the WB moderation status is available as a token. I don't think if I've adhered to Best Drupal Practices as there are extra tokens there that aren't needed, but it does the job for me and I'm moving on. I thought I'd contribute it here in case anyone else wants the hack. Just drop the following file in place and clear the cache.
Thanks for all the fish!
-- Cronin
../sites/all/modules/workbench_moderation/workbench_moderation.tokens.inc
Comment #2
milesw commented@cvining Thanks for the code.
Here's a patch based on #1, but it adds tokens for both moderation state machine names and labels.
Comment #3
sgdev commented@milesw, thanks for creating a patch! I made a couple of adjustments to the version you posted:
- The tokens are now grouped into a "Workbench Moderation" option to make them easier to find, and to allow other tokens to be included in the same group.
- The
foreachinhook_tokenswas moved inside the conditional. The reason for doing so is$stateis undefined otherwise, which might throw some errors. If the$stateobject doesn't exist, no other processing is done.Review when you get a chance and let me know if you have any feedback.
Comment #4
capysara commentedApplied the patch and it worked for me! Thanks!
Comment #5
acbramley commentedNeeded this for 8.x-1.x so have hacked together a super simple patch.
Comment #6
sgdev commentedSorry to switch this back to 7.x, but given the new major release of 7.x-3.0, the patch needs to be reworked. #3 is no longer applicable.