Compare commits

...

4 commits

Author SHA1 Message Date
KFMDM Solutions
e96f15db99
Merge 50cf4892ea into 61bede748a 2025-05-16 20:16:43 +02:00
Marc Alexander
61bede748a
Merge pull request #6813 from rxu/ticket/17508
[ticket/17508] Fix PHP warning on custom profile fields edit
2025-05-12 21:33:09 +02:00
rxu
0562984999
[ticket/17508] Fix PHP warning on custom profile fields edit
PHPBB-17508
2025-05-13 00:02:56 +07:00
KF MDM Solutions
50cf4892ea
fix [ticket/17017]
fix post count bug
2022-11-21 20:32:02 -05:00
3 changed files with 68 additions and 2 deletions

View file

@ -475,6 +475,41 @@ class acp_profile
$cp->vars[$key] = $var;
}
// step 3 - all arrays
if ($action == 'edit')
{
// Get language entries
$sql = 'SELECT *
FROM ' . PROFILE_FIELDS_LANG_TABLE . '
WHERE lang_id <> ' . $this->edit_lang_id . "
AND field_id = $field_id
ORDER BY option_id ASC";
$result = $db->sql_query($sql);
$l_lang_options = [];
while ($row = $db->sql_fetchrow($result))
{
$l_lang_options[$row['lang_id']][$row['option_id']] = $row['lang_value'];
}
$db->sql_freeresult($result);
$sql = 'SELECT lang_id, lang_name, lang_explain, lang_default_value
FROM ' . PROFILE_LANG_TABLE . '
WHERE lang_id <> ' . $this->edit_lang_id . "
AND field_id = $field_id
ORDER BY lang_id ASC";
$result = $db->sql_query($sql);
$l_lang_name = $l_lang_explain = $l_lang_default_value = [];
while ($row = $db->sql_fetchrow($result))
{
$l_lang_name[$row['lang_id']] = $row['lang_name'];
$l_lang_explain[$row['lang_id']] = $row['lang_explain'];
$l_lang_default_value[$row['lang_id']] = $row['lang_default_value'];
}
$db->sql_freeresult($result);
}
foreach ($exclude[3] as $key)
{
$cp->vars[$key] = $request->variable($key, array(0 => ''), true);

View file

@ -441,12 +441,15 @@ class content_visibility
{
$post_ids[] = (int) $row['post_id'];
if ($row['post_visibility'] != $visibility)
if ($row['post_visibility'] != $visibility )
{
if ($row['post_postcount'] && !isset($poster_postcounts[(int) $row['poster_id']]))
{
if($row['post_visibility'] != 0 || $visibility != ITEM_DELETED ){
$poster_postcounts[(int) $row['poster_id']] = 1;
}
}
else if ($row['post_postcount'])
{
$poster_postcounts[(int) $row['poster_id']]++;

View file

@ -69,4 +69,32 @@ class phpbb_functional_acp_profile_field_test extends phpbb_functional_test_case
$this->assertContainsLang('ADDED_PROFILE_FIELD', $crawler->text());
}
public function test_edit_profile_fields()
{
// Custom profile fields page
$crawler = self::request('GET', 'adm/index.php?i=acp_profile&mode=profile&sid=' . $this->sid);
// Get all profile fields edit URLs
$edits = $crawler->filter('td.actions a')
->reduce(
function ($node, $i) {
$url = $node->attr('href');
return ((bool) strpos($url, 'action=edit'));
})
->each(
function ($node, $i) {
$url = $node->attr('href');
return ($url);
});
foreach ($edits as $edit_url)
{
$crawler = self::request('GET', 'adm/' . $edit_url . '&sid=' . $this->sid);
$form = $crawler->selectButton('Save')->form();
$crawler= self::submit($form);
$this->assertContainsLang('CHANGED_PROFILE_FIELD', $crawler->text());
}
}
}