croxton / Stash

Stash allows you to stash text and snippets of code for reuse throughout your templates.
GNU General Public License v3.0
197 stars 20 forks source link

Fix Member Groups for EE6 #169

Closed dougblackjr closed 3 years ago

dougblackjr commented 3 years ago

EE6 moved from Member Groups to Roles and Permissions:

Looking at this line: https://github.com/croxton/Stash/blob/fbf177d41a54e813a7c6ec22683203021a2d69ca/system/user/addons/stash/upd.stash.php#L114

This will break when uninstalling in EE6. Changing this to exp_module_member_roles will make it EE6 ready.

Happy to PR this with a version check; just would need to know how you would want to go about that, so it can check whether it would be EE5 or EE6 (i.e. an add-on version check? Checking EE's APP_VER constant?)

croxton commented 3 years ago

Yes please go ahead and make a PR. You can use APP_VER to determine which EE version is in use, e.g.:

if (version_compare(APP_VER, '6.0', '>=')) {
   ee()->db->delete('module_member_roles', array('module_id' => $query->row('module_id')));
} else {
   ee()->db->delete('module_member_groups', array('module_id' => $query->row('module_id'))); 
}