This action allows you to perform tasks based on comment data. For example you can restrict registered users’ email addresses from being used by guests.
Parameters
1. $commentdata – the data of the newly added comment.
Usage
add_action("wpdiscuz_before_wp_new_comment", function($commentdata){
if (!empty($commentdata["comment_author_email"]) && empty($commentdata["user_id"])) {
$is_user_exist = get_user_by("email", sanitize_text_field($commentdata["comment_author_email"]));
if ($is_user_exist) {
wp_die(esc_html__("A user with this email is already registered! Please log in or use a different one!", "wpdiscuz"));
}
}
});
Changelog
Added starting from 7.6.28 version.
