MN Forum

Full Version: Randomising Likes Page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
careful doing this, you removed the privilege of premium members, one to be a priority in the viewer ...
jnfs, I see where you are coming from, if a premium member posts a page that's the highest FREE cpc (lets say 5) then his page could rank / display anywhere with all the other 5's.

But since he is a premium member, the user will be taking advantage that he can post his page with a higher cpc say 6 which will put him above all the 5's.

This mod still sorts by CPC, just randomizes pages with the same CPC and allowing new pages and old equal chance of being liked.
Nice. Good to see this option Wink