/ / Як я можу обмежити незареєстрованих користувачів певним вмістом або сторінками у wordpress - php, wordpress, wordpress-плагін, wordpress-theming, wordpress-login

як я можу обмежити незареєстрованих користувачів певним вмістом або сторінками в wordpress - php, wordpress, wordpress-плагін, wordpress-theming, wordpress

Я розробляю веб-сайт з wordpress, який маєобласть коментарів у галереї фотографій і деякі сторінки навчальних відео. Як я можу обмежити unlogged користувачів від надання коментарів і збирається на сторінці відео. До цих пір у мене є Google багато, але не отримав будь-яке рішення, пов'язане з моєю проблемою. Я вже шукав багато плагінів, але він не використовував Для реєстрації я використовую плагін регістр пиріг моя слово-преса тема параболи. Я спробував внести деякі зміни в файл comment.php у папці теми:

<?php
/**
* The template for displaying Comments.
*
* The area of the page that contains both current comments
* and the comment form. The actual display of comments is
* handled by a callback to tc_comment_callback()
*
* @package Customizr
* @since Customizr 1.0
*/

/*
* If the current post is protected by a password and
* the visitor has not yet entered the password we will
* return early without loading the comments.
*/
if ( have_comments() )
echo apply_filters( "tc_comment_separator", "<hr class="featurette-divider ". current_filter() ."">" );
?>

<div id="comments" class="<?php echo apply_filters( "tc_comments_wrapper_class" , "comments-area" ) ?>" >
<?php
if( is_user_logged_in() )
{
comment_form( array( "title_reply" => __( "Leave a Comment" , "customizr" ) ) );
if ( have_comments() )
do_action ( "__comment" );
}
?>
</div><!-- #comments .comments-area -->

Відповіді:

0 для відповіді № 1

Простіше кажучи a ! раніше is_user_logged_in().

Наприклад:

if( !is_user_logged_in() ) {
// Content shown for non-users
}

if( is_user_logged_in() ) {
// Content shown for authorized users
}