Skip to Content Skip to Menu

Substition in a list for Connections

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
7 years 1 month ago #298276 by chanteur94
Substition in a list for Connections was created by chanteur94
Hi

I would like to obtain a list of users who have connections.
It seems that the table of the connections is 'xxxx_comprofiler_members' and the column is 'accepted'

I try something like this :

((select count(*) from `xxxx_comprofiler_members` AS m where m.`accepted` = '1' ) > 0 ) but the result return all the users.

The same with :

(select count(*) from `xxxx_comprofiler_members`)


Any help ?

Thank you

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
7 years 1 month ago #298291 by krileon
Replied by krileon on topic Substition in a list for Connections

((select count(*) from `xxxx_comprofiler_members` AS m where m.`accepted` = '1' ) > 0 ) but the result return all the users.

Your filter doesn't include matching their CB row to the connections table row. You need to add the following.

Code:
m.`referenceid` = u.'id'

So your query should look like the below for example.

Code:
SELECT COUNT( * ) FROM `#__comprofiler_members` AS m WHERE m.`referenceid` = u.`id` AND m.`accepted` = 1

For userlist query the "u" alias is for Joomlas users table and the "c" alias is for CBs _comprofiler table. This allows access to CB and Joomla data.


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.
The following user(s) said Thank You: chanteur94

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

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
7 years 1 month ago #298298 by chanteur94
Replied by chanteur94 on topic Substition in a list for Connections
Thank you for the good answer.
I forget to ask the same request with members who have connections WITH ME (the login member)

So I try your answer with :

SELECT COUNT( * ) FROM `#__comprofiler_members` AS m WHERE m.`referenceid` = '[id]' AND m.`accepted` = 1

but didn't work.

PS : in the table #__comprofiler_members what is the column of the 'login member' : referenceid or memberid

Help.

Best regards.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
7 years 1 month ago #298299 by krileon
Replied by krileon on topic Substition in a list for Connections
[id] isn't a substitution. To get the viewing users user id you need to use [user_id]. referenceid is the user who created the connection request. memberid is the recipient of the connection request. There will be 2 rows for a connection reversing those as needed if you're using cross connections.


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.

  • chanteur94
  • chanteur94
  • OFFLINE
  • Posts: 302
  • Thanks: 13
  • Karma: 1
7 years 1 month ago #298300 by chanteur94
Replied by chanteur94 on topic Substition in a list for Connections
Very strange :
when i use an user_id who have 'connections' with this select :

SELECT COUNT( * ) FROM `#__comprofiler_members` AS m WHERE m.`referenceid` = 554 AND m.`accepted` = 1

the answer return ALL THE MEMBERS and not only members who have connections with user_id=554.

PS : if the user_id have no connections, the answer return 0 registered. (that's normal)

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
7 years 1 month ago #298304 by krileon
Replied by krileon on topic Substition in a list for Connections
Enable debug mode and maximum error reporting in Joomla global configuration and debug the query at the bottom of the page in the query log. You can test the query from the log in phpmyadmin directly to help refine your query. referenceid is the user making the connection so you're querying for connections that 554 has connected to not necessarily users who have connected to 554, which if that's what you're wanting you need to use memberid.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum