Permalink
Browse files

MDL-43005 blogs: Fix issues with blog tags

  • Loading branch information...
1 parent 390896d commit 5c1adaddba737f41df8ee3d5df5165e02d9d2144 @ankitagarwal ankitagarwal committed with Sam Hemelryk Nov 21, 2013
Showing with 7 additions and 3 deletions.
  1. +1 −1 blog/index.php
  2. +6 −2 blog/lib.php
View
@@ -40,7 +40,7 @@
//correct tagid if a text tag is provided as a param
if (!empty($tag)) {
- if ($tagrec = $DB->get_record_sql("SELECT * FROM {tag} WHERE ". $DB->sql_like('name', '?', false), array("%$tag%"))) {
+ if ($tagrec = $DB->get_record('tag', array('name' => $tag))) {
$tagid = $tagrec->id;
} else {
unset($tagid);
View
@@ -880,8 +880,12 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
$tagrec = $DB->get_record('tag', array('id'=>$tagid));
$PAGE->navbar->add($tagrec->name, $blogurl);
} elseif (!empty($tag)) {
- $blogurl->param('tag', $tag);
- $PAGE->navbar->add(get_string('tagparam', 'blog', $tag), $blogurl);
+ if ($tagrec = $DB->get_record('tag', array('name' => $tag))) {
+ $tagid = $tagrec->id;
+ $headers['filters']['tag'] = $tagid;
+ $blogurl->param('tag', $tag);
+ $PAGE->navbar->add(get_string('tagparam', 'blog', $tag), $blogurl);
+ }
}
// Append Search info

0 comments on commit 5c1adad

Please sign in to comment.