Feature Request: Hide the Login prompt when WP Register is OFF

Solved4.45K viewsGeneral

Sometimes a private WP is run and the Membership option (everybody can register) is OFF.

I would be nice that in the case of private WP, Anspress doesn’t display the login/register form as the end of the Ask Question page.


selected answer

Your request is very specific and IMHO Anspress don’t need it, probably only few people or less will ever use it. That said, You can do it Yourself, it is fairly simple.

You need to add new folder (name it anspress) to Your WordPress theme, like this your_theme/anpress/ To that folder You need to copy login-signup.php file from Your Anspress plugin dir (anspress-question-answer/theme/default/login-signup.php) or download it from here (right click and save file as).

Now there is time to edit that file, and there are two options:

  1. Ugly one – just delete everything but leave <?php at beginning of the file.
  2. Less ugly – edit if statement from beginning to add new condition.

In case of second option now if user is not logged in and You don’t Allow anonymous, then login/register form will be shown. So we need to also check for “Anyone can register” switched off.


<?php if(!is_user_logged_in() && !ap_opt('allow_anonymous')): ?>


<?php if(!is_user_logged_in() && !ap_opt('allow_anonymous') && get_option('users_can_register')): ?>

After edit if user can register, then form will be visible, but if he can’t, then form will be hidden.

That’s it.

commented on answer

Thanks, i will try your suggestions.

I want to hide the form all together. I can probably do this with my SiteOrigin CSS editor plugin but it doesn’t show when logged in. What code can I place there please? i’m also using a login widget so don’t have to consider “anonymous”.

Hello Stacy, Please create an question.

You are viewing 1 out of 1 answers, click here to view all answers.