Implement request #3054906: Show user's full name instead of nickname

This commit is contained in:
Christian Weiske 2011-03-15 19:13:14 +01:00
parent 3e9e2154a6
commit 82ada0d75f
10 changed files with 63 additions and 9 deletions

View file

@ -30,7 +30,8 @@ window.onload = function() {
if(strlen($description['cdDatetime'])>0) {
echo T_('Last modification:').' '.$description['cdDatetime'].', ';
$lastUser = $userservice->getUser($description['uId']);
echo '<a href="'.createURL('profile', $lastUser['username']).'">'.$lastUser['username'].'</a>';
echo '<a href="'.createURL('profile', $lastUser['username']).'">'
. SemanticScuttle_Model_UserArray::getName($lastUser) . '</a>';
}
?>
</td>

View file

@ -309,7 +309,8 @@ if ($currenttag!= '') {
$copy .= T_('you');
} else {
$copy .= '<a href="' . createURL('bookmarks', $row['username']) . '">'
. $row['username'] . '</a>';
. SemanticScuttle_Model_UserArray::getName($row)
. '</a>';
}
// Udders!

View file

@ -18,7 +18,7 @@ if ($lastUsers && count($lastUsers) > 0) {
foreach ($lastUsers as $row) {
echo '<tr><td>';
echo '<a href="'.createURL('profile', $row['username']).'">';
echo $row['username'];
echo SemanticScuttle_Model_UserArray::getName($row);
echo '</a>';
echo ' (<a href="'.createURL('bookmarks', $row['username']).'">'.T_('bookmarks').'</a>)';
echo '</td></tr>';

View file

@ -20,7 +20,8 @@ window.onload = function() {
if(strlen($description['cdDatetime'])>0) {
echo T_('Last modification:').' '.$description['cdDatetime'].', ';
$lastUser = $userservice->getUser($description['uId']);
echo '<a href="'.createURL('profile', $lastUser['username']).'">'.$lastUser['username'].'</a>';
echo '<a href="' . createURL('profile', $lastUser['username']) . '">'
. SemanticScuttle_Model_UserArray::getName($lastUser) . '</a>';
}
?>
</td>

View file

@ -14,7 +14,14 @@ if ($users && count($users) > 0) {
<?php
$contents = '<';
foreach ($users as $row) {
echo '<li><strong>'.$row['username'].'</strong> (<a href="'.createURL('profile', $row['username']).'">'.T_('profile').'</a> '.T_('created in').' '.date('M Y',strtotime($row['uDatetime'])).') : <a href="'.createURL('bookmarks', $row['username']).'">'.T_('bookmarks').'</a></li>';
echo '<li><strong>'
. SemanticScuttle_Model_UserArray::getName($row) . '</strong>'
. ' (<a href="' . createURL('profile', $row['username']) . '">'
. T_('profile') . '</a> '
. T_('created in') . ' '
. date('M Y', strtotime($row['uDatetime'])) . ')'
. ' : <a href="' . createURL('bookmarks', $row['username']).'">'
. T_('bookmarks') . '</a></li>';
}
?>
</ul>

View file

@ -3,12 +3,13 @@ ChangeLog for SemantiScuttle
0.9X.X - 2010-XX-XX
-------------------
- Fix bug #3187177: Wrong URL / Export XML Bookmarks
- Fix bug in getTagsForBookmarks() that fetched all tags
- Show error message on mysqli connection errors
- Implement request #3054906: Show user's full name instead of nickname
- Implement patch #3059829: update FR_CA translation
- Show error message on mysqli connection errors
- Update php-gettext library to 1.0.10
- api/posts/add respects the "replace" parameter now
- Fix bug #3187177: Wrong URL / Export XML Bookmarks
0.97.2 - 2011-02-17

View file

@ -0,0 +1,41 @@
<?php
/**
* SemanticScuttle - your social bookmark manager.
*
* PHP version 5.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Christian Weiske <cweiske@cweiske.de>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
/**
* Mostly static methods that help working with a user row array from database.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Christian Weiske <cweiske@cweiske.de>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
class SemanticScuttle_Model_UserArray
{
/**
* Returns full user name as specified in the profile if it is set,
* otherwise the nickname/loginname is returned.
*
* @param array $row User row array from database
*
* @return string Full name or username
*/
public static function getName($row)
{
if (isset($row['name']) && $row['name']) {
return $row['name'];
}
return $row['username'];
}
}
?>

View file

@ -734,7 +734,8 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
if (SQL_LAYER == 'mysql4') {
$query_1 .= 'SQL_CALC_FOUND_ROWS ';
}
$query_1 .= 'B.*, U.'. $userservice->getFieldName('username');
$query_1 .= 'B.*, U.'. $userservice->getFieldName('username')
. ', U.name';
$query_2 = ' FROM '. $userservice->getTableName() .' AS U'
. ', '. $this->getTableName() .' AS B';

View file

@ -68,6 +68,7 @@ require_once 'SemanticScuttle/Service.php';
require_once 'SemanticScuttle/DbService.php';
require_once 'SemanticScuttle/Service/Factory.php';
require_once 'SemanticScuttle/functions.php';
require_once 'SemanticScuttle/Model/UserArray.php';
if (count($GLOBALS['serviceoverrides']) > 0
&& !defined('UNIT_TEST_MODE')

View file

@ -116,7 +116,7 @@ foreach ($bookmarks_tmp as $key => $row) {
'title' => $row['bTitle'],
'link' => $_link,
'description' => $row['bDescription'],
'creator' => $row['username'],
'creator' => SemanticScuttle_Model_UserArray::getName($row),
'pubdate' => $_pubdate,
'tags' => $row['tags']
);