projects
/
WP-Plugins
/
glm-member-db-packaging.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3d6ca08
)
Add an action to the delete member hook.
author
Steve Sutton
<steve@gaslightmedia.com>
Thu, 3 Oct 2019 17:17:33 +0000
(13:17 -0400)
committer
Steve Sutton
<steve@gaslightmedia.com>
Thu, 3 Oct 2019 17:17:33 +0000
(13:17 -0400)
Delete member packages when the member is deleted.
setup/adminHooks.php
patch
|
blob
|
history
diff --git
a/setup/adminHooks.php
b/setup/adminHooks.php
index
608c98d
..
9ad952a
100644
(file)
--- a/
setup/adminHooks.php
+++ b/
setup/adminHooks.php
@@
-62,3
+62,14
@@
add_filter(
13,
1
);
+add_action( 'glm-member-db-delete-member', function( $memberId ){
+ // Verify member id is number.
+ $memberId = filter_var( $memberId, FILTER_VALIDATE_INT );
+ if ( $memberId ) {
+ $this->wpdb->delete(
+ GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX . 'packages',
+ array( 'ref_dest' => $memberId ),
+ array( '%d' )
+ );
+ }
+}, 10, 1 );