WordPress.org

Ready to get started?Download WordPress

Forums

Allow registered users to comment as guests (2 posts)

  1. yedidel
    Member
    Posted 2 years ago #

    Hi,

    On my site I need that the comments form will work the same for guests and for registered users, meaning that anyway they will need to enter name and email.
    This is needed so registered users can comment anonymously.

    Any idea how this can be done?

  2. yedidel
    Member
    Posted 2 years ago #

    Well I found a solution at last, but had to modify core files:

    /wp-comments-post.php - commented: $user = wp_get_current_user();

    And I wrote a plugin that overrides pluggabble function is_user_logged_in. the $widget param is to still show user details in areas on the page that need to see he is logined:

    if ( !function_exists('is_user_logged_in') ) :
    function is_user_logged_in($widget = 0) {
    $user = wp_get_current_user();

    if ( empty( $user->ID ) || (is_single() && $widget == 0 ))
    return false;
    else return true;
    }
    endif;

Topic Closed

This topic has been closed to new replies.

About this Topic