+// Adds an 'x' link next to author URLs, clicking will remove the author URL and show an undo link
+function akismet_remove_comment_author_url() {
+ if ( !empty($_POST['id'] ) && check_admin_referer( 'comment_author_url_nonce' ) ) {
+ global $wpdb;
+ $comment = get_comment( intval($_POST['id']), ARRAY_A );
+ if (current_user_can('edit_comment', $comment['comment_ID'])) {
+ $comment['comment_author_url'] = '';
+ do_action( 'comment_remove_author_url' );
+ print(wp_update_comment( $comment ));
+ die();
+ }
+ }
+}
+
+add_action('wp_ajax_comment_author_deurl', 'akismet_remove_comment_author_url');
+
+function akismet_add_comment_author_url() {
+ if ( !empty( $_POST['id'] ) && !empty( $_POST['url'] ) && check_admin_referer( 'comment_author_url_nonce' ) ) {
+ global $wpdb;
+ $comment = get_comment( intval($_POST['id']), ARRAY_A );
+ if (current_user_can('edit_comment', $comment['comment_ID'])) {
+ $comment['comment_author_url'] = esc_url($_POST['url']);
+ do_action( 'comment_add_author_url' );
+ print(wp_update_comment( $comment ));
+ die();
+ }
+ }
+}
+
+add_action('wp_ajax_comment_author_reurl', 'akismet_add_comment_author_url');
+