NP_CommentRealName.php

This plugin, used in a comment template, displays the commenter's Real Name assuming the commenter is a member, and the display name if the commenter is not a member. Can also display the userlink.

General Plugin info
Author: Joel Pan
Current Version: 1.0
Download: -
Code: code
Demo: -
Forum Thread: Thread 28818

Usage

<%CommentRealName%> (displays real name)
<%CommentRealName(true)%> (displays userlink)

Code

<?php
 
if (!function_exists('sql_table'))
{
  function sql_table($name) {
    return 'nucleus_' . $name;
  }
}
 
class NP_CommentRealName extends NucleusPlugin {
 
  function getName() { return 'Comment Real Name'; }
  function getAuthor() { return 'Joel Pan'; }
  function getURL() { return 'http://wakka.xiffy.nl/CommentRealName'; }
  function getVersion() { return '1.0'; }
  function getDescription() { return 'Use <%CommentRealName%> in a comment template to show the commenter\'s real name. Use <%CommentRealName(true)%> to generate the userlink for the member.'; }
 
  function supportsFeature($what) {
    switch($what) {
      case 'SqlTablePrefix':
        return 1;
      default:
        return 0;
    }
  }
 
  function doTemplateCommentsVar(&$item, &$comment, $link) {
    if ($comment['memberid'] == 0) print($comment['user']);
    else {
      $member = mysql_fetch_assoc(mysql_query("SELECT mrealname FROM " . sql_table('member') . " WHERE mnumber = " . $comment['memberid']));
      $realname = $member['mrealname'];
    }
    if ($link) {
      print("<a href=\"?memberid=" . $comment['memberid'] . "\">$realname</a>");
    }
    else print($realname);
	}
 
}
?>

Plugin review

NP_CommentRealName version 1.0 works with Nucleus CMS version 3.31 - 2007-10-30 ftruscot

commentrealname.txt · Last modified: 2007/10/31 05:05 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki