[#3675] Error message with list and filter, when no value

11 years 7 months ago - 11 years 7 months ago #209387 by comyoo
Hi. Last week we added a list to our website based on the field 'my team'. In that field there is a integer or multiple like '101 102', so this user is in team 102. And everyone who is in the same team of the user that views the list is shown in the list.

But when you are not in a team, we get a error. How can we hide the error or display the message: you are not in a team yet? Or maybe it is possible to hide the menu when someone is not in a team?

The message:
Warning: Invalid argument supplied for foreach() in /srv/www/vhosts/M6P/de4emusketier.nl/docroot/administrator/components/com_comprofiler/library/cb/cb.lists.php on line 347
Er bevindt zich een fout in de database query. Administratoren kunnen debugging inschakelen om te zien wat er misloopt om het probleem dan te kunnen oplossen.

The filter:
`cb_teams` REGEXP REPLACE( '[cb_teams]', ' ', '|' )

Please Log in to join the conversation.

11 years 7 months ago - 11 years 7 months ago #209397 by krileon
Try the below quick fix.

IN: administrator/components/com_comprofiler/library/cb/cb.lists.php
ON: Line 347
FROM:
foreach ( $users as $k => $v ) {
TO:
if ( $users ) foreach ( $users as $k => $v ) {

Created the below bug ticket to further track the issue.

forge.joomlapolis.com/issues/3675


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.

11 years 7 months ago #209457 by comyoo
Hi Kyle,

Thanks for the help. Great and quick support, I appreciate it!

The following message is shown:

Er bevindt zich een fout in de database query. Administratoren kunnen debugging inschakelen
om te zien wat er misloopt om het probleem dan te kunnen oplossen.

Translation:
There is an error in the database query. Admin can enable debugging, to see what is going wrong.

So, the normal error message is still shown. Is it also possible to hide this message?

Or can I create a code, that if the user has no team number attached to his profile, that he will see the message: "You aren't in a team yet." ?

Please Log in to join the conversation.

11 years 7 months ago #209468 by krileon
Try removing the filter and see if issue persists. Additional changes as follows.

IN: administrator/components/com_comprofiler/library/cb/cb.lists.php
ON: Line 349
FROM:
}
TO:
} else {
$users = array();
}

IN: administrator/components/com_comprofiler/library/cb/cb.lists.php
ON: Line 353
FROM:
foreach ( array_keys( $users ) as $k) {
TO:
if ( $users ) foreach ( array_keys( $users ) as $k) {


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.

11 years 7 months ago #209486 by comyoo
I changed like you said, but the message that there is a problem with the query is still published.

I translated the message into a friendly sentence, so the user knows why he does not see a team.

The url width from the error isn't shown anymore, so that's fixed.

Please Log in to join the conversation.

11 years 7 months ago #209504 by krileon
That means there is a problem with the filter. Review the debug information at the bottom of the page. Find the userlist query where your filter is at and see what's wrong with it. Please remove the filter and test if issue persists. With debug mode and maximum error reporting set in Joomla global configuration the error should be more specific though.


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

Facebook Twitter LinkedIn