The below can be used to delete a user. You'd simply need to provide a link for it on each users profile.
Global
Triggers: None
Type: Code
User: Self
Access: All Moderators
Conditions
Field: Custom > Value
Custom Value: [get_delete]
Operator: Not Equal To
Value: [user_id]
Action
Method: PHP
Code:
Code:
$user = CBuser::getUserDataInstance( (int) '[get_delete]' );
if ( ! $user->getInt( 'id', 0 ) ) {
return 'User does not exist';
}
if ( ! $user->delete() ) {
return $user->getError();
}
return 'User deleted successfully';
Output
Display: Redirect
URL: index.php
Once saved under the Global tab you'll have a URL to directly execute the auto action. It should be something like the following.
Code:
index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=ACTION_ID_HERE
The above example is dependent on the user being deleted being supplied in the URL. Specifically their user id being set to &delete=USER_ID_HERE. Since this URL is going to be displayed on profile with presumably a Custom HTML field you can substitute that in.
Code:
index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=ACTION_ID_HERE&delete=[user_id]
You could use this in a button, a link, etc.. it ensures only CB Moderators can run the auto action and it won't let them delete themselves. You may want to add other checks as needed though (e.g. check that [get_delete] isn't empty and isn't a moderator).
Just using the built in delete account field provided by CB Privacy would be far simpler though.