Go Back   Pligg CMS Forum > Pligg Help > General Help

Reply
 
LinkBack Thread Tools Display Modes
  #21 (permalink)  
Old 08-02-2008, 12:52 PM
longcountdown's Avatar
Pligg Donor
Pligg Version: 9.8.2
Pligg Template: moderno-orange
 
Join Date: Nov 2007
Location: Japan
Posts: 75
Thanks: 25
Thanked 18 Times in 11 Posts
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.
Reply With Quote
The Following 4 Users Say Thank You to longcountdown For This Useful Post:
  #22 (permalink)  
Old 08-04-2008, 05:08 AM
longcountdown's Avatar
Pligg Donor
Pligg Version: 9.8.2
Pligg Template: moderno-orange
 
Join Date: Nov 2007
Location: Japan
Posts: 75
Thanks: 25
Thanked 18 Times in 11 Posts
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());} 
Reply With Quote
  #23 (permalink)  
Old 08-04-2008, 06:01 AM
xiesi's Avatar
Constant Pligger
Pligg Version: 9.95
Pligg Template: yget + diy
 
Join Date: Jun 2007
Posts: 226
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to xiesi
Smile

anyone can tell me if it works for pligg 9.9.5?
sorry my english.
__________________
www.qelele.com齐乐乐
Reply With Quote
  #24 (permalink)  
Old 08-04-2008, 10:09 AM
longcountdown's Avatar
Pligg Donor
Pligg Version: 9.8.2
Pligg Template: moderno-orange
 
Join Date: Nov 2007
Location: Japan
Posts: 75
Thanks: 25
Thanked 18 Times in 11 Posts
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.
Reply With Quote
  #25 (permalink)  
Old 08-04-2008, 11:48 AM
xiesi's Avatar
Constant Pligger
Pligg Version: 9.95
Pligg Template: yget + diy
 
Join Date: Jun 2007
Posts: 226
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to xiesi
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.
__________________
www.qelele.com齐乐乐
Reply With Quote
  #26 (permalink)  
Old 08-14-2008, 09:02 AM
New Pligger
Pligg Version: 9.9.5
Pligg Template: starnews
 
Join Date: Dec 2007
Posts: 21
Thanks: 1
Thanked 0 Times in 0 Posts
thanks longcountdown

droped the table and working good in 9.9
Reply With Quote
  #27 (permalink)  
Old 09-01-2008, 06:22 PM
New Pligger
Pligg Version: 9.9.5
 
Join Date: Aug 2008
Posts: 19
Thanks: 3
Thanked 2 Times in 2 Posts
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.

Last edited by pliggreborn; 09-01-2008 at 06:36 PM..
Reply With Quote
The Following User Says Thank You to pliggreborn For This Useful Post:
  #28 (permalink)  
Old 10-26-2008, 12:33 AM
New Pligger
Pligg Version: 9.9.5
 
Join Date: Oct 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks. I will try this later and will post the result
Reply With Quote
  #29 (permalink)  
Old 11-23-2008, 10:34 AM
New Pligger
 
Join Date: Aug 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
no one knows!!
Reply With Quote
  #30 (permalink)  
Old 11-23-2008, 11:42 AM
chuckroast's Avatar
Coder/Designer
Pligg Version: 1.0
Pligg Template: ExpertVision
 
Join Date: Jun 2006
Location: PA
Posts: 2,401
Thanks: 171
Thanked 440 Times in 279 Posts
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?
__________________
Visit PliggPro the official Pligg Mods & Template Shop!

Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Search Engine Friendly URLs by vBSEO 3.2.0