Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1537

General Questions/New to Joomla! 5.x • Re: Github #25415 Multilanguage Status: Misleading Warning on Contact

$
0
0
From administrator/components/com_languages_src/Helper/MultilangstatusHelper.php::getContacts()

This is the query that looks for problems:

Code:

SELECT `u`.`name`,(SELECT COUNT(*)FROM `#__contact_details` AS `cd`WHERE `cd`.`user_id` = `u`.`id` AND `cd`.`published` = 1 AND `cd`.`language` = '*') AS `alang`,(SELECT COUNT(DISTINCT `l`.`lang_code`)FROM `#__languages` AS `l`LEFT JOIN `#__contact_details` AS `cd` ON `cd`.`language` = `l`.`lang_code`WHERE `cd`.`user_id` = `u`.`id` AND `cd`.`published` = 1 AND `l`.`published` = 1) AS `slang`,(SELECT COUNT(*)FROM `#__languages` AS `l`LEFT JOIN `#__contact_details` AS `cd` ON `cd`.`language` = `l`.`lang_code`WHERE `cd`.`user_id` = `u`.`id` AND `cd`.`published` = 1 AND `l`.`published` = 1GROUP BY `l`.`lang_code`HAVING COUNT(*) > 1) AS `mlang`FROM `#__users` AS `u`LEFT JOIN `#__contact_details` AS `cd` ON `cd`.`user_id` = `u`.`id`WHERE EXISTS (SELECT 1FROM `#__content` AS `c`WHERE `c`.`created_by` = `u`.`id`)GROUP BY `u`.`id`,`u`.`name`
And this is the code that decides if there are problems:

Code:

        $db->setQuery($query);        $warnings = $db->loadObjectList();        foreach ($warnings as $index => $warn) {            if ($warn->alang == 1 && $warn->slang == 0) {                unset($warnings[$index]);            }            if ($warn->alang == 0 && $warn->slang == 0 && empty($warn->mlang)) {                unset($warnings[$index]);            }            if ($warn->alang == 0 && $warn->slang == $languages && empty($warn->mlang)) {                unset($warnings[$index]);            }        }        return $warnings;
You can use your own table prefix to see what the query returns in phpMyAdmin.

It may help you figure out what needs to be done.

Statistics: Posted by ceford — Wed Jun 12, 2024 7:57 am



Viewing all articles
Browse latest Browse all 1537

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>