Premium Listing

Morus

www.votezone.eu , www.privateserversranking.com
License Active
How would I create a link that will show me only Premium Users on Ranking list?
 

Mark

Administrator
Staff member
you would need to duplicate the rankings.php file, give it a new name like "premium-rankings.php".

Then alter the query in premium-rankings.php to only select sites with: premium_flag = 1

find:
PHP:
    $result = $DB->select_limit("SELECT *
                                 FROM {$CONF['sql_prefix']}_sites sites, {$CONF['sql_prefix']}_stats stats
                                 WHERE sites.username = stats.username AND active = 1 {$category_sql}
                                 ORDER BY {$order_by}
                                ", $CONF['num_list'], $start, __FILE__, __LINE__);
replace with:
PHP:
    $result = $DB->select_limit("SELECT *
                                 FROM {$CONF['sql_prefix']}_sites sites, {$CONF['sql_prefix']}_stats stats
                                 WHERE sites.username = stats.username AND active = 1 AND premium_flag = 1 {$category_sql}
                                 ORDER BY {$order_by}
                                ", $CONF['num_list'], $start, __FILE__, __LINE__);
Then rename the class from "rankings" to "premium-rankings" at the top of the new file.
PHP:
class rankings extends base {
  function rankings() {
would become:
PHP:
class  premium-rankings extends base {
  function  premium-rankings() {

Then add to your action array in index.php (or the correct way via a plugin)

premium-rankings => 1,

then you can access the new page at ?a=premium-rankings
OR (if your using clean URL's)
/premium-rankings/


if you get stuck let me know and I'll put this together asap as a plugin/product
 

Morus

www.votezone.eu , www.privateserversranking.com
License Active
I have error like that :
Code:
Warning: require_once(./sources/premium-rankings.php) [function.require-once]: failed to open stream: No such file or directory in /homepages/46/d339036285/htdocs/votezone/l2/index.php on line 323
 
Fatal error: require_once() [function.require]: Failed opening required './sources/premium-rankings.php' (include_path='.:/usr/lib/php5') in /homepages/46/d339036285/htdocs/votezone/l2/index.php on line 323
 

Mark

Administrator
Staff member
well you have spelled it wrong or something, that error is very clear: sources/premium-rankings.php Does not exist.
 

Morus

www.votezone.eu , www.privateserversranking.com
License Active
all ok now, I just didnt place it in source folder. Thanks
 

Mark

Administrator
Staff member
good stuff, glad it worked :) This is actually a really useful feature, not sure why it hasn't been created/included before.
 

Morus

www.votezone.eu , www.privateserversranking.com
License Active
Hi,

I know that is old, but after update this feature is not working for me anymore. Any advice?
 

Mark

Administrator
Staff member
yes you need to re-edit index.php if you didnt use a plugin.

premium-rankings => 1,

I will make this into a plugin and post it now so you dont need to re-apply this edit each update.
 

Morus

www.votezone.eu , www.privateserversranking.com
License Active
Thanks, I can't remember where exactly I placed it (premium-rankings => 1,) in index.php :(
 

Mark

Administrator
Staff member
if you look you will see where it goes:

PHP:
$action = array(
    'admin' => 1,
    'in' => 1,
    'join' => 1,
    'lost_pw' => 1,
    'out' => 1,
    'page' => 1,
    'rankings' => 1,
    'rate' => 1,
    'search' => 1,
    'stats' => 1,
    'sendmessage' => 1,
    'user_cpl' => 1
    );
After some thought, I will post the plugin for 0.8 release since that will allow us to use the new /sources/ method. For now you just need to edit index.php manually or make a plugin for action_array.php
 

Mark

Administrator
Staff member
youneed a comma between all of them except the last one, follow the pattern ;)


it should be

PHP:
    'stats' => 1,
    'sendmessage' => 1,
    'user_cpl' => 1,
    'premium_rankings' => 1
 

Morus

www.votezone.eu , www.privateserversranking.com
License Active
It seems that this is not working in 0.9 release. see below the full code:


<snip> removed, we don't need to share the code, we need to know whats gone wrong </snip>
 

Mark

Administrator
Staff member
should work just fine, what happens? Please describe with as much details as possible what the result is and please make sure you have made all the necessary changes posted above.
 

Mark

Administrator
Staff member
you are missing a rule in your .htaccess or you are missing the edit in index.php or both.

This should work just fine with 0.9 as long as your follow the steps above.
 
Top