Theoretically, yes. Although the practical application isn’t necessarily laid out.
You’d have to have a way of determining “inactivity” – maintaining some method of setting a user meta or other data field to keep track of when the user was last active. But provided you could work that out, then you could use one of two API functions in the plugin to either remove the membership or set the expiration date to expired.
wpmem_remove_user_product() (or, as an alias, wpmem_remove_user_membership()) can be used to remove a membership from a user. See: https://rocketgeek.com/plugins/wp-members/docs/api-functions/wpmem_remove_user_product/
wpmem_set_user_product() (or its alias, wpmem_set_user_membership()) can be used to set a user’s expiration date to a specific date (including one that is expired). See: https://rocketgeek.com/plugins/wp-members/docs/api-functions/wpmem_set_user_product/
i use https://wordpress.org/plugins/sucuri-scanner/ which maintains last login: meta_key=wp-last-login in wp_usermeta
or roll ur own;-)
Thread Starter
Bloke
(@bloke)
Would I use wpmem_remove_user_membership() in my theme’s functions or do I have create my own plugin?
Either/or.
Theme functions.php is (was) the WP standard. But that makes it “theme specific”, meaning that if you change your theme, you need to port over any custom code snippets.
The “preferred” method for customizations that are not style/layout (i.e. theme related) is to create a plugin file.
Or use a code snippets plugin.
Thread Starter
Bloke
(@bloke)
wpmem_remove_user_membership() is not found on the link provided above.
Correct – it’s an alias of wpmem_remove_user_product() – they’re the same function.