Permalink
Browse files

MDL-26504 blog: made it delete external blog posts when the external …

…blog is deleted
  • Loading branch information...
1 parent df4e818 commit fb1b0bc05e7888bcaf88bb3dd1718b74c16600aa @andyjdavis andyjdavis committed with nebgor Aug 16, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 blog/external_blogs.php
@@ -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');
}
}

0 comments on commit fb1b0bc

Please sign in to comment.