I have an existing website with its own user-management which I am incorporating PmWiki into.
I am therefore using the ExternAuth recipe in PmWiki to handle my authentication. This works fine, allowing me to authenticate users based on session variables set by my existing user authentication system.
However, there is a single shortcoming: PmWiki will on several pages make links to user profile pages. E.g. when showing who edited pages.
I would like these links to instead of pointing to non-existing Wiki-pages of the form Profiles/UserName
to point back to my existing user profile pages.
Is there a way to change the way the PmWiki [[~UserName]]
links are rendered on the page to an "external" link like http://example.com/profiles/UserName
instead of the normal PmWiki behavior?
I think I figured it out for myself... The trick was to use the Markup command to define a markup that would change user-profile links at the same time as other "inline" markup to an external link. This link will then later in the markup-chain be converted to a real HTML link which will point externally.
// Set author information:
$AuthId = $_SESSION['userid'];
$Author = $_SESSION['name'] . ' (userid=' . $_SESSION['userid'] . ')';
// Change the way links to user profiles are shown:
$EnableAuthorSignature = 1; // Allow for ~~~ and ~~~~ markup
$AuthorLink = "[[http://{$_SERVER['SERVER_NAME']}/profiles/{$_SESSION['userid']} | {$_SESSION['name']}]]";
Markup("profilelinks", "inline", "/\[\[~(.*?)\s\(userid=(\d+)\)\]\]/", "[[http://{$_SERVER['SERVER_NAME']}/profiles/$2 | $1]]");
I'm not sure this is the most elegant solution, but it seems to work...