1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Activity 1.7

Adds an "activity" page and RSS feed

  1. Nick

    Nick Well-Known Member

    Activity
    Version: 1.6
    Author: Nick Ramsay
    Created on: 2009/11/06
    Last Updated: 2013/08/19
    Tested on: Hotaru 1.5.2
    Plugins Required: Users, Widgets
    Plug & Play: Yes
    Supported: Yes

    Description
    The Activity plugin adds an "activity" page and RSS feed which shows all activity from your site (posts, comments and votes). It also adds a user activity feed (and RSS) to the user profile. Lastly, it includes a widget.

    Instructions
    1. Upload the "activity" folder to your plugins folder.
    2. Install it from Admin -> Plugin Management
    3. Edit settings in Admin -> Activity
    4. Enable the widget in Admin -> Widgets

    Revision History
    v.1.6 2013/08/19 - shibuya246 - move widget code to template to allow customization
    v.1.5 2013/08/02 - shibuya246 - fix from valMETNG for when Post or Comment not present
    v.1.4 2013/07/16 - shibuya246 - update for followers plugin to show recent activity
    v.1.3 2013/07/08 - valMETNG - striptags in Activity Functions
    v.1.2 2013/06/16 - shibuya246 - Rework the Activity page to reduce queries
    v.1.1 2010/08/08 - Nick - Fix for no avatar showing in widget for anonymous users (needs Hotaru 1.4.1)
    v.1.0 2010/07/07 - Nick - Fix for page load continuing after displaying the RSS feed
    v.0.9 2010/06/16 - Alan - Display as Anonymous if no userid
    v.0.8 2010/04/22 - Nick - Reworked to use Hotaru 1.2's SiteActivity library.
    v.0.7 2010/03/03 - Nick - Updated to work with the "Up Down Voting" plugin.
    v.0.6 2010/02/28 - Nick - Removed unnecessary breadcrumbs for profiles (#1255)
    v.0.5 2010/02/20 - Nick - Code changes for pagination
    v.0.4 2010/01/24 - Nick - HTML for user profiles and Activity page moved into templates
    v.0.3 2010/01/15 - Nick - Fixes for deleting items and refreshing the cache
    v.0.2 2010/01/03 - Nick - Updates for compatibility with Hotaru 1.0
    v.0.1 2009/11/23 - Nick - Released first version.

    Please click "Rate Thread" and give this plugin a rating. Thank you.
     

    Attached Files:

    Last edited by a moderator: Feb 6, 2010
  2. JonH

    JonH Admin & Design

    Tiny markup bug - Version 0.1 in activity.php line 387 needs the slash to close the div
    Code:
    $output .= "<[COLOR="Red"]/[/COLOR]div>\n";
     
  3. Nick

    Nick Well-Known Member

    Updated: v.0.6 2010/02/28 - Nick - Removed unnecessary breadcrumbs for profile (#1255).
     
  4. Nick

    Nick Well-Known Member

    Updated: v.0.7 2010/03/03 - Nick - Updated to work with the "Up Down Voting" plugin.
     
  5. Nick

    Nick Well-Known Member

    Updated: v.0.8 2010/04/22 - Nick - Reworked to use Hotaru 1.2's SiteActivity library.
     
  6. nothingman

    nothingman Active Member

    Downloaded v. 0.9 and the widget shows up but the activity page is blank like this. Reverted to v. 0.8 same problem. I've cleared all the cache folders still no luck.
     
  7. Nick

    Nick Well-Known Member

    Really not sure. 0.9 seems to work fine for me. Can you post your plugin list and tell me the settings you have for the Bookmarking plugin. Thanks.
     
  8. nothingman

    nothingman Active Member

    Hi Nick,

    My Plugins list:
    1. bookmarking v.0.1 [enabled]
    2. user_signin v.0.6 [enabled]
    3. widgets v.0.9 [enabled]
    4. users v.2.0 [enabled]
    5. submit v.2.8 [enabled]
    6. comments v.2.1 [enabled]
    7. category_manager v.1.0 [enabled]
    8. categories v.1.6 [enabled]
    9. search v.1.1 [enabled]
    10. tags v.1.7 [enabled]
    11. vote v.2.1 [enabled]
    12. post_manager v.0.7 [enabled]
    13. user_manager v.1.0 [enabled]
    14. comment_manager v.0.6 [enabled]
    15. archive v.0.1 [enabled]
    16. comment_voting v.0.2 [enabled]
    17. comments_widget v.0.3 [enabled]
    18. contact_us v.0.2 [enabled]
    19. facebook_open_graph v.0.2 [enabled]
    20. gravatar v.0.9 [enabled]
    21. journal v.0.2 [enabled]
    22. journal_widget v.0.1 [enabled]
    23. messaging v.0.6 [enabled]
    24. post_rss v.0.1 [enabled]
    25. post_views v.0.1 [enabled]
    26. posts_widget v.1.3 [enabled]
    27. who_voted v.0.2 [enabled]
    28. smilies v.0.3 [enabled]
    29. save_post v.0.7 [enabled]
    30. whos_online v.0.2 [enabled]
    31. stop_spam v.0.4 [enabled]
    32. text_widget v.0.5 [enabled]
    33. cron v.0.3 [enabled]
    34. post_images v.0.5 [enabled]
    35. activity v.0.8 [enabled]

    Bookmarking Configuration

    Posts per page: 14

    Automatically redirect RSS links to their original sources: unchecked
     
  9. Nick

    Nick Well-Known Member

    Thanks. There seems to be two places it's failing on your site: the "activity" page and the Activity RSS feed. Neither of which I can duplicate at me end, so it's very hard to debug. I'm surprised there are no error messages dspite you having Debug turned on. :confused:

    Try experimenting with some echo statements. E.g.

    Open activity.php in the plugin I add echo statements to the activityPage function from line 395:

    PHP:
    /**
         * Display All Activity page
         */
        
    public function activityPage($h)
        {
            echo 
    "In activityPage function. Getting settings...<br />";

            
    // Get settings from database if they exist...
            
    $activity_settings $h->getSerializedSettings('activity');

            echo 
    "Got settings: <pre>"print_r($activity_settings); echo "</pre>";
            
            echo 
    "Preparing query...<br />";
            
    // gets query and total count for pagination
            
    $act_query $h->getLatestActivity(00'query');
            
    $act_count $h->getLatestActivity(00'count');

            echo 
    "Got 'em. act_query is " $act_query " and act_count is " $act_count "<br />";

            echo 
    "Getting results...<br />";
            
            
    // pagination 
            
    $h->vars['pagedResults'] = $h->pagination($act_query$act_count$activity_settings['number'], 'useractivity');

            echo 
    "Got results: <pre>"print_r($h->vars['pagedResults']);  echo "</pre>";

            echo 
    "Going to display the template...<br />";
            
            
    $h->displayTemplate('activity');

            echo 
    "Back from displaying the template.";

        }
    That will hopefully throw some light on the problem.
     
  10. nothingman

    nothingman Active Member

    Thanks nick, here's what I see. My Activity Page .

     
  11. Nick

    Nick Well-Known Member

    Interesting. Let's continue. Open /libs/UserActivity.php and between lines 46 and 47 add:
    PHP:
    if ($h->pageName == 'activity') { echo "In UserActivity class on line 47.<br />SQL: " $sql "<br />QUERY: " $query "<br />"; }
     
  12. nothingman

    nothingman Active Member

    Done.
    Here's what I see now.

     
  13. Nick

    Nick Well-Known Member

    Fascinating. The interesting part here is that it's only echoing that line once despite calling the getLatestActivity function twice.

    So... plodding on....

    In that same function, put this on line 40:

    PHP:
    if ($h->pageName == 'activity') { echo "Type: " $type "<br />"; }
    and on line 50 (after $result =...), put this:

    PHP:
    if ($h->pageName == 'activity') { echo "Result: <pre>"print_r($result); echo "</pre>"; }
    Isn't this fun? :p
     
  14. nothingman

    nothingman Active Member

    Done. Here's the activity page .

    Don't ask :p
     
  15. Nick

    Nick Well-Known Member

    Aha! Looks like we've discovered a bug! Try this:

    1. Remove the echo statements you added to that function.
    2. Copy line 56:

    PHP:
    if ($type == 'query') { return $query; }
    to lines 47 AND 53, i.e. on the lines after $query = ...

    3. Delete the original line 56.

    That should fix it.
     
  16. nothingman

    nothingman Active Member

    Ok, done. The activities show up at the bottom of the page and above that I see the following snippets - My activity page.


     
    Last edited: Jul 8, 2010
  17. Nick

    Nick Well-Known Member

    Great! Remove all the echo statements you added, and you're done. :)

    I'll include this fix in Hotaru 1.4.

    Edit: Though I still need to look at that RSS feed...
     
    nothingman likes this.
  18. nothingman

    nothingman Active Member

    Removed all the echo statements...and Yay, we're back in business! :p
     
  19. nothingman

    nothingman Active Member

    Ooops, now the activity of a user in their profile page shows the following undefined variable errors. Sample profile page

     
  20. Nick

    Nick Well-Known Member

    Can you paste that function here for me? Could be a typo.
     

Share This Page