Skip to Content Skip to Menu

custom sorting my userlists

  • jakobe75
  • jakobe75
  • OFFLINE
  • Posts: 349
  • Thanks: 9
  • Karma: 3
12 years 4 months ago #187346 by jakobe75
custom sorting my userlists was created by jakobe75
I am using

Joomla 1.7
CB 1.7.1
CBsubs 1.2.2



When users join they choose which category their company falls into.

They are also presented with the option of a free account or a paid (elite) account.

The paid account I want to grant the special access to certain tabs or fields (no problems there...CBsubs does this perfectly)

I also want them listed first on the userlist for their category.


This is what I tried and it doesnt seem to be working....

- I created a dropdown field called "cb_eliteregsuccess" with two options 1 and 0

- upon creation of the paid plan CBsubs changes the normally null field to "1"

- This allows me to say "Hey, only those with "1" in field-X can be here"
and in most places such as 3rd party cb modules that allow filtering, this would allow me to filter out the paid users. Thus being able to grant users incentives to pay as it lets their awesome paid profile appear in featured user modules on the site without me having to do it manually.
(typically software4Joomla's modules have this filtering option)


Now onto why I thought I could use this field on the the CB lists,

The lists correspond with the categories the user has selected..I have one called "Hardware"

I have set the list to sort by cb_eliteregsuccess [asc] and to also sort by company name as the secondary sort cb_bizname [asc]


so in theory... Shouldnt only the users who have a value in the cb_eliteregsuccess field be listed first? and then it also grabs any user with a value in the business name field secondary?


If this isnt the correct way, then please could you get me on the right track.


My filtering for this particular list is setup as:

`cb_bizname` IS NOT NULL AND `cb_bizname` != "" AND `cb_category` ='hardware'


This seems to filter and show only those who have properly filled out their profile with a business name and that are in the category "hardware"

I added the first part because I dont want users displayed on the lists unless their profiles have been filled out to a certain degree, but I dont want to force them to do this at registration as it makes the registration form too long.

but how to give the Elite users hierarchy on the list?
I thought I had it nailed with the sort feature being able to have multiple entries.


Its been a long day with this site, maybe I'm just overlooking something.

please advise.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 68625
  • Thanks: 9109
  • Karma: 1434
12 years 4 months ago #187393 by krileon
Replied by krileon on topic Re: custom sorting my userlists

so in theory... Shouldnt only the users who have a value in the cb_eliteregsuccess field be listed first? and then it also grabs any user with a value in the business name field secondary?

Possibly, best way to test sorting is to just test it in phpmyadmin. You must always keep in mind your Sort By and Filters are purely MYSQL. You're just adding to the userlists query. For example with debug mode enabled you can scroll to bottom of page and see the userlist query. You'll notice your Sort By was just added as an ORDER BY to the query.

but how to give the Elite users hierarchy on the list?
I thought I had it nailed with the sort feature being able to have multiple entries.

Seams like the correct method, but really need to test it in phpmyadmin on _comprofiler database to see if it returns those expected results. It simply adds an ORDER BY of either ASC or DESC then comma separates them.


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.

  • jakobe75
  • jakobe75
  • OFFLINE
  • Posts: 349
  • Thanks: 9
  • Karma: 3
12 years 4 months ago #187409 by jakobe75
Replied by jakobe75 on topic Re: custom sorting my userlists
okay...fresh day.


this is my new sort parameter:

cb_elite reg success [desc]


Elite members field value is "1"
Free members field value is initially "null" or switched to "0" upon a downgrade.


It now sorts the by the field cb_eliteregsuccess and it sorts by THE VALUES OF THAT FIELD showing the "1's" first and then the nulls or "0's"


This is partially what I want it to do...but then further along it needs to also sort by alpha...which it is not doing...It appears to be sorting by last save date or account creation date.

By adding the additional sort parameter....cb_bizname [desc]
it should then sort all the results by business name alpha...and its not doing that.
Its doing "either or" but not both.


What exactly is the purpose or function of having multiple sorts parameters in the cb lists?

Maybe I am using it wrong?

I understand it to be as...

Initially sort by the values of the fields in first parameter. (asc or desc)
Then sort those results by the second parameter.then the third, 4th etc etc.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 68625
  • Thanks: 9109
  • Karma: 1434
12 years 4 months ago #187413 by krileon
Replied by krileon on topic Re: custom sorting my userlists
Again, you need to test it in phpmyadmin to ensure the results you're expecting at actually what MYSQL will do. As I've said it's just a database query. You can get the exact query by enabling debug mode and reviewing the userlist query at bottom of the page. You can then copy this into phpmyadmin for example and see exactly what MYSQL would give you as that's what CB will give you.


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.

  • jakobe75
  • jakobe75
  • OFFLINE
  • Posts: 349
  • Thanks: 9
  • Karma: 3
12 years 4 months ago #187419 by jakobe75
Replied by jakobe75 on topic Re: custom sorting my userlists
yes, I know ..I must have been typing my reply as you submitted yours so I overlooked it.


but am I correct in my thinking on as to what the multiple sort order parameters are supposed to do?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 68625
  • Thanks: 9109
  • Karma: 1434
12 years 4 months ago #187438 by krileon
Replied by krileon on topic Re: custom sorting my userlists

but am I correct in my thinking on as to what the multiple sort order parameters are supposed to do?

Yes, it should order by the first order then order by the second, etc..


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

Facebook Twitter LinkedIn