projects
/
WP-Plugins
/
glm-member-db-contacts.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c2a751c
)
Fix if no contact id or no wpUser
author
Steve Sutton
<steve@gaslightmedia.com>
Fri, 7 Sep 2018 19:05:01 +0000
(15:05 -0400)
committer
Steve Sutton
<steve@gaslightmedia.com>
Fri, 7 Sep 2018 19:05:01 +0000
(15:05 -0400)
if not found then nothing
classes/data/dataContacts.php
patch
|
blob
|
history
diff --git
a/classes/data/dataContacts.php
b/classes/data/dataContacts.php
index
bc3ad87
..
4276d14
100644
(file)
--- a/
classes/data/dataContacts.php
+++ b/
classes/data/dataContacts.php
@@
-836,9
+836,13
@@
class GlmDataContacts extends GlmDataAbstract
public function updateContactRole( $contact_id, $old_role, $new_role )
{
$user_id = $this->getWpUserId( $contact_id );
- $wpUser = get_user_by( 'id', $user_id );
- $wpUser->remove_role( $old_role );
- $wpUser->add_role( $new_role );
+ if ( $user_id ) {
+ $wpUser = get_user_by( 'id', $user_id );
+ if ( $wpUser ) {
+ $wpUser->remove_role( $old_role );
+ $wpUser->add_role( $new_role );
+ }
+ }
}
public function getContactIdByRefDest( $ref_dest )