theyuv
asked 7 years ago

Hello,
In some of the functions in Handle.php (eg: update_question() ), you don’t return false; after validation fails.
Is this on purpose?
For example, in the submit_question function (line 296 in Handle.php), if the question-title is missing, then you exit from the function.
However, in the update_question function (line 472), if the question-title is missing, then you proceed with the function (ie: the question is still updated).
Should I correct this or was this done on purpose?
Thank you.

1 Answers
Allen
answered 7 years ago

Hi, you don’t have to concern about this, the  `return false;` there doesn’t matter. Example in function submit_question() , after all the dwqa_add_notice() you can see a check :

if ( dwqa_count_notices( 'error' ) > 0 ) {
return false;
}

that check mean if have a notice it wiill return fail. The code is ok, i’m not the developer of the plugin so i’m not sure why not return fail when have a notice. it might be not clean coding or that is his logic.

theyuv
replied 7 years ago

Ok. I missed that.
Thank you.

Powered by DW Question & Answer Pro