Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

Bloge-UrlApprove

Summary:Approve links one at a time
Version:2009-08-10
Prerequisites: PmWiki 2.2.x
Status: beta
Maintainer: Eemeli Aro
Categories: Blog, Links

Description

This is a wrapper for PmWiki's default UrlApprovals that adds the possibility to approve links one at a time rather than all at once for a full page.

Bloge-UrlApprove is a part of Cookbook.Bloge, but may also be used as a standalone recipe.

To install this recipe:

  • download bloge-urlapprove.phpΔ to your cookbook directory
  • add the following line to your configuration file:
    include_once("$FarmD/cookbook/bloge-urlapprove.php");

Usage

Follow the instructions as on PmWiki.UrlApprovals, except for including this recipe instead of urlapprove.php as shown above. With Bloge-UrlApprove, the default value of $UnapprovedLinkFmt is also different:

SDV($UnapprovedLinkFmt, empty($AuthId)
  ? '$LinkText'
  : "<u>\$LinkText</u>
<a class='apprlink' rel='nofollow' href='\$LinkUrl' title='$[Unapproved link]'>($[test])</a>
<a class='apprlink' rel='nofollow' href='{\$PageUrl}?action=approvelink&link=\$LinkUrl' title='$[Approve link]'>($[url ok])</a>
<a class='apprlink' rel='nofollow' href='{\$PageUrl}?action=approvelinksite&link=\$LinkUrl' title='$[Approve site]'>($[site ok])</a>");

In other words, links are shown as text only if the user isn't logged in using AuthUser and if logged in, links are provided to test and approve the link. Set this as required in your configuration file before including the recipe.

Notes

A new page variable {$LinksToApprove} is also provided, containing the number of unapproved links on the current page. This includes links in sidebars and other page elements.

The default dependency on AuthUser is known, and may be fixed in a later release.

Release notes

See also

Contributors

Comments

This space is for User-contributed commentary and notes. Please include your name and a date (eg 2007-05-19) along with your comment. Optional alternative: create a new page with a name like "ThisRecipe-Talk" (e.g. PmCalendar-Talk).

Currently, I have a situation where the blog owner is the only one who has 'edit' permissions; comments from others are enabled, however. I am not using AuthUser, so getting links to work properly requires a bit more. I found part of the way around the problem was changing the way unapproved links are shown in bloge-urlapprove.php, so that 'edit' permissions were sufficent to approve URLs. I set:

SDV($UnapprovedLinkFmt, !CondAuth($pagename, 'edit')
        ? '$LinkText'
        : "<u>\$LinkText</u>
<a class='apprlink' rel='nofollow' href='\$LinkUrl' title='$[Unapproved link]'>($[test])</a>
<a class='apprlink' rel='nofollow' href='{\$PageUrl}?action=approvelink&link=\$LinkUrl' title='$[Approve link]'>($[url ok])</a>
<a class='apprlink' rel='nofollow' href='{\$PageUrl}?action=approvelinksite&link=\$LinkUrl' title='$[Approve site]'>($[site ok])</a>");

This is not a perfect solution: the blog owner still must approve each page she makes that has links in it, but it works for now. Just wanted to share that here.

--Peter Kay

User notes? : If you use, used or reviewed this recipe, you can add your name. The following format is recognized:
* (+) Optional positive comment. Name, date
* (-) Optional negative comment. Name, date

These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on May 23, 2010, at 06:37 PM