I have modified my version of Pligg to count Clicks instead of Votes. It only records a click for a story once per IP address. The click is recorded when the user clicks on either the title, the url, or the click box(formerly vote box). Try it and see what you think:
favester.com
It is hard to show a lot of votes when you are just starting out. I noticed a lot of people coming to the site and clicking the links, but not voting. This was a way to show that activity.
Also, I have a php routine that compares votes to clicks for each link. If anyone wants it I can post it. The results are interesting.
Post #7 below details changes I made for this mod.
![]() |
| | LinkBack | Thread Tools | Display Modes |
| |||
| Counting Clicks instead of Votes Last edited by kahunabear; 02-04-2007 at 02:11 AM.. |
| ||||
|
kahunabear, great job on that! Care to share how you did this?
__________________ Visit PliggPro the official Pligg Mods & Template Shop! Last edited by chuckroast; 02-02-2007 at 07:42 PM.. |
| ||||
|
Glad that you got that working. If you are willing to share, this could be something we can integrate into Pligg (with your permission)
__________________ I accept donations for my time helping users like you on the forum and IRC. |
| |||
|
Sure, I don't mind sharing it a bit. I kinda did a hack job on it, though. It would need to be cleaned up. I also have a php/sql routine that generates clicks from the page views table to convert past clicks. I will work on getting it all written up. Thanks |
| |||
| php/sql to compare Clicks and Votes
Below, is a php routine to compare clicks to votes for each link in your system. It can be saved into a file uploaded and run from a browser. The database information has to be changed to connect to your database. Also, the string "tableprefix" has to be changed to match the prefix of your database tables. This doesn't change anything. It just gives you an idea of what using the click method would look like compared to the voting method. Also, it would make sense to delete it after running it. Not a good idea to leave username/passwords sitting around in files. Use at your own risk. The output will look something like this: link id: 1 How to Lose Money in Stocks votes: 2 clicks: 11 link id: 2 10 Ways to Prepare Frog Legs votes: 3 clicks: 14 PHP Code: Last edited by kbeeveer46; 02-03-2007 at 12:20 AM.. Reason: added php tags |
| The Following 4 Users Say Thank You to kahunabear For This Useful Post: | ||
| |||
|
Here is how I did this. I really took the quick and dirty approach. I use the current voting system to record clicks instead of votes. There is no option to do voting also. To make the change better would require a separate table and separate click scripts. I changed the system to update the vote table when the user clicks a link. To do this, I call the voting script from the template when the title or link is clicked. I also changed the script that calls the voting script to open the link after voting. The main files I changed were: link.php (assigns call info to a variable used in template) link_summary.tpl (template) xmlhttp.php (calls voting script) I also made various cosmetic changes and wrote a php routine to convert the old data. I will try to post the specific changes this weekend. kb favester.com |
| |||
|
*****WARNING***** This change is a total hack(but it works). Don't attempt these changes unless you have a programming background. These changes make you lose all previous votes(but you pick up lots of new click counts from past clicks). This change is not supported and will make implementing any future versions of Pligg very difficult. Make these changes to a test version of the system before implementing it live. Backup all live systems before implementing and after thorough testing. Finally, I probably have forgotten something. Proceed at your own risk. ****WARNING**** In the file /libs/link.php the following code creates a variable, called "link_shakebox_javascript_vote", that is used in the template(link_summary.tpl) to call a javascript function called "menealo" when the user clicks the vote box. Before: Code: $jslink = "menealo($current_user->user_id, $this->id, $link_index, " . "'" . md5($current_user->user_id.$this->randkey) . "', 10)";
$smarty->assign('link_shakebox_javascript_vote', $jslink);
After: Code: $jslink = "menealo($current_user->user_id, $this->id, $link_index, " . "'" . md5($current_user->user_id.$this->randkey) . "', 10)";
$smarty->assign('link_shakebox_javascript_vote', $jslink);
$smarty->assign('link_shakebox_javascript_votelink', rtrim ($jslink ,")" )); javascript:{$link_shakebox_javascript_votelink},'{ $url}') I place this code in 4 places within the link_summary.tpl file. These are the 4 places a user can click to open the link window. There are two for the voting boxes, one for the title and one for the URL. The specific code changes are as follows: For the voting boxes I change this: Code: <ul class="news-shakeit">
<li class="mnm-published" id="cat{$category_id}"><a id="mnms-{$link_shakebox_index}" href="javascript:{$link_shakebox_javascript_vote}">{$link_shakebox_votes}</a></li>
<li class="menealo" id="mnmlink-{$link_shakebox_index}">
{if $link_shakebox_currentuser_votes eq 0}
<a href="javascript:{$link_shakebox_javascript_vote}">{#PLIGG_Visual_Vote_For_It#}</a>
{else}
<span>{#PLIGG_Visual_Vote_Cast#}</span>
{/if}
</li>
</ul>
Code: <ul class="news-shakeit">
<li class="mnm-published" id="cat{$category_id}"><a id="mnms-{$link_shakebox_index}" href="javascript:{$link_shakebox_javascript_votelink},'{$url}')">{$link_shakebox_votes}</a></li>
<li class="menealo" id="mnmlink-{$link_shakebox_index}">
{if $link_shakebox_currentuser_votes eq 0}
<a href="javascript:{$link_shakebox_javascript_votelink},'{$url}')">{#PLIGG_Visual_Vote_For_It#}</a>
{else}
<span>{#PLIGG_Visual_Vote_Cast#}</span>
{/if}
</li>
</ul>
Code: {if $use_title_as_link eq true}
{if $url_short neq "http://" && $url_short neq "://"}
<a href="{$url}" {if $open_in_new_window eq true} target="_blank"{/if}>{$title_short}</a>
{else}
<a href="{$story_url}">{$title_short}</a>
{/if}
{else}
<a href="{$story_url}">{$title_short}</a>
{/if}
Code: {if $use_title_as_link eq true}
{if $url_short neq "http://" && $url_short neq "://"}
<a href="javascript:{$link_shakebox_javascript_votelink},'{$url}')">{$title_short}</a>
{else}
<a href="{$story_url}">{$title_short}</a>
{/if}
{else}
<a href="{$story_url}">{$title_short}</a>
{/if}
Code: <span id="ls_story_link-{$link_shakebox_index}">
{if $url_short neq "http://" && $url_short neq "://"}
<a href="{$url}" {if $open_in_new_window eq true} target="_blank"{/if} class="screen">{$url_short}{if $use_thumbnails eq true}<b><img src="http://msnsearch.srv.girafa.com/srv/i?s=MSNSEARCH&r={$url_short}"></b>{/if}</a>
{else}
{$No_URL_Name}
{/if}
</span>
Code: <span id="ls_story_link-{$link_shakebox_index}">
{if $url_short neq "http://" && $url_short neq "://"}
<a href="javascript:{$link_shakebox_javascript_votelink},'{$url}')" class="screen">{$url_short}{if $use_thumbnails eq true}<b><img src="http://msnsearch.srv.girafa.com/srv/i?s=MSNSEARCH&r={$url_short}"></b>{/if}</a>
{else}
{$No_URL_Name}
{/if}
</span>
The function call before: Code: function menealo (user, id, htmlid, md5, value) Code: function menealo (user, id, htmlid, md5, value, linkurl) Code: }
}
}
}
}
}
}
Code: }
}
}
}
}
if (linkurl){window.open(linkurl)};
}
}
I changed all language files that used to say "vote" or "votes" to "click" or "clicks". Some labels are still in the code. Also, I changed my system configuration as follows: 1.No vote when a link is submitted. 2.Set the publish threshold at 0 votes. This causes links to immediately show up on my published list with a click count of 0. Each click from then on is recorded as a vote. BTW, I also changed my system to not even show unpublished links since I have none. Before I implemented the above changes I made the following database changes: 1. I deleted all of the rows in the tableprefix_votes table. This destroys all past votes. Do a backup! 2. Then I ran the following php script to generate votes from past clicks. It reads through the tableprefix_pageviews table looking for all rows where the user clicked a link or title(pv_type = 'out'). For each unique click by an ip address, I insert a row into the tableprefix_votes table. For each link, I update the tableprefix_links table with the total number of clicks/votes for that link. ***** WARNING - The script below changes your database! ***** PHP Code: favester.com kb Last edited by kahunabear; 02-04-2007 at 02:16 AM.. |
| |||
|
Thank you kahunabear, i will try it.
|
| |||
|
Googlebot, Your Welcome. Let me know how it goes and if I can help. kb |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [mod] count clicks instead of votes | abcdefgary | Modification Tutorials | 8 | 06-14-2008 11:34 PM |
| News based on Clicks instead of Votes | mde05 | Modification Tutorials | 2 | 01-14-2008 08:32 AM |
| counting clicks instead of votes | lumpen5 | Modification Tutorials | 41 | 01-04-2008 05:47 PM |
| users total votes? | inggenia | General Help | 2 | 07-09-2007 07:44 AM |
| Registering Clicks instead of Votes | kahunabear | General Help | 2 | 02-01-2007 06:50 PM |




Linear Mode

