Skip to Content Skip to Menu

[SOLVED] Drop Down Menu on a Member Tab that shows all site members

  • krileon
  • krileon
  • ONLINE
  • Posts: 48495
  • Thanks: 8284
  • Karma: 1443
10 years 5 days ago - 10 years 5 days ago #252413 by krileon
formatname doesn't exist in the database. It's calculated in PHP. You need to use username, name, etc.. Please see my above configuration; you need to set the what column is used for label and value of the options. You also should not store name, username, etc.. for the value and should use their id; it will always display the label on profile. For name you'd make the following change.

FROM:
Code:
SELECT u.`id`, u.`username`
Label Column: username

TO:
Code:
SELECT u.`id`, u.`name`
Label Column: name


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: 10 years 5 days ago by krileon.
The following user(s) said Thank You: Smooth2SITF

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

10 years 4 days ago - 10 years 4 days ago #252450 by Smooth2SITF
I actually made it kinda work this way, I had to reverse the name and id to make the names populate and not the id numbers:

SELECT u.`name`, u.`id`
FROM `#__comprofiler` AS c
INNER JOIN `#__users` AS u
ON u.`id` = c.`id`
WHERE c.`confirmed` = 1
AND c.`approved` = 1
AND u.`block` = 0
ORDER BY u.`name`

This works, but the only thing is that it sorts by first name (because I have to use the "name" field to order by) instead of last name then first name. I tried to correct the ORDER BY by using ORDER BY u.`lastname` but I got a error message.

This works, so I can use it this way if I have to.

I have 2 more related questions, does the part: WHERE c.`confirmed` = 1, does it (the 1) mean it does or does not show confirmed users or approved users or blocked users?

Also, is there something, possibly another query or CustomHTML field I can create that will show on the user/members tab a running count of how many members they themselves have recruited/sponsored, based on the above formula? I guess it would read how many times their "name" field was used?
Last edit: 10 years 4 days ago by Smooth2SITF.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48495
  • Thanks: 8284
  • Karma: 1443
10 years 2 days ago #252502 by krileon

This works, but the only thing is that it sorts by first name (because I have to use the "name" field to order by) instead of last name then first name. I tried to correct the ORDER BY by using ORDER BY u.`lastname` but I got a error message.

First, Middle, and Last do not exist in Joomla. You need to make sure you use the "c" alias instead of "u" alias (e.g. c.`firstname`).

I have 2 more related questions, does the part: WHERE c.`confirmed` = 1, does it (the 1) mean it does or does not show confirmed users or approved users or blocked users?

The query is designed to only show users that are approved, confirmed, and not disabled.

Also, is there something, possibly another query or CustomHTML field I can create that will show on the user/members tab a running count of how many members they themselves have recruited/sponsored, based on the above formula? I guess it would read how many times their "name" field was used?

Yes, you'd need to use CB Query Field and its Query fieldtype. You'd then need to do a count query for every user that has that field set to the users ID. Example as follows.

Code:
SELECT COUNT(*) FROM `#__comprofiler` WHERE `cb_sponsor` = '[user_id]'

The above assumes your Query Select field has a name of "cb_sponsor"; replace 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.
The following user(s) said Thank You: Smooth2SITF

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

10 years 1 day ago #252544 by Smooth2SITF
OK Great! This works!:

SELECT u.`name`, u.`id`
FROM `#__comprofiler` AS c
INNER JOIN `#__users` AS u
ON u.`id` = c.`id`
WHERE c.`confirmed` = 1
AND c.`approved` = 1
AND u.`block` = 0
ORDER BY c.`lastname` , c. `firstname`

So I am assuming that "c" = CB fields and "u" = Joomla fields and "1" means yeas and "0" means no


And, I created this formula below and it works great!

SELECT COUNT(*)
FROM `#__comprofiler`
WHERE `cb_recruitedby` = '[name]'

Thanks for your professional insight and help. I am not that good at coding and trying to learn. This is valuable information and I appreciate it. Thanks for your patience in helping me get it working correctly
The following user(s) said Thank You: nant, krileon

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48495
  • Thanks: 8284
  • Karma: 1443
10 years 1 day ago #252575 by krileon

So I am assuming that "c" = CB fields and "u" = Joomla fields and "1" means yeas and "0" means no

Correct.

Thanks for your professional insight and help. I am not that good at coding and trying to learn. This is valuable information and I appreciate it. Thanks for your patience in helping me get it working correctly

Glad I could be of help. :)


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: nant, Smooth2SITF

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

Moderators: beatnantkrileon
Powered by Kunena Forum