FriendlyAuthorLinks
Questions answered by this recipe
- How can I let authors change their names?
- I'm using an authentication system and
. How can authors use their own name whilst retaining the internal (unambiguous) designation (perhaps for accountability)?$Author
=$AuthId
;
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
, be it that or$Author
=$AuthId
;
or something else, before the include of$Author
= $LOOKUP_TABLE[$AuthId
];FriendlyAuthorLinks.php
. - Then, in Site.EditForm, replace
with
HomePage
to replace the Author input box with the author's chosen name (as the
value is unchangeable).$Author
Configuration
You can change
or $CurrentTime
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 inDone!?action=diff
.I do not know how to get the title of another page from PHP. wizzwizz4Solved.I do not think it possible to do this simply by changing$DiffStartFmt
. wizzwizz4
exists. :-)$FmtPV
For some reason,Still don't know why, but it doesn't happen any more. :-DResolvePageName
seems to trigger a redirect. I don't know why. wizzwizz4
Change log / Release notes
- 2018-01-01: Added page history support.
- 2017-12-28: Initial release.
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.