Skip to Content Skip to Menu

Auto Connect with all Members using CB_Connections

  • slboone
  • slboone
  • OFFLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 0
9 years 11 months ago #253291 by slboone
Is it possible to set cb_connections up in some way that will automatically connect all users to each other as they register? The site is an invitation only site and I would like for all members to be connected so that they can Email all or Send Private Messages to all members. Any thoughts?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48501
  • Thanks: 8284
  • Karma: 1443
9 years 11 months ago - 9 years 11 months ago #253351 by krileon
We have no feature to do this. You'd need to somehow configure CB Auto Actions for it is my best guess. However there's a problem with doing this; performance. Lets say you've 1,000 users. When a user registers that's something like 2,000 queries and 1,000 PHP calls to connect to all of them and that's just for 1 registration. Lets say 5 users register at once. The math exponentially gets worse the more users you have.

The most performance optimized way to do it would be a single database query, but that won't fire any CB triggers or send any notifications. The below query should do what you're wanting and can be used in CB Auto Actions with the Query action on the after registration trigger.

Code:
INSERT INTO `#__comprofiler_members` ( `referenceid`, `memberid`, `accepted`, `pending`, `membersince` ) VALUES ( SELECT '[user_id]', `id`, 1, 0, NOW() FROM `#__users` WHERE `id` != '[user_id]' )

Please note I did not test the above query. Please be sure to test thoroughly and adjust as needed.


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.
Last edit: 9 years 11 months ago by krileon.

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

Moderators: beatnantkrileon
Powered by Kunena Forum