CreditsBlock-Talk

Summary: Talk page for CreditsBlock.
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Comments

  • Should show "overflow" credits on a separate page.
  • Reads the page before any other code gets to it; it would be nice to figure out a way to "hook" into page display, so the file doesn't have to be read twice.
  • When the page history expires or is forced to expire, those authors are no longer credited.

Alternative implementation:
Instead of the scripts linked to above, you could just add the following to your config file:

function ContribList( $pagename, $level='read' ) {
	$page = RetrieveAuthPage( $pagename, $level, FALSE );
	$a = array();
	foreach ( $page as $k => $v ) if (!strncmp($k,'author:',7)) $a[] = $v;
	return implode(', ',array_unique(array_reverse($a)));
}
$FmtPV['$Contributors'] = 'ContribList("$group.$name")';

This will let you use the page variable {$Contributors} to include a comma-separated list of contributors, in chronological order. —Eemeli Aro June 05, 2009, at 09:40 AM

Bugs

(These are specific code failures for v0.3)

  • If you add a space to a page made by user A, the user that adds the space (user B) will now be the original maker of the page (A->B). (new to wiki, sorry for not know how to correctly report this)

the_CName I've this error when i install this CookBook :

=php Warning: creditmakecreditblock(/local/scripts/credits/language.php): failed to open stream: Aucun fichier ou répertoire de ce type in /space_3/linucie/www/doc2/cookbook/credits.php on line 75 Fatal error: creditmakecreditblock(): Failed opening required '/local/scripts/credits/language.php' (include_path='.:/space_3/:/php/includes:/usr/local/php4/lib/php/') in /space_3/linucie/www/doc2/cookbook/credits.php on line 75

I got the same error (although it was in english). I solved it by going into cookbook/credits.php and editing line 75.
This is what it says originally:
require_once($ScriptDir.'/local/scripts/credits/language.php');
I changed it to:
require_once($ScriptDir.'cookbook/credits/language.php');
It then worked properly
menachem January 20, 2005, at 04:12 PM

Update There are two credits.php files in the archive available for download.
One ends up in cookbook/ and has the problem mentioned above (line 75 of credits.php is messed up)
The second ends up in the /path/to/pmwiki/ directory (parallel to cookbook/).
Line 75 for that credits.php reads: require_once('cookbook/credits/language.php');
That credits.php doesn't give the error
-menachem January 21, 2005, at 03:03 AM

I solved the same problem on a farm installation with the following update:
function CreditMakeCreditBlock($pagename) {
global $FarmD, $ScriptDir, $DefaultGroup, $DefaultName;
require_once("$FarmD/cookbook/credits/language.php");

  • Also received this error. Ben: This is an excellent feature, and would be worth packaging up to make installation a little smoother. At the moment I had to give up. DaveG

The links generated for the usernames in the Credit Block were not properly formatted.
The link they generated ended up missing the Group that the profiles were stored in.
This is how it showed up in my wiki page: [(approve links) edit diff]
It looks like the [(approve links) edit diff] variable is not set by default. credits.php uses the $AuthorGroup variable to form the url. Therefore, if $AuthorGroup is not set, the link is not formatted correctly.
menachem January 21, 2005, at 03:03 AM

  • When the page history expires or is forced to expire, those authors are no longer credited.

→ Is it possible to fix this? When page history expires the changes that were made aren´t lost, but the credited authors are. Robert, January 21, 2005, at 12:23 PM CET

  • This is a great feature, I had one little problem though, the "Originally by" and "Last edited by" credits were backwards. Whoever created the page was credited as having last edited it, and vice versa. Corrected this by changing:

$first = array_shift($authors); # Original Author
$latest = array_pop($authors); # Last Contributer
to
$latest = array_shift($authors); # Original Author
$first = array_pop($authors); # Last Contributer
In both "credits.php" files. It seemed to work, though I'm not sure if there may be other problems with making that change, or even why it was neccessary in the first place (I'm not a coder). -JC, June 06, 2005

  • To get rid of output on pages with no real authors (like the RecentChanges pages), add

if (empty($authors)) return ''; after

     foreach ($page as $k => $v) {
		if (preg_match('/^author\:\d+/', $k)) {
            $authors[$k] = $v;
        }
     }

-DB October 31, 2005, at 01:57 AM

If I use this recipe (with the fix for the file in the cookbook directory, and reversing original author with last contributor, but without the no author fix), I lose the ability to log in to pages in my Secure group. Most of my wiki pages are @nopass for read. But I set Secure/GroupAttributes?action=attr to set read permissions to the same as edit, meaning you must log in to read Secure pages. If I edit any non-Secure wiki page before going to the Secure area, I'm fine. But if I'm not authenticated and I go to Secure, it only prompts for password and does not prompt for login. I tried the RequireAuthor recipe, but it didn't help. I tried turning off each recipe I've used, thankfully only a handful and I made a test wiki farm for it, and the only one I have to turn off is this one, so I know this is the culprit. I love the functionality of a credits block, but I keep getting critical tickets from users who want to go straight to the Secure group (via bookmark) and can't log in. (I'm using AuthUser['ldap'] so I don't have to manage user passwords thank goodness but that's exactly why I need the login prompt with the password prompt. I'm using $Author = $AuthId; too.) So, in summary, using this recipe causes read authorizations not to prompt for a login, while edit is fine and uses Site/AuthForm as it should. --nethope, 12/14/2007 16:28EDT

Talk page for the CreditsBlock recipe (users?).