Skip to content

Commit

Permalink
little clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
bologer committed Nov 18, 2018
1 parent a90c9b4 commit 742c5a0
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 deletions includes/AnyCommentRender.php
Expand Up @@ -2,14 +2,10 @@

namespace AnyComment;


if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

use WP_Comment;
use WP_User;

use AnyComment\Helpers\AnyCommentTemplate;
use AnyComment\Models\AnyCommentRating;
use AnyComment\Rest\AnyCommentSocialAuth;
Expand Down Expand Up @@ -256,38 +252,12 @@ public function override_comment( $atts ) {
] );
}

$path = ANYCOMMENT_ABSPATH . 'templates/comments.php';
$path = ANYCOMMENT_ABSPATH . '/templates/comments.php';

if ( $isInclude ) {
return AnyCommentTemplate::render( 'comments' );
}

return $path;
}

/**
* Check whether current user has ability to edit comment.
*
* @param WP_Comment $comment
*
* @return bool
*/
public function can_edit_comment( $comment ) {
if ( current_user_can( 'moderate_comments' ) ||
current_user_can( 'edit_comment', $comment->comment_ID ) ) {
return true;
}

if ( $this->is_old_to_edit( $comment ) ) {
return false;
}

$user = wp_get_current_user();

if ( ! $user instanceof WP_User ) {
return false;
}

return (int) $user->ID === (int) $comment->user_id;
}
}

0 comments on commit 742c5a0

Please sign in to comment.