MessageAfterPosting

Summary:Provide a message to users after posting and /or prompt them to notify relevant people
Version:
Prerequisites:PmWiki 2.1.beta33 or above
Status:
Maintainer:

Questions answered by this recipe

  • How can I provide a message to users after posting but keep them on the same page?
  • How can I prompt users to notify relevant people after updating the wiki?

Description

This recipe adds a new action 'notify' which is activated after posting and can be used for inclusion of a AllGroupHeader to give the user a message, which can be a prompt to email.

Add the following to your config.php:

if (@$_POST['diffclass'] != 'minor') $EditRedirectFmt = '{$Group}.{$Name}?action=notify';
if ($action=='notify') $FmtPV['$notify'] = "'true'";
$GroupHeaderFmt = '(:include $SiteGroup.AllGroupHeader:)(:nl:)'
                 .'(:include $Group.GroupHeader:)(:nl:)';

And then add the following to Site.AllGroupHeader

(:if equal {$notify} true:)Your Message(:ifend:)

Prompt User to let relevant people know

In my AllGroupHeader I have, as my message:

%center background-color:#EEE8CD border:"solid #cccccc 1px" padding:3px% [+@@Thank you for your edit.  Please '''[[mailto:<address>?subject={*$Group}: {*$Namespaced} on the Wiki has been updated&body=I have updated http://www.example.com/wiki/{*$Group}/{*$Name} on the wiki, please take a look at it.   Thanks, {$Author}|inform relevant people]]''' that you have updated the wiki.@@+]

Thank you for your edit. Please inform relevant people -> mailto:<address>?subject=Cookbook:%20Message%20After%20Posting%20on%20the%20Wiki%20has%20been%20updated&body=I%20have%20updated%20http://www [period] example [period] com/wiki/Cookbook/MessageAfterPosting%20on%20the%20wiki,%20please%20take%20a%20look%20at%20it.%20%20%20Thanks, that you have updated the wiki.

The email link creates a prewritten email message for the user to send - so it functions as an reminder to optionally send an email notification that the wiki has been updated - to whoever the user chooses - allowing the user to exercise discretion that PmWiki:Notify does not allow.

Notes

The message does not appear after minor edits. To disable this, remove the if ( @$_POST['diffclass'] != 'minor' ) statement from config.php

You could use Cookbook:Mailform2 in your AllGroupHeader if you don't want to rely on the users email client being set up right - and to restrict the flexibility of the email more.

This recipe is completely separate from PmWiki:Notify and there is no reason they couldn't be used together.

Release Notes

There is probably a neater way to do the conditional markup and the notify variable - you could define a new Cookbook/ConditionalMarkupSamples and then use (:if action notify:) which is slightly neater. Feel free to improve it if you like. I was happy with this which worked for me.

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See Also

Contributors

Francis

Comments

See Discussion at MessageAfterPosting-Talk