AddSignature

Summary: Insert markup for a stylized signature
Version: 20150802
Prerequisites: $EnableGUIButtons
Status: Beta
Maintainer: RandyB
License: GPL2+
Users: +1 (view / edit)
Discussion: AddSignature-Talk?

Questions answered by this recipe

Q. How do I provide an easy way for authors to sign their postings?
Q. How do I configure the style for signatures?

All sections are optional, you can remove those that do not apply to your recipe, and add new ones.

Description

A GUI edit button to insert markup to create a signature, whose style you can configure.

Installation

  • Make sure you have set $EnableGUIButtons = 1; in your configuration file (you will see GUI buttons at the top of your edit form)
  • Copy addsignature.phpΔ to your cookbook directory. (Note: the file should not end immediately after the final semi-colon - append a blank line if necessary.)
  • Copy the button picture fileΔ to your pmwiki/pub/guiedit directory.
  • Add to your configuration file lines such as:
# define styled signature to be 5 tildes (~)
  $ROSPatterns['/(?<!~)~~~~~(?!~)/']
    = "--[-''[[~$Author]] ".strftime('%B-%d-%Y at %I:%M %p',$Now).”''-]";
include_once("$FarmD/cookbook/addsignature.php”);

Configuration

You can set the styling of the signature in your configuration file. The recipe will still insert five tildes wherever the author clicks the button, but they will be replaced on save as you specify. For example:

  • If you just want the button to insert a simple unstyled signature:
    $ROSPatterns['/(?<!~)~~~~~(?!~)/']
        = "[[~$Author]] ".strftime('%B-%d-%Y at %I:%M %p',$Now);
    
  • If you are using Cookbook:Creole, you can specify double slashes instead of apostrophes for italics:
    $ROSPatterns['/(?<!~)~~~~~(?!~)/']
        = "--[-//[[~$Author]] ".strftime('%B-%d-%Y at %I:%M %p',$Now)."//-]";
    

You can also optionally specify the text that appears when the user hovers over the button. For example:

$AddSignatureTitle = 
"Add your signature: click to insert five tildes (~~~~~). They will be replaced 
when you save the page by markup that shows your signature + time";

Usage

1. Position your cursor to where you want to insert your stylized signature. For example:

My comment_

2. Then click the button above your edit box:
3. The source will now show:

My comment ~~~~~

4. When the page is saved the markup will become:

My comment [-‘’ -- [[~YourName]]’’-]

5. When the page is shown, it will look like:

My comment -- RandyB August 02, 2015, at 10:52 AM

Notes

  • To turn off replace on save patterns for pages such as templates, see Cookbook:ROSPatterns
  • Five tildes will be replaced on save as a stylized signature (even if they weren't inserted by pressing the button)

Change log / Release notes

  • 20150802 - first public release, ready to be tested.

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

Recipe written by RandyB

Comments

See discussion at AddSignature-Talk?

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.