Exclude a categorie

autosurf

Active Member
if you find something that cannot be done.. please say so. We can add hooks to the core where needed.

There is no need to alter core files at all.
I added in the "sources / rankings.php" line 35 file:
$ category_sql = 'AND category = "Sex"!'

This can not include this category on my home page.
Also, is it possible to make this change ith a plugin not to touch the body of the program?
 

Basti

Administrator
Staff member
For that you can make use of a change we did in 1.0

Open sources rankings.php

find
Code:
    // Make ORDER BY clause
    $order_by = $this->rank_by($ranking_method)." DESC, unq_{$ranking_method}_overall DESC";
below that one a new line, add
Code:
    // Plugin hook, overwrite or extend ORDER BY clause
    eval (PluginManager::getPluginManager ()->pluginHooks ('rankings_order_by'));
 
    $where_extra = '';
    // Plugin hook, extend the WHERE clause.
    // e.g $where_extra .= "AND column_name = 'text here'";
    eval (PluginManager::getPluginManager ()->pluginHooks ('rankings_extend_where'));
Find ( few lines below )
Code:
    $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
Code:
    $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} {$where_extra}
                                ORDER BY {$order_by}
                                ", $CONF['num_list'], $start, __FILE__, __LINE__);
After you did that, you can make use of the plugin attached. See the php file inside to see what i did
 

Attachments

autosurf

Active Member
This possibility leads me to do the update to version 1.0 when it will be offered.
integration functionality in plugins is advantageous for the future.
Thank you to offer this possibility in future versions :)
 

Basti

Administrator
Staff member
Your welcome, if you have more custom things just mention them and we will try to find an existing or new solution
 

kapearl

Member
What if the member is a premium member? The above excludes them from that ranking page as well. I'd like my 'excluded from the homepage/main ranking category' to be included in the premium listing ranking pages since they're paying.
 

Basti

Administrator
Staff member
Since you already have a plugin which extends the ranking, i'd say dont use this plugin, but use your existing once and simply say "all members except the ones from category xx only if they not premium"
Could add that in if i work on your other stuff, easy change. Just need to know the category to exclude
 

kapearl

Member
Thanks! It's the coupon category. I want to exclude it from the ranking pages (keep it category view only) like it is now unless they are premium, then allow them to show up on the rank by premium page.

I don't want them to be able to buy there way into the standard ranking pages but I think it's fair they appear w/the other premium members if the rank by sorting is premium.
 
Top