Skip to content

Commit

Permalink
MDL-26504 blog: made it delete external blog posts when the external …
Browse files Browse the repository at this point in the history
…blog is deleted
  • Loading branch information
andyjdavis authored and Aparup Banerjee committed Sep 4, 2012
1 parent df4e818 commit fb1b0bc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions blog/external_blogs.php
Expand Up @@ -44,7 +44,16 @@
if ($delete && confirm_sesskey()) {
$externalbloguserid = $DB->get_field('blog_external', 'userid', array('id' => $delete));
if ($externalbloguserid == $USER->id) {
// Delete the external blog
$DB->delete_records('blog_external', array('id' => $delete));

// Delete the external blog's posts
$deletewhere = 'module = :module
AND userid = :userid
AND ' . $DB->sql_isnotempty('post', 'uniquehash', false, false) . '
AND ' . $DB->sql_compare_text('content') . ' = ' . $DB->sql_compare_text(':delete');
$DB->delete_records_select('post', $deletewhere, array('module' => 'blog_external', 'userid' => $USER->id, 'delete' => $delete));

$message = get_string('externalblogdeleted', 'blog');
}
}
Expand Down

0 comments on commit fb1b0bc

Please sign in to comment.