mrsdonovan

hack to wp-ajax-edit-comments to avoid cross-editing posts

Aug 23rd, 2012
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.02 KB | None | 0 0
  1.             if (!AECCore::is_comment_owner($comment->comment_ID) && !is_user_logged_in() ) {
  2.                 //For anonymous users
  3.                 $content .= "<div class='$edit_admin $clearfix' id='edit-comment-user-link-$comment->comment_ID' style='background:none'>";
  4.                 $content .= AECCore::build_admin_links($comment->comment_ID, $comment->comment_post_ID);
  5.                 $content .= "</div>";
  6.                 //Show custom content to users
  7.                 if (AECCore::show_affiliate_link()) {
  8.                     $message = do_shortcode(stripslashes($aecomments->get_admin_option( 'affiliate_text' )));
  9.                     $message = str_replace("[url]", "<a href='http://www.ajaxeditcomments.com/?affiliate_id=" . $aecomments->get_admin_option( 'affiliate_id' ) . "'>",$message);
  10.                     $message = str_replace("[/url]", "</a>", $message);
  11.                     $content .= "<div class='aec-custom-text'>$message</div><!--/aec-custom-text-->";
  12.                 }
  13.                 //End for anonymous users
  14.             } else {
  15.                 //Check if user is editor
  16.                 $role = AECUtility::get_user_role();
  17.                 global $user_ID;
  18.                
  19.                 //todo change editor to capability
  20.                 if ($role == 'editor' && $aecomments->get_admin_option( 'allow_editing_editors' ) == 'false')
  21.                     return $content;
  22.                
  23.                
  24.                 if (is_admin() && $aecomments->get_admin_option( 'admin_editing' ) == "false") {
  25.                     //We're in the admin panel
  26.                    
  27.                     $content .= '<div class="' .$edit_admin. ' ' . $clearfix.'" id="edit-comment-admin-links' . $comment->comment_ID . '">';
  28.                     $content .= AECCore::build_admin_links($comment->comment_ID, $comment->comment_post_ID);
  29.                     $content .= "</div>";
  30.                     //End in the admin panel
  31.                    
  32.                 } elseif ( ( $aecomments->get_user_option( 'comment_editing' ) == "true" && $comment->user_id == $user_ID ) || current_user_can ('administrator')) {
  33.                    
  34.                     //We're in a post
  35.                    
  36.                     $content .= '<div class="' . $edit_admin . ' ' . $clearfix . '" id="edit-comment-admin-links' . $comment->comment_ID . '" style="background: none">';
  37.                     $content .= AECCore::build_admin_links($comment->comment_ID, $comment->comment_post_ID);
  38.                     $content .= "</div>";
  39.                    
  40.                 }
Add Comment
Please, Sign In to add comment