Incorrect list of connections

12 years 1 month ago #194859 by sarphati
Incorrect list of connections was created by sarphati
I am trying to get a list of connections programmatically.

It is fairly simple:
$query->select('c.id, c.user_id, c.firstname, c.middlename, c.lastname, c.avatar, c.avatarapproved, c.approved, c.confirmed, c.cbactivation, c.banned, c.cb_state, u.email, u.username, c.city, c.state')
->from('`#__comprofiler_members` m')
->leftjoin('`#__comprofiler` c ON c.id = m.referenceid')
->leftjoin('`#__users` u ON u.id = c.user_id');
$query->where('c.banned = 0');
$query->where('m.pending = 0');
$query->where('m.accepted = 1');
$query->where('m.memberid = '.$id);
$query->where('c.approved = 1');
$query->where('c.confirmed = 1');

Is there an existing 'connections' class I can use?

I ask because this is giving me an incorrect result.

The above query give me 3 user records.
If I go to 'connection manager', I get 2 records.
My query must not be correct.
I just can't see what other condition is restricting the results in connection manager to only users 46 and 47.

If there was a 'connections' class I could use, this would solve the problem. The connections class would all ready have all the conditions in the selection... I would assume.

Here is the data from the members table (user 45 is not showing up in the connection manager):
(`referenceid`, `memberid`, `accepted`, `pending`, `membersince`, `reason`, `description`, `type`)
(45, 43, 1, 0, '2012-03-10', '', NULL, NULL),
(43, 45, 1, 0, '2012-03-10', '', '', ''),
(47, 43, 1, 0, '2012-03-19', '', NULL, NULL),
(43, 47, 1, 0, '2012-03-19', '', '', ''),
(46, 43, 1, 0, '2012-03-19', '', 'some comment', 'Family'),
(43, 46, 1, 0, '2012-03-19', '', '', '');

Here are the 3 users:

(`id`, `user_id`, `firstname`, `middlename`, `lastname`, `hits`, `message_last_sent`, `message_number_sent`, `avatar`, `avatarapproved`, `approved`, `confirmed`, `lastupdatedate`, `registeripaddr`, `cbactivation`, `banned`, `banneddate`, `unbanneddate`, `bannedby`, `unbannedby`, `bannedreason`, `acceptedterms`, `website`, `location`, `occupation`, `interests`, `company`, `address`, `city`, `state`, `zipcode`, `country`, `phone`, `fax`)

(45, 45, 'Sanual', NULL, 'Sarphati', 10, '0000-00-00 00:00:00', 0, '', 1, 1, 1, '2012-02-27 09:18:07', '2.25.51.63', '', 0, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 'SLO', NULL, NULL, 'Austria', NULL, NULL)

(46, 46, 'Sandra', NULL, 'Rio', 1, '0000-00-00 00:00:00', 0, '', 1, 1, 1, '2012-03-19 07:55:17', '212.41.200.53', '', 0, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 'Innsbruck', NULL, NULL, 'Austria', NULL, NULL)

(47, 47, 'Tamara', NULL, 'Jones', 1, '0000-00-00 00:00:00', 0, '', 1, 1, 1, '2012-03-19 07:55:17', '86.160.206.168', '', 0, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 'London', NULL, NULL, 'United Kingdom', NULL, NULL);

Please Log in to join the conversation.

12 years 1 month ago #194895 by krileon
Replied by krileon on topic Re: Incorrect list of connections
If this is being done in PHP you can use CB API to accomplish this. For example the below (assume CB API is already loaded, see tutorials in signature otherwise) gives me a list of connections.
$connections	=	cbConnection::getActiveConnections( USER_ID );


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 1 month ago #194901 by sarphati
Replied by sarphati on topic Re: Incorrect list of connections
That is exactly what I am looking for.
However, I cannot find the documentation for it.

All I found was the CB API version 1.4. This did not cover what methods can be used for working with connections, avatars, etc.

It also did not cover your example: cbConnection::getActiveConnections()

Where can I find that?

Thanks!

Please Log in to join the conversation.

12 years 1 month ago #194911 by krileon
Replied by krileon on topic Re: Incorrect list of connections
There's no documentation on this specific usage, include CBs API, do a cbimport( 'cb.html' ) so all the main API files load in, then call the above function. For including CB API please see tutorials within my signature.


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.688 seconds

Facebook Twitter LinkedIn