Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend groub_id param to accepte multi categorie groups and “not” to exclude categorie groups. #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion third_party/freebie/ext.freebie.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,12 @@ function clean_uri(){

// Store 'cleaned' uri_string for debugging
$this->EE->config->_global_vars['freebie_debug_uri_cleaned'] = $this->EE->uri->uri_string;

// return empty value if there is no breaking segment.
if(!isset($this->EE->config->_global_vars['freebie_break_1'])){
for ($i = 1; $i <= 11; $i++){
$this->EE->config->_global_vars['freebie_break_'.$i] = '';
}
}
}

/**
Expand Down
14 changes: 11 additions & 3 deletions third_party/freebie/pi.freebie.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,21 @@ function category_match($cat_key)
$this->EE =& get_instance();
$match = '';
$segment = $this->EE->TMPL->fetch_param('segment');
$group_id = $this->EE->TMPL->fetch_param('group_id');
$site_id = $this->EE->TMPL->fetch_param('site_id');
$category_url = $this->EE->config->_global_vars['freebie_'.$segment];
$query_string = "SELECT cat_id, cat_name, cat_description, cat_image FROM exp_categories WHERE cat_url_title = '$category_url'";
if($group_id != ''){
$query_string .= "AND group_id = '$group_id'";
if ($this->EE->TMPL->fetch_param('group_id'))
{
if (substr($this->EE->TMPL->fetch_param('group_id'), 0, 3) == 'not')
{
$query_string .= $this->EE->functions->sql_andor_string($this->EE->TMPL->fetch_param('group_id'), 'exp_categories.group_id', '', TRUE)." ";
}
else
{
$query_string .= $this->EE->functions->sql_andor_string($this->EE->TMPL->fetch_param('group_id'), 'exp_categories.group_id')." ";
}
}

if($site_id != ''){
$query_string .= "AND site_id = '$site_id'";
}
Expand Down