Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…blog is deleted
  • Loading branch information...
commit 89ce191be23835daada6c552d6a3dbc7419f49a4 1 parent 32a0775
@andyjdavis andyjdavis authored nebgor committed
Showing with 9 additions and 0 deletions.
  1. +9 −0 blog/external_blogs.php
View
9 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');
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.