Search
Close
AI Search
Classic Search
Share:
Notifications
Clear all
Topic starter
21/02/2025 2:00 pm
Translate
▼
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
Starting from version 7.6.28, a new hook "wpdiscuz_before_wp_new_comment", has been added.
This action allows you to perform tasks based on comment data. For example, you can use it to prevent guests from using registered users’ email addresses.
To achieve this, use the following hook code:
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"));
}
}
});
The red-marked text can be customized as needed.
For a step-by-step guide on adding custom code to WordPress without breaking your site, check out this article: https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/
In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.
Share:

