Skip to content

Instantly share code, notes, and snippets.

@litzinger
Created July 10, 2012 21:03
Show Gist options
  • Save litzinger/3086214 to your computer and use it in GitHub Desktop.
Save litzinger/3086214 to your computer and use it in GitHub Desktop.
Allow multiple entry ids to be used in the Tag tags method
*** Tag_4.1.1/EE2/system/expressionengine/third_party/tag/mod.tag.php 2012-04-16 12:50:20.000000000 -0500
--- www/third_party/tag/mod.tag.php 2012-07-10 15:58:15.000000000 -0500
***************
*** 818,824 ****
// Entry id
// ----------------------------------------
! if ( ctype_digit( ee()->TMPL->fetch_param('entry_id') ))
{
$this->entry_id = ee()->TMPL->fetch_param('entry_id');
}
--- 818,824 ----
// Entry id
// ----------------------------------------
! if ( ee()->TMPL->fetch_param('entry_id') )
{
$this->entry_id = ee()->TMPL->fetch_param('entry_id');
}
***************
*** 839,857 ****
// Start SQL
// ----------------------------------------
! $sql = "SELECT t.tag_name,
! t.tag_id, t.tag_name AS tag,
! t.gallery_entries,
! t.channel_entries,
! t.total_entries,
! {$tag_group_sql_insert}
! t.clicks
! FROM exp_tag_tags t
! LEFT JOIN exp_tag_entries e
! ON t.tag_id = e.tag_id
! WHERE t.site_id
! IN ('".implode("','", ee()->db->escape_str(ee()->TMPL->site_ids))."')
! AND e.entry_id = '".ee()->db->escape_str($this->entry_id)."'";
// ----------------------------------------
// Exclude?
--- 839,861 ----
// Start SQL
// ----------------------------------------
! // Allow searching on multiple entries
! $entry_ids = explode('|', $this->entry_id);
!
! $sql = "SELECT t.tag_name,
! t.tag_id, t.tag_name AS tag,
! t.gallery_entries,
! t.channel_entries,
! t.total_entries,
! {$tag_group_sql_insert}
! t.clicks
! FROM exp_tag_tags t
! LEFT JOIN exp_tag_entries e
! ON t.tag_id = e.tag_id
! WHERE t.site_id
! IN ('".implode("','", ee()->db->escape_str(ee()->TMPL->site_ids))."')
! AND e.entry_id
! IN ('".implode("','", $entry_ids)."')";
// ----------------------------------------
// Exclude?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment