Custom Validation of Forum Thread

Posted in Support Forums and tagged with

What is the custom validation setting for creating a new forum thread? How do I use it?

Hello and thank you for the question.

The custom thread validation feature within the settings panel allows you to restrict who can submit new threads based on custom criteria that you specify.

This can be accomplished by creating your own validation function within your sites functions.php (or other accessible file).  This custom function you create should perform any validations or checks that you choose.  The only requirement is that the output of the function has to return a boolean true in order for the forum thread to be created.  If the function returns a false or any equivalent false value, then the user will be unable to create a new forum thread.

As an example, the below code snippet will check whether the logged in user is an administrator or not.  If so, it will return true.  if not, it will return false.

// Sample Validation Function - Only Admins can submit threads
function my_validation_function(){
    if( current_user_can('administrator') ) {
        return true;
    return false;

If we add this routine into the settings panel, then only administrators will be able to submit new forum threads.

Support Forums - Custom Thread Validation

Note: When entering the function name, just enter the name of the function.  There is no need to include the "()" or ";" characters.

Leave a Reply

Logged in as:

Posted in .