AP: Required email field when not logged in

Solved5.08K viewsCoreemail email verification

Hello Rahul,

Here’s the question we’ve been skype about.

1. Required email field when not logged in

2. After sending the form check off there is a user with that email.

  • If not: Then make a user account with nickname from everything before the @ and use the email
  • If found then use that one for email correspodation if someone react on the question

I hope this is enough information.


greetz Rik

Question is closed for new answers.
restored answer

@rahul: Nice job and almost there, a few fixes i think.


  1. syntax error on:

    public function __construct() {public function __construct() {
    add_action( ‘ap_ask_form_fields’, [ __CLASS__, ‘ap_ask_form_fields’ ] ); add_action( ‘ap_after_new_question’, [ __CLASS__, ‘save_custom_meta’ ], 1, 2 ); }

  2. I see the option when i’m login. Can you fix that it not visible or that there is the email of the login of the user.

  3. I get a email that there is a new question with user Anonymous when i’m not login and the user exist.
  4. If the user exist is the question then linked to the account ?
  5. When no user exist it makes a account and i think that is working. I get a email with the user info and not Anonymous. So i think this is ok.


I will send bij email FTP and login of the panel.

Great Job 🙂

commented on answer

@rahul you see this ?


Hello Rik,

Include below file in your theme or just paste it in theme’s functions.php

Loading Gist...
commented on answer

Please update this code compatible with the latest anspress version. It is not working in for Anspress 4. As the ap_ask_form_fields has been deprecated in newer version. Thanks.