counting clicks instead of votes

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-02-2007, 04:51 PM
Pligg Donor
Donation Level 2 
 
Join Date: Mar 2007
Posts: 48
i want to have my site count clicks instead of votes. I know there was a thread on this but it was back in February and when i tried it, well the code has changed a bit since then. Does anyone have an updated hack for this?
Reply With Quote
  #2 (permalink)  
Old 06-03-2007, 11:31 AM
Casual Pligger
 
Join Date: Mar 2007
Location: Salem, Oregon
Posts: 31
Send a message via Skype™ to harlem
Yes, I agree. My site has a couple hundred unique hits a day but none bother to vote on the content. Habitually, once you are off the main site having found what you need it is rare that they come back. This makes voting almost irrelevant. A passive voting method would be beneficial to many sites struggling to get users to vote.
Reply With Quote
  #3 (permalink)  
Old 06-12-2007, 12:30 AM
Casual Pligger
 
Join Date: Jun 2007
Posts: 39
That's a great idea. I would like to use that feature as well.
Reply With Quote
  #4 (permalink)  
Old 06-19-2007, 11:16 PM
P1mpPanther's Avatar
Constant Pligger
 
Join Date: Feb 2007
Posts: 277
hmmm, figured someone would have responded to this by now.

anyone?
Reply With Quote
  #5 (permalink)  
Old 06-19-2007, 11:21 PM
Casual Pligger
 
Join Date: Mar 2007
Posts: 47
I think is possible and not very hard because you already have the pageview count. Let me see if I can find something, I would love to have this functionality too.
Reply With Quote
  #6 (permalink)  
Old 06-20-2007, 02:38 AM
P1mpPanther's Avatar
Constant Pligger
 
Join Date: Feb 2007
Posts: 277
hey gary - thats how i understand it as well.

clicks for a story (or essentially views) will advance the vote counter.
Reply With Quote
  #7 (permalink)  
Old 06-20-2007, 01:27 PM
Genghis's Avatar
Casual Pligger
 
Join Date: Mar 2007
Posts: 57
abcdefgary, if you could post the steps on how to do this for pligg 9.5 beta...well, I would really appreciate it!
Reply With Quote
  #8 (permalink)  
Old 06-20-2007, 02:44 PM
ozo ozo is offline
Casual Pligger
 
Join Date: Jan 2007
Posts: 50
Hey I implemented a way to do this but I don't vouch that this is the best way to do it, but it worked for me @ www.meshedlinks.com, you can see it in action. Follow this steps - however this requires that you have a little, just a little, technical knowledge:

1. create a field in your pligg_links table to store the number of clicks (NOTE: I guess this can be done simply by using extrafields, but I guess someone can work on this solution and have something better)
To create field in your pligg_links table execute this against your database :
ALTER TABLE pligg_links ADD COLUMN clicks BIGINT DEFAULT 1;

2. Modify link.php (in libs folder as follows):
a. add var $clicks = 1; just after var $current_user_reports = 0;
b. replace this:
$db->query("UPDATE " . table_links . " set link_summary='$link_summary', link_title_url='$link_title_url', link_url='$link_url', link_url_title='$link_url_title', link_title='$link_title', link_content='$link_content', link_tags='$link_tags', link_field1='$link_field1', link_field2='$link_field2', link_field3='$link_field3', link_field4='$link_field4', link_field5='$link_field5', link_field6='$link_field6', link_field7='$link_field7', link_field8='$link_field8', link_field9='$link_field9', link_field10='$link_field10', link_field11='$link_field11', link_field12='$link_field12', link_field13='$link_field13', link_field14='$link_field14', link_field15='$link_field15', clicks='$clicks' WHERE link_id=$this->id");
with the $db->query you have in the store function. or alternatively just include ,clicks='$clicks' after $link_field15 in the $db->query function in the store function.
c. In the read function look for if($link) and at the end of it where you have $this->link_summary = $link->link_summary; include $this->clicks = $link->clicks; just below it.
d. In read_basic function replace the $db->get_row.... by $db->get_row("SELECT link_author, link_status, link_randkey, link_category, link_date, link_votes, link_karma, link_published_date, clicks FROM " . table_links . " WHERE link_id = $id"))) OR simply append , clicks to $db->get row just after link_published_date
e. add $this->clicks=$link->clicks; just after $this->published_date=unixtimestamp($date); still in read_basic
f. add this entry : $smarty->assign('clicks', $this->clicks); just after $smarty->assign('link_category', $this->category_name());
That is all for that file

3. Open out.php in your pliggroot directory. include this:
$db->query("UPDATE " . table_links . " SET clicks = clicks + 1 WHERE link_id = " . $id); just before header("HTTP/1.1 301 Moved Permanently");

4. open up link_summary.tpl in your templates directory and include this:
<span class="clicks">
Views : {$clicks}
</span>
where you want the clicks to be displayed. In your css fine you can define how it should look by creating an entry class clicks and defining it.

Well, that is about it. As I said this is my solution. I am certain there can be an optimized version, but this method does get things to work. Remember you can check it out at www.meshedlinks.com

Am working on displaying and viewing links by votes. So for instance you have a tab at the top that says top links by votes or upcoming links by votes, if you get what I mean.

If you have any questions don't hesitate to post them.
Reply With Quote
  #9 (permalink)  
Old 06-20-2007, 02:55 PM
P1mpPanther's Avatar
Constant Pligger
 
Join Date: Feb 2007
Posts: 277
looks like you and gary have been working on the same thing, but how cool that there are two different ways to implement. thanks ozo
Reply With Quote
  #10 (permalink)  
Old 06-20-2007, 05:04 PM
Genghis's Avatar
Casual Pligger
 
Join Date: Mar 2007
Posts: 57
How can you alter this mod so that it not ONLY registers Title URL clicks, but also the 'read more' clicks that link to story.php?

I ask this question because no clicks register for editorials (posts with no URLs).

Thanks.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[mod] count clicks instead of votes abcdefgary Questions and Comments 6 06-14-2008 11:34 PM
News based on Clicks instead of Votes mde05 Questions and Comments 2 01-14-2008 08:32 AM
users total votes? inggenia Questions and Comments 2 07-09-2007 07:44 AM
Counting Clicks instead of Votes kahunabear Questions and Comments 13 04-03-2007 09:18 AM
Registering Clicks instead of Votes kahunabear Questions and Comments 2 02-01-2007 06:50 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development