I want to add a page counter to my members profile page. that is stored under a custom field {MEMBERVIEWS}. I want to be able to display or sort member profile page views in toplists and other areas of the site. Something similar to the {CATVIEWS} counter. Is there currently a way to do this?
You can use WSN's makecookie('cookiename', 'value'); function, or just http://www.php.net/setcookie . To test, if ($_COOKIE['cookiename']) { do stuff } Of course it goes without saying that if you're adding new functionality it helps to know php.
It's better to set a cookie name that doesn't change (say 'profilevisit'), both to reduce potential conficts and so that when a guest registers they don't suddenly get counted again.
0/5
1
2
3
4
5
This thread is closed, so you cannot post a reply.
Comments on Page counter
Usergroup: Customer
Joined: Jan 13, 2005
Total Topics: 23
Total Comments: 50
I want to add a page counter to my members profile page. that is stored under a custom field {MEMBERVIEWS}. I want to be able to display or sort member profile page views in toplists and other areas of the site. Something similar to the {CATVIEWS} counter. Is there currently a way to do this?
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
A clumsy but workable way to do it would be to add a member field 'views' and then stick this php in the profile template:
Making it count only unique views would be tricker, but you could set a cookie and test for it in the same profile template area.
Usergroup: Customer
Joined: Jan 13, 2005
Total Topics: 23
Total Comments: 50
How do I set a cookie and test for it
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
You can use WSN's makecookie('cookiename', 'value'); function, or just http://www.php.net/setcookie . To test, if ($_COOKIE['cookiename']) { do stuff }
Of course it goes without saying that if you're adding new functionality it helps to know php.
Usergroup: Customer
Joined: Jan 13, 2005
Total Topics: 23
Total Comments: 50
Thanks, this is what I did and it works. It expires the cookie after 24hrs
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
It's better to set a cookie name that doesn't change (say 'profilevisit'), both to reduce potential conficts and so that when a guest registers they don't suddenly get counted again.