[SOLVED] Allow users to deactivate (unpublish) their profil

12 years 9 months ago #168726 by krileon

Still loving that my users can activate or deactivate their account, but now I'm facing another problem. Suppose I want to Ban their profile for some reason, they can always simply select Enable and reactivate their account.
Is there a way to allow them to reactivate their account, only if the reason = Account manually disabled?

Absolutely, please use the below query.
UPDATE `#__comprofiler` SET `banned` = 0, `unbanneddate` = NOW() WHERE `user_id` = '[user_id]' AND `bannedreason` = 'Account manually disabled'

The above would only unban them if the reason is exactly "Account manually disabled" (without quotes).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 9 months ago #168738 by userbk
Thanks K, but the problem is that even if a moderator disables the account for say "Cause I feel like it" reason and then the user disables his own account, the reason turns into "Account manually disabled" and then he can simply update the account again with enabled selected and it unbans it :dry:

Please Log in to join the conversation.

12 years 9 months ago #168744 by krileon

userbk wrote: Thanks K, but the problem is that even if a moderator disables the account for say "Cause I feel like it" reason and then the user disables his own account, the reason turns into "Account manually disabled" and then he can simply update the account again with enabled selected and it unbans it :dry:

Of course, the query only addresses unsetting of the ban and not setting of the ban. The below would address setting of the ban.
UPDATE `#__comprofiler` SET `banned` = 1, `banneddate` = NOW(), `bannedby` = '[user_id]', `bannedreason` = 'Account manually disabled' WHERE `user_id` = '[user_id]' AND `bannedreason` IN ( '', 'Account manually disabled' )

Please understand this is basic MYSQL and time consuming to continually personalize. I recommend reviewing the below MYSQL documentation.

dev.mysql.com/doc/refman/5.0/en/index.html


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 9 months ago #168750 by userbk
Thanks K, I will read it and try to learn. Thanks for your help!!
BK

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.247 seconds

Facebook Twitter LinkedIn