FriendlyAuthorLinks

Summary: Displays author page titles as link text for all automatic author links.
Version: 2017-12-28
Prerequisites: None
Status: Needs review
Maintainer: wizzwizz4
License: GNU GPL 3+
Categories: Links Markup
Users: (view? / edit)

Questions answered by this recipe

  • How can I let authors change their names?
  • I'm using an authentication system and $Author = $AuthId;. How can authors use their own name whilst retaining the internal (unambiguous) designation (perhaps for accountability)?

Description

Displays author page titles as link text for all automatic author links.

Installation

Add FriendlyAuthorLinks.phpΔ to your installation (as cookbook/FriendlyAuthorLinks.php) then add the following to your config.php:

include_once("$FarmD/cookbook/FriendlyAuthorLinks.php");

If you want a one-to-one correspondence between credentials and author names (usually for accountability or authorship rights):

  • Ensure that you have some form of $Author = $AuthId;, be it that or $Author = $LOOKUP_TABLE[$AuthId]; or something else, before the include of FriendlyAuthorLinks.php.
  • Then, in Site.EditForm, replace with HomePage to replace the Author input box with the author's chosen name (as the $Author value is unchangeable).

Configuration

You can change $CurrentTime or TimeFmt if you like, but make sure to do so before including this recipe. Note: this only affects ~~~~.

Usage

Just use as normal. The following are transparently changed:

  • Author links in RecentChanges
  • Author links in signatures.
  • Author names in page history (?action=diff).

Notes

PHP doesn't support namespaces, so I assumed that nobody else would use variables starting with $FriendlyAuthorLinks. If my assumption is incorrect... there still probably won't be problems. I've been over-cautious because I don't want to break anything.

To do

  • Show the Friendly Author Name in ?action=diff. Done!
    • I do not know how to get the title of another page from PHP. wizzwizz4 Solved.
    • I do not think it possible to do this simply by changing $DiffStartFmt. wizzwizz4 $FmtPV exists. :-)
    • For some reason, ResolvePageName seems to trigger a redirect. I don't know why. wizzwizz4 Still don't know why, but it doesn't happen any more. :-D

Change log / Release notes

  • 2018-01-01: Added page history support.
  • 2017-12-28: Initial release.

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".

Contributors

wizzwizz4 wrote most of it, but a substantial amount of that is boilerplate.
The signature functionality (~~~ and ~~~~) is derived from Pm's author.php.

Comments

See discussion at FriendlyAuthorLinks-Talk?

User notes? : 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.