12-05-2012, 01:45 AM
So that all users have an equal chance of getting likes I made this quick mod to the Facebook module.
Now when you click Earn Coins>Facebook Likes they are first sorted so the highest CPC is displayed first, then where the CPC is the same they are randomized. I think this gives everyone a better chance of getting some likes when you have a lot of users.
in your system/modules/facebook/ folder
edit module.php
look for the section <?
$sites = $db->QueryFetchArrayAll("SELECT id,url,title,cpc FROM `facebook` WHERE `active`='0' AND (SELECT `coins` FROM `users` WHERE `id` = `user` )>=`cpc` AND `cpc`>='2' AND
(`id` NOT IN (SELECT `site_id` FROM `liked` WHERE `user_id`='".$data['id']."') AND `user`!='".$data['id']."') AND (`country`='".$data['country']."' OR `country`='0') AND
(`sex`='".$data['sex']."' OR `sex`='0') AND `type`='".$fbType."' ORDER BY `cpc` DESC LIMIT ".($fbType == 0 ? 15 : 14));
and right towards the end add RAND () so that it looks like this:
<?
$sites = $db->QueryFetchArrayAll("SELECT id,url,title,cpc FROM `facebook` WHERE `active`='0' AND (SELECT `coins` FROM `users` WHERE `id` = `user` )>=`cpc` AND `cpc`>='2' AND
(`id` NOT IN (SELECT `site_id` FROM `liked` WHERE `user_id`='".$data['id']."') AND `user`!='".$data['id']."') AND (`country`='".$data['country']."' OR `country`='0') AND
(`sex`='".$data['sex']."' OR `sex`='0') AND `type`='".$fbType."' ORDER BY `cpc` DESC, RAND() LIMIT ".($fbType == 0 ? 15 : 14));
Then save your file and upload it.
Remember to make a copy of the original file before making any changes and also that when you next update you may overwrite this file so you will have to make the change again.
Now when you click Earn Coins>Facebook Likes they are first sorted so the highest CPC is displayed first, then where the CPC is the same they are randomized. I think this gives everyone a better chance of getting some likes when you have a lot of users.
in your system/modules/facebook/ folder
edit module.php
look for the section <?
$sites = $db->QueryFetchArrayAll("SELECT id,url,title,cpc FROM `facebook` WHERE `active`='0' AND (SELECT `coins` FROM `users` WHERE `id` = `user` )>=`cpc` AND `cpc`>='2' AND
(`id` NOT IN (SELECT `site_id` FROM `liked` WHERE `user_id`='".$data['id']."') AND `user`!='".$data['id']."') AND (`country`='".$data['country']."' OR `country`='0') AND
(`sex`='".$data['sex']."' OR `sex`='0') AND `type`='".$fbType."' ORDER BY `cpc` DESC LIMIT ".($fbType == 0 ? 15 : 14));
and right towards the end add RAND () so that it looks like this:
<?
$sites = $db->QueryFetchArrayAll("SELECT id,url,title,cpc FROM `facebook` WHERE `active`='0' AND (SELECT `coins` FROM `users` WHERE `id` = `user` )>=`cpc` AND `cpc`>='2' AND
(`id` NOT IN (SELECT `site_id` FROM `liked` WHERE `user_id`='".$data['id']."') AND `user`!='".$data['id']."') AND (`country`='".$data['country']."' OR `country`='0') AND
(`sex`='".$data['sex']."' OR `sex`='0') AND `type`='".$fbType."' ORDER BY `cpc` DESC, RAND() LIMIT ".($fbType == 0 ? 15 : 14));
Then save your file and upload it.
Remember to make a copy of the original file before making any changes and also that when you next update you may overwrite this file so you will have to make the change again.