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 committed Nov 21, 2013
1 parent b58bc15 commit 1af9063
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
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions blog/lib.php
Original file line number Diff line number Diff line change
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));
$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
Expand Down

0 comments on commit 1af9063

Please sign in to comment.