Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Extensions
wp-civicrm-mailer
Commits
d50f6a28
Commit
d50f6a28
authored
Oct 19, 2020
by
samuelsov
Browse files
coopsymbiotic/wordpress/wp-civicrm-mailer#1 avoid creating duplicate contact in CiviCRM
parent
0f5f54ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
civicrm_mailer.http.class.php
View file @
d50f6a28
...
...
@@ -41,6 +41,21 @@ class CivicrmMailerHTTPMailer extends \PHPMailer
if
(
$user
&&
$user
->
ID
)
{
$uf_id
=
$user
->
ID
;
}
else
{
// special case of email change request
// check if a _new_email correspond in wp_usermeta
$args
=
[
'fields'
=>
'user_id'
,
'meta_key'
=>
'_new_email'
,
'meta_value'
=>
$recipient
,
'meta_compare'
=>
'LIKE'
,
];
$q
=
new
\
WP_User_Query
(
$args
);
$res
=
$q
->
get_results
();
// if we have only one result, assume it's the user we need
if
(
count
(
$res
)
==
1
&&
isset
(
$res
[
0
]))
$uf_id
=
$res
[
0
];
}
if
(
$uf_id
)
{
try
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment