Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 34
  1. #21
    Pligg Donor longcountdown's Avatar
    Joined
    Nov 2007
    Posts
    75
    Thanks
    Received:0
    Given: 0
    I've just been through this process and wanted to clarify some of the points made here.

    Firstly, micxuy must mean user.php, out.php, story.php and libs/pageview.php.

    Secondly, when he said "delete the database", I'm sure he meant "delete the pageviews table", which you can do by dropping it in phpmyadmin.

    Thirdly, although micxuy said to comment out the functions in libs.pageview.php, I didn't find that was necessary because those functions are never called anyway once you've commented out the code in the other files.

    So, I'll go step-by-step through what I did (using 9.8.2), highlighting the lines I commented out in red:

    * Please backup your files and database before following anything I say. I'm just a novice. *

    1. /user.php

    Code:
    // find out who last viewed this users profile
    //	$pageview = new Pageview;
    	
    // insert a pageview for the current viewer
    //	$pageview->type='profile'; 	 
    //	$pageview->page_id=$user->id; 	 
    //	$pageview->user_id=$current_user->user_id; 	 
    	require_once(mnminclude.'check_behind_proxy.php'); 	 
    //	$pageview->user_ip=check_ip_behind_proxy(); 	 
    //	$pageview->insert();	
    
    	if(ShowProfileLastViewers == true){
    		$main_smarty->assign('ShowProfileLastViewers', true);		
    		// setup some arrays
    			$last_viewers_names = array();
    			$last_viewers_profile = array();
    			$last_viewers_avatar = array();
    				
    		// get the last 5 viewers
    			$last_viewers = $pageview->last_viewers(5);
    			
    		// for each viewer, get their name, profile link and avatar and put it in an array
    			$viewers=new User();
    			if ($last_viewers) {
    				foreach($last_viewers as $viewer_id) {
    					$viewers->id=$viewer_id;
    					$viewers->read();
    					$last_viewers_names[] = $viewers->username;
    					$last_viewers_profile[] = getmyurl('user2', $viewers->username, 'profile');
    					$last_viewers_avatar[] = get_avatar('small', "", $viewers->username, $viewers->email);
    				}
    			}
    		// tell smarty about our arrays
    			$main_smarty->assign('last_viewers_names', $last_viewers_names);
    			$main_smarty->assign('last_viewers_profile', $last_viewers_profile);
    			$main_smarty->assign('last_viewers_avatar', $last_viewers_avatar);
    	} else {
    //		$main_smarty->assign('ShowProfileLastViewers', false);		
    	}
    Important: I didn't comment out the if(ShowProfileLastViewers == true) condition because I had set it to false in Admin ( Admin->Configure->PageViews->Show the last 5 people to view a profile = false).

    2. /out.php

    Code:
    //	$pageview = new Pageview;
    //	$pageview->type='out';
    //	$pageview->page_id=$link->id;
    //	$pageview->user_id=$current_user->user_id;
    	require_once(mnminclude.'check_behind_proxy.php');
    //	$pageview->user_ip=check_ip_behind_proxy();
    //	$pageview->insert();
    3. /story.php

    Code:
    	// log the pageview
    //	$pageview = new Pageview;
    //	$pageview->type='story';
    //	$pageview->page_id=$link->id;
    //	$pageview->user_id=$current_user->user_id;
    	require_once(mnminclude.'check_behind_proxy.php');
    //	$pageview->user_ip=check_ip_behind_proxy();
    	
    	// find the last pageview
    //	$last_visit = $pageview->last_visit();
    //	if($last_visit != 0){$last_visit = txt_time_diff($pageview->last_visit(), time());}
    //	$main_smarty->assign('last_visit', $last_visit);
    //	$pageview->insert();
    4. Upload and test

    1. Upload the above three files.
    2. Click on some links and view some profiles.
    3. If there are no errors, go into phpmyadmin and look at the last few entries in your pageviews table. If your recent testing is not in the table then everything worked.


    5. Drop the pageviews table

    In phpmyadmin, click on the link to the pageviews table and you should see a "Drop" tab. Clicking that will delete the table.

    That should be all, and everything should still be working without the pageviews table. The last thing you might want to do is remove the "Last 5 people to view this profile" text from the profile page...

    6. Edit /templates/your_template/user_center.tpl

    Code:
    <!-- <tr><td style='padding-top: 10px;'><strong>{#PLIGG_Visual_User_Profile_Last_5_Title#}:</strong></td></tr>
    	<tr><td>
    	{section name=customer loop=$last_viewers_names}
    	{if $UseAvatars neq "0"}<img style="padding-left:12px;" src="{$last_viewers_avatar[customer]}" align="absmiddle">{/if} <a href = "{$last_viewers_profile[customer]}">{$last_viewers_names[customer]}</a><br />
    	{/section}
    </td></tr> -->
    Now, you're done. I hope you found that helpful. Sometimes it's such a puzzle putting everyone's comments together into one clear solution. Of course, if anyone finds any mistakes or things I missed, please point them out.

  2. #22
    Pligg Donor longcountdown's Avatar
    Joined
    Nov 2007
    Posts
    75
    Thanks
    Received:0
    Given: 0
    One other thing. If you're using the "Method for deleting discarded stories" modification, then you'll also need to comment out the following lines in /admin_delete_stories.php:

    Code:
    # delete the story pageviews
        # $query="DELETE FROM " . table_pageviews . " WHERE (pv_type = 'story' OR pv_type = 'out') AND pv_page_id = '$linkid'";
        # if (! $result=mysql_query($query)) {error_page(mysql_error());}

  3. #23
    Constant Pligger xiesi's Avatar
    Joined
    Jun 2007
    Posts
    223
    Thanks
    Received:0
    Given: 0

    Smile

    anyone can tell me if it works for pligg 9.9.5?
    sorry my english.

  4. #24
    Pligg Donor longcountdown's Avatar
    Joined
    Nov 2007
    Posts
    75
    Thanks
    Received:0
    Given: 0
    Quote Originally Posted by xiesi View Post
    anyone can tell me if it works for pligg 9.9.5?
    sorry my english.
    I've just followed the same steps on my test site with 9.9.5 and yes, it works.

  5. #25
    Constant Pligger xiesi's Avatar
    Joined
    Jun 2007
    Posts
    223
    Thanks
    Received:0
    Given: 0
    Quote Originally Posted by longcountdown View Post
    I've just followed the same steps on my test site with 9.9.5 and yes, it works.
    thanks,i will try it.

  6. #26
    Donor sach4isha's Avatar
    Joined
    Dec 2007
    Posts
    28
    Thanks
    Received:0
    Given: 0
    thanks longcountdown

    droped the table and working good in 9.9

  7. #27
    New Pligger pliggreborn's Avatar
    Joined
    Aug 2008
    Posts
    21
    Thanks
    Received:0
    Given: 0
    Longcountdown,

    The code works. I hesitate when asked to delete tables from the database. So here is how I implemented mine. I did not delete the pageview table. I just commented out the required code so as to not call the pageview table in each story as explained by longcountdown. Then I just EMPTIED the pageview table using this mod:

    http://forums.pligg.com/core-develop...mizing-db.html

    Or simply empty the table in phpmyadmin

    Now I have an empty pageview table that never increases in size! This is great for future compatability issues since any modules or mods that requires the pageview table would not cause a problem.

  8. #28
    Junior Member JeffNetSite's Avatar
    Joined
    Oct 2008
    Posts
    9
    Thanks
    Received:0
    Given: 0
    Thanks. I will try this later and will post the result

  9. #29
    New Pligger manboo's Avatar
    Joined
    Aug 2006
    Posts
    16
    Thanks
    Received:0
    Given: 0
    no one knows!!

  10. #30
    Pligg Developer/Coder/Designer ChuckRoast's Avatar
    Joined
    Dec 2005
    Location
    Pliggville USA
    Posts
    9,118
    Thanks
    Received:396
    Given: 73
    Version
    SVN Build
    Site
    http://Pligg.com/chuckroast
    Quote Originally Posted by manboo View Post
    no one knows!!
    No one knows what? You were given several different solutions in this thread. Did you read it?
    Help Keep ChuckRoast Home
    Today's Pligg Blog Post


Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. "pligg_pageviews" MySQL table
    By pligger2 in forum Questions & Comments
    Replies: 2
    Last Post: 02-27-2007, 09:02 AM

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 Web Hosting Services by Midphase Dreamhost Web Hosting Donate to Pligg