Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

Assigning usergroup based on CB field value

  • danpoole
  • danpoole
  • OFFLINE
  • Posts: 49
  • Thanks: 6
  • Karma: 0
8 years 2 months ago #284456 by danpoole
Hi, I have followed the tutorial here ( www.joomlapolis.com/documentation/291-cb-auto-actions/tutorials/18237-cb-auto-actions-assigning-usergroup-based-on-cb-field-value )

Everything works fine, as far as I can tell. (See images AutoActions1.jpg to AutoActions4.jpg for my setup)

I am using the 'Internal Users URL: Click to Process' in the CB Auto Actions plugin to move all members with the select field value into the desired user group. (see: AutoActions5.jpg)

Now I know for a fact there should be at-least 2,000 users out of the 7,000 there with the selected field value, but there is only around 600-700 moving across the the desired user group after I click the 'Internal Users URL: Click to Process' link in the CB Auto Actions plugin. AutoActions6.jpg shows the output at the end, is this the way it should look or is it in error?.

I have tried different variations on the Conditions 'Equal To, Not Empty, Does Contain' and the users that move across is different everytime.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
8 years 2 months ago #284464 by krileon
Replied by krileon on topic Assigning usergroup based on CB field value
Looks like your field is a multi-select or multi-checkbox. For those fieldtypes to match properly you need to use a contains operator. For example it's doing the below condition.

[fieldname] Equal To value2
value1|*|value2|*|value3 Equal To value2

That would never pass, but the below should work fine.

[fieldname] Does Contain value2
value1|*|value2|*|value3 Does Contain value2

Regexp usage should also work as follows.

[fieldname] Is REGEX /value2/
value1|*|value2|*|value3 Is REGEX /value2/

Note for your usage you do not need to enable Reload Users or Format Functions.

However, most likely you're hitting performance issues. That many users processed and stored at once is probably crippling your server and hitting memory limits or CPU limits.


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 or Create an account to join the conversation.

  • danpoole
  • danpoole
  • OFFLINE
  • Posts: 49
  • Thanks: 6
  • Karma: 0
8 years 2 months ago #284495 by danpoole
Replied by danpoole on topic Assigning usergroup based on CB field value
Hi, Thanks for the info, I have used [fieldname] Is REGEX /value2/ and it has now moved around 1000 out of the 2000 users successfully.

I think you are on the money about the server limits. I have my own VPS and when running the process it uses around 80% of the CPU and 8% of the memory.

On the server 'PHP Configuration Editor' I also changed the max_execution_time from 120 to 480 with some success getting up to 1500 users moved. What else would I change in the 'PHP Configuration Editor' to get this process to complete without an error.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
8 years 2 months ago #284509 by krileon
Replied by krileon on topic Assigning usergroup based on CB field value
There's no improving that performance. You're wanting to process and store 2,000 users. That's like 2000-3000 database queries alone all at once. In addition to all the PHP for passing them through your action. Until CB Auto Actions has batch processing you need to use it that functionality of it carefully. Your action should also be setup to exclude users that have already been processed so if it does crash half way through you can just run it again until completed. This can be done by using the Access parameter since you're adding usergroups just select every usergroup you want that action to apply to.


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 or Create an account to join the conversation.

  • danpoole
  • danpoole
  • OFFLINE
  • Posts: 49
  • Thanks: 6
  • Karma: 0
8 years 2 months ago #284543 by danpoole
Replied by danpoole on topic Assigning usergroup based on CB field value
Oh My GOD! I'm such a dick! I just realised what I want to achieve can be done by the CB User Management Search & Batch Tools...

and I'm out :blush:

Please Log in or Create an account to join the conversation.

  • danpoole
  • danpoole
  • OFFLINE
  • Posts: 49
  • Thanks: 6
  • Karma: 0
8 years 2 months ago #284550 by danpoole
Replied by danpoole on topic Assigning usergroup based on CB field value
and I'm back :angry:

The CB User Management Search & Batch Tool doesn't quite do the job, I need the auto actions after all.

I am just doing as you said, just keep hitting 'Click to Process' and when it crashes because of too many requests, just do it again and the last lot of users get moved over, then do it again and the next lot of users get moved over. This was working, the 1st time it moved roughly 1500 users, the 2nd time i ran the process it was about 700, then the next time, about 200, then every time after that it would only add one user each time. It is like it will only do the first 2500 (or so) requests and it got to a stage where the first 2500 users did not have any of the requirements to process???

Anyway, this is probably a php, mysql limitation... (i'm not really a programmer, so i don't know). So I guess I'm saying "Bring on CB Auto Actions batch processing". Until then I am splitting the users into temp user groups (1500 each) and I will run the Auto Actions one at a time :whistle:

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum