Actions for postmeta updates. Props Demitrious Kelly. see #10750

git-svn-id: https://develop.svn.wordpress.org/trunk@11968 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2009-09-24 17:10:28 +00:00
parent dfed9737d7
commit 578e956287
5 changed files with 68 additions and 19 deletions
+6 -2
View File
@@ -1163,7 +1163,10 @@ function do_enclose( $content, $post_ID ) {
foreach ( $pung as $link_test ) {
if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $link_test . '%') );
$mid = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $link_test . '%') );
do_action( 'delete_postmeta', $mid );
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE post_id IN(%s)", implode( ',', $mid ) ) );
do_action( 'deleted_postmeta', $mid );
}
}
@@ -1186,6 +1189,7 @@ function do_enclose( $content, $post_ID ) {
if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) {
$meta_value = "$url\n$len\n$type\n";
$wpdb->insert($wpdb->postmeta, array('post_id' => $post_ID, 'meta_key' => 'enclosure', 'meta_value' => $meta_value) );
do_action( 'added_postmeta', $wpdb->insert_id, $post_ID, 'enclosure', $meta_value );
}
}
}
@@ -3386,4 +3390,4 @@ function wp_scheduled_delete() {
wp_delete_comment($comment['comment_id']);
}
}
?>
?>