How to best block users based on information in separate database table?

3 years 1 week ago #324278 by fkrauth
Hi,
I have a list of users in a separate table in the database that is being maintained so that it always contains a list of valid users.
How do I best block users in CB (and Joomla) based on this information. E.g. how should the SQL update look like to block users? Or is there another preferred way (like Auto Actions??) to do it?

Thanks.

Frank

Please Log in to join the conversation.

3 years 1 week ago #324282 by krileon
Block them how and where? Block their login? Block their registration? Hide them from userlists? Please be more specific.


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.

3 years 1 week ago #324283 by fkrauth
Hi Kyle,
Sorry for not being specific. They should not be able to login anymore but we don't want to delete them directly. I.e. I guess the same setting as "enabled" yes/no in the CB backend.

Thanks.

Frank

Please Log in to join the conversation.

3 years 1 week ago #324285 by krileon
What is this other information you need to check against? You can directly block users in CB AntiSpam to prevent them from logging in. I would only suggest a custom usage using CB Auto Actions if you have some generic conditions to check against that apply to more than 1 user, but per-user blocking would be significantly easier just blocking them in CB AntiSpam. If you still want a custom solution the below would be how to interrupt login.

Global
Triggers: onDuringLogin
Type: Redirect
User: Automatic
Access: Everybody
Conditions
Field: Query
Custom Query:
SELECT `id` FROM `#__mytable` WHERE `mycolumn` = '[user_id]'
Operator: Not Empty
Action
URL: index.php
Message: Your account has been blocked.

The above checks during the login process if their user_id exists in a custom database table. If it does it'll return the id column of that table which is conditioned against to see if it's not empty and if it's not empty the auto action will execute which will redirect away during login.


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.

3 years 1 week ago #324288 by fkrauth
Hi!
Thanks again.
I need to disable those users where the db query is empty. The select is not a problem. It could be quite a number of users on a regular basis that have to be disabled - basically every time the memberlist db table will be updated with new data.

To redirect the users is not really an option in our case. We want to disable the user.

Is there a way to disable a user with Auto Actions?

Thanks.

Frank

Please Log in to join the conversation.

3 years 1 week ago #324291 by krileon
Yes it's possible to block a users account using auto actions, but there is no way to schedule an auto action to react to your database just being updated. CB Auto Actions needs a trigger to act on. When do you want them to be blocked? When that user attempts to login? If you need it entirely independent of a trigger on your site it gets exponentially more complicated to implement as you'll need to use the Batch feature and a CRON task to schedule for it to regularly check for that.


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.

Moderators: beatnantkrileon
Time to create page: 0.213 seconds

Facebook Twitter LinkedIn