I have added a very simple and basic customization that adds a new tab to your profile that allows you to view the articles you've commented on. When viewing other people's profiles you will be able to see the stories they've commented on, too. Since my site is not open for public registration I'll have to show you a screen shot:
http://img20.imageshack.us/img20/275/untitleddb4.jpg
As you can see, the Administrator (me) has only commented on one article.
The following are the code changes needed to add this feature to your site.
In user_center.tpl here are what my tabs look like
PHP Code:
{if $user_view eq 'history'}
<h2>{$user_login} / <em>Submitted Articles</em></h2>
<hr style="margin-top:-12px;"/>
<div id="usertabs">
<ul id="nav">
<li><a href="{$user_url_personal_data}">{#PLIGG_Visual_User_PersonalData#}</a></li>
<li class="active"><a href="{$user_url_news_sent}">{#PLIGG_Visual_User_NewsSent#}</a></li>
<li><a href="{$user_url_news_published}">{#PLIGG_Visual_User_NewsPublished#}</a></li>
<li><a href="{$user_url_news_unpublished}">Articles voted on</a></li>
<li class="last"><a href="{$user_url_commented}">Articles commented on</a></li>
</ul>
</div>
{/if}
{if $user_view eq 'published'}
<h2>{$user_login} / <em>Published Articles</em></h2>
<hr style="margin-top:-12px;"/>
<div id="usertabs">
<ul id="nav">
<li><a href="{$user_url_personal_data}">{#PLIGG_Visual_User_PersonalData#}</a></li>
<li><a href="{$user_url_news_sent}">{#PLIGG_Visual_User_NewsSent#}</a></li>
<li class="active"><a href="{$user_url_news_published}">{#PLIGG_Visual_User_NewsPublished#}</a></li>
<li><a href="{$user_url_news_unpublished}">Articles voted on</a></li>
<li class="last"><a href="{$user_url_commented}">Articles commented on</a></li>
</ul>
</div>
{/if}
{if $user_view eq 'shaken'}
<h2>{$user_login} / <em>Articles Voted On</em></h2>
<hr style="margin-top:-12px;"/>
<div id="usertabs">
<ul id="nav">
<li><a href="{$user_url_personal_data}">{#PLIGG_Visual_User_PersonalData#}</a></li>
<li><a href="{$user_url_news_sent}">{#PLIGG_Visual_User_NewsSent#}</a></li>
<li><a href="{$user_url_news_published}">{#PLIGG_Visual_User_NewsPublished#}</a></li>
<li class="active"><a href="{$user_url_news_unpublished}">Articles voted on</a></li>
<li class="last"><a href="{$user_url_commented}">Articles commented on</a></li>
</ul>
</div>
{/if}
{if $user_view eq 'commented'}
<h2>{$user_login} / <em>Articles Commented On</em></h2>
<hr style="margin-top:-12px;"/>
<div id="usertabs">
<ul id="nav">
<li><a href="{$user_url_personal_data}">{#PLIGG_Visual_User_PersonalData#}</a></li>
<li><a href="{$user_url_news_sent}">{#PLIGG_Visual_User_NewsSent#}</a></li>
<li><a href="{$user_url_news_published}">{#PLIGG_Visual_User_NewsPublished#}</a></li>
<li><a href="{$user_url_news_unpublished}">Articles voted on</a></li>
<li class="active"><a href="{$user_url_commented}">Articles commented on</a></li>
</ul>
</div>
{/if}
{if $user_view eq 'profile'}
<h2><em>{$user_login}</em></h2>
<hr style="margin-top:-12px;"/>
<div id="usertabs">
<ul id="nav">
<li class="active"><a href="{$user_url_personal_data}">{#PLIGG_Visual_User_PersonalData#}</a></li>
<li><a href="{$user_url_news_sent}">{#PLIGG_Visual_User_NewsSent#}</a></li>
<li><a href="{$user_url_news_published}">{#PLIGG_Visual_User_NewsPublished#}</a></li>
<li><a href="{$user_url_news_unpublished}">Articles voted on</a></li>
<li class="last"><a href="{$user_url_commented}">Articles commented on</a></li>
</ul>
</div>
In that same file, change your switch statement to look like this
PHP Code:
switch ($view) {
case 'history':
do_history();
do_pages($rows, $page_size);
break;
case 'published':
do_published();
do_pages($rows, $page_size);
break;
case 'shaken':
do_shaken();
do_pages($rows, $page_size);
break;
case 'commented':
do_commented();
do_pages($rows, $page_size);
break;
case 'profile':
default:
break;
case 'removefriend':
do_removefriend();
break;
case 'addfriend':
do_addfriend();
break;
case 'viewfriends':
do_viewfriends();
break;
case 'viewfriends2':
do_viewfriends2();
break;
case 'sendmessage':
do_sendmessage();
break;
}
In user.php, add the following function below the do_shaken function
PHP Code:
function do_commented () {
global $db, $rows, $user, $offset, $page_size;
$link = new Link;
$rows = $db->get_var("SELECT count(*) FROM links, comments WHERE comment_user_id=$user->id AND comment_link_id=link_id");
$links = $db->get_col("SELECT link_id FROM links, comments WHERE comment_user_id=$user->id AND comment_link_id=link_id AND link_status != 'discard' ORDER BY link_date DESC LIMIT $offset,$page_size");
if ($links) {
foreach($links as $link_id) {
$link->id=$link_id;
$link->read();
$link->print_summary();
}
}
}
In that same file below
PHP Code:
$main_smarty->assign('user_url_news_unpublished', getmyurl('user2', $login, 'shaken'));
add
PHP Code:
$main_smarty->assign('user_url_commented', getmyurl('user2', $login, 'commented'));