Skip to content

Commit

Permalink
MDL-43005 blogs: Fix issues with blog tags
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitagarwal authored and Sam Hemelryk committed Nov 25, 2013
1 parent 390896d commit 5c1adad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion blog/index.php
Expand Up @@ -40,7 +40,7 @@


//correct tagid if a text tag is provided as a param //correct tagid if a text tag is provided as a param
if (!empty($tag)) { 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; $tagid = $tagrec->id;
} else { } else {
unset($tagid); unset($tagid);
Expand Down
8 changes: 6 additions & 2 deletions blog/lib.php
Expand Up @@ -880,8 +880,12 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
$tagrec = $DB->get_record('tag', array('id'=>$tagid)); $tagrec = $DB->get_record('tag', array('id'=>$tagid));
$PAGE->navbar->add($tagrec->name, $blogurl); $PAGE->navbar->add($tagrec->name, $blogurl);
} elseif (!empty($tag)) { } elseif (!empty($tag)) {
$blogurl->param('tag', $tag); if ($tagrec = $DB->get_record('tag', array('name' => $tag))) {
$PAGE->navbar->add(get_string('tagparam', 'blog', $tag), $blogurl); $tagid = $tagrec->id;
$headers['filters']['tag'] = $tagid;
$blogurl->param('tag', $tag);
$PAGE->navbar->add(get_string('tagparam', 'blog', $tag), $blogurl);
}
} }


// Append Search info // Append Search info
Expand Down

0 comments on commit 5c1adad

Please sign in to comment.