Results 1 to 3 of 3
  1. #1
    Pligg Developer/Admin kbeeveer46's Avatar
    Joined
    Jun 2006
    Posts
    3,215

    Add-on:View articles users have commented on in their profile

    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')); 

  2. #2
    New Pligger CrabApple's Avatar
    Joined
    Jul 2006
    Posts
    17
    Tried to make this work for a while, and no luck. There's just something I'm doing wrong, but I can't figure out what it is.

    I was messing with the admin stuff, and I noticed there's a lot of goodies in there, waiting to be called up. We just gotta find it all.

  3. #3
    Pligg Developer/Admin kbeeveer46's Avatar
    Joined
    Jun 2006
    Posts
    3,215
    Quote Originally Posted by CrabApple View Post
    Tried to make this work for a while, and no luck. There's just something I'm doing wrong, but I can't figure out what it is.
    What are you having problems with? Did you try changing the code above and it just didn't work?

Similar Threads

  1. Link Error in User Profile: View>Published News
    By rubber2002 in forum Questions & Comments
    Replies: 5
    Last Post: 06-09-2008, 06:13 AM
  2. Voting intensity at profile view
    By tbones in forum Questions & Comments
    Replies: 3
    Last Post: 08-08-2007, 04:48 AM
  3. Profile view: friendship links
    By tbones in forum Questions & Comments
    Replies: 6
    Last Post: 07-18-2007, 04:03 AM
  4. [SOLVED] Can't view user's profile
    By AshMCairo in forum Questions & Comments
    Replies: 1
    Last Post: 05-23-2007, 01:02 PM
  5. where to find profile, commented, published
    By gamespel in forum Questions & Comments
    Replies: 2
    Last Post: 10-29-2006, 02:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Donate to Pligg CMS Dreamhost Web Hosting Host Gator Web Hosting