[wp-trac] [WordPress Trac] #10931: Verify Comment Email Addresses of Registered Users
WordPress Trac
noreply at wordpress.org
Thu May 6 09:05:36 UTC 2021
#10931: Verify Comment Email Addresses of Registered Users
-------------------------------------+-----------------------------
Reporter: mtdewvirus | Owner: (none)
Type: enhancement | Status: assigned
Priority: normal | Milestone: Future Release
Component: Comments | Version: 2.8
Severity: normal | Resolution:
Keywords: has-patch needs-refresh | Focuses:
-------------------------------------+-----------------------------
Comment (by farhadvn):
i used a function for this problem! Of course, it may not be up to
WordPress standards, but I hope it helps
{{{
function useremailcheck($approved){
// example function
$email = filter_var($_POST["email"],FILTER_SANITIZE_EMAIL) ?: null;
// this SANITIZE is after wordpress validation, so this filter is not make
sense, however wordpress devs can delete or replace it with a standard
wordpress var.
if(is_user_logged_in() === false
// check if 1. user is not loggedin
&& isset($email)
// 2. email is set
&& get_user_by("email",$email) !== false
// 3. we have an user with this email
&& $approved != "spam"
// 4. not marked as spam before
){
$approved = 0;
// Force pending even if comments are open to all
}
return $approved;
}
add_action("pre_comment_approved","useremailcheck",999);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/10931#comment:49>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list