Notifications
Clear all

[Solved] Required Guest Name and Email not functioning

8 Posts
2 Users
2 Reactions
356 Views
Posts: 4
Topic starter
(@markt)
Active Member
Joined: 3 months ago

I have set permissions so that guests can create a new topic, however the required fields for name and email are not set as required. The only field actually required is topic. This is clearly a big problem and as I understand shouldn't be possible in any circumstances. What can I do to make sure Guest email and name are required before submission? I have attached an image of the test site page.


7 Replies
Sofy
Posts: 5513
 Sofy
Admin
(@sofy)
Support Team
Joined: 8 years ago

Hi,

Could you please share the URL where we can see the issue? 


Posts: 4
Topic starter
(@markt)
Active Member
Joined: 3 months ago

Thanks. I have emailed you the link as I wasn't sure how to do this confidentially via the support board


3 Replies
Sofy
 Sofy
Admin
(@sofy)
Joined: 8 years ago

Support Team
Posts: 5513

@markt 

Which email address have you used? 

Please send it to the info[at]gvectors.com email address and share the email subject to allow us to easily find it.  


(@markt)
Joined: 3 months ago

Active Member
Posts: 4

@sofy thanks. I have done that as requested


Sofy
 Sofy
Admin
(@sofy)
Joined: 8 years ago

Support Team
Posts: 5513

@markt 

We'll check and get back to you ASAP. 


Sofy
Posts: 5513
 Sofy
Admin
(@sofy)
Support Team
Joined: 8 years ago

@markt ,

Please use the hook-code below: 

add_filter( 'wpforo_post_after_init_fields', function( $fields ){
    $fields['name']['isRequired'] = $fields['email']['isRequired'] = 1;
    return $fields;
} );

Insert it into your active theme's functions.php file.

Instruction: https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/


Posts: 4
Topic starter
(@markt)
Active Member
Joined: 3 months ago

Hi Sofy, Thanks ever so much. That works perfectly. And so simple. I spent hours with Chat GPT and Gemini trying to sort this out to no avail! We can close this