2020-10-27, 12:56 PM
Task definition:
For a plugin project according to DSGVO only the "empty" user language ($mybb->users['language'] must be filled with the bblanguage ($mybb->settings['bblanguage'] in the database.
With:
PHP-Code:
But the column "langauge" should only be filled with "bblanguage" if the column "langauge" is empty
If i use:
PHP-Code:
What is wrong with the "IF definition"? Could someone tell me the correct code to reach my goal?
Unfortunately, I am not a programming professional and therefore I would like to thank you in advance for any assistance.
For a plugin project according to DSGVO only the "empty" user language ($mybb->users['language'] must be filled with the bblanguage ($mybb->settings['bblanguage'] in the database.
With:
PHP-Code:
$query_bblanguage = $db->simple_select("settings", "value", "name='bblanguage'");
$bblanguage = $db->fetch_field($query_bblanguage, "value");
if(empty($mybb->users['language'])) {
$db->update_query("users", array("language" => ($bblanguage)));
}
the column "langauge" is filled with "bblanguage" for all users, no matter if something else is already contained in the column or not.But the column "langauge" should only be filled with "bblanguage" if the column "langauge" is empty
If i use:
PHP-Code:
if(!empty($mybb->users['language'])) {
the empty columns are not filled! The columns which already contain something remain untouched.What is wrong with the "IF definition"? Could someone tell me the correct code to reach my goal?
Unfortunately, I am not a programming professional and therefore I would like to thank you in advance for any assistance.