$msgOptions icon doesnt work

Started by Jotade29, March 22, 2024, 11:01:42 PM

Previous topic - Next topic

Jotade29

V:2.0.19
Hi!!
In post.php, both createPost() and modifyPost() use the parameters $msgOptions, $topic... $poster...
$msgOptions = array(
'id' => empty($_REQUEST['msg']) ? 0 : (int) $_REQUEST['msg'],
'subject' => $_POST['subject'],
'body' => $_POST['message'],
'icon' => preg_replace('~[\./\\\\*:"\'<>]~', '', $_POST['icon']),
'smileys_enabled' => !isset($_POST['ns']),
'attachments' => empty($attachIDs) ? array() : $attachIDs,
'approved' => $becomesApproved,
);
        $topicOptions = array(
'id' => empty($topic) ? 0 : $topic,
'board' => $board,
'id_prefix' => isset($_REQUEST['id_prefix']) ? $_REQUEST['id_prefix'] : 0,
'poll' => isset($_REQUEST['poll']) ? $id_poll : null,
'lock_mode' => isset($_POST['lock']) ? (int) $_POST['lock'] : null,
'sticky_mode' => isset($_POST['sticky']) && !empty($modSettings['enableStickyTopics']) ? (int) $_POST['sticky'] : null,
'mark_as_read' => true,
'is_approved' => !$modSettings['postmod_active'] || empty($topic) || !empty($board_info['cur_topic_approved']),
);
$posterOptions = array(
'id' => $user_info['id'],
'name' => $_POST['guestname'],
'email' => $_POST['email'],
'update_post_count' => !$user_info['is_guest'] && !isset($_REQUEST['msg']) && $board_info['posts_count'],
        // Added pa_id and pa_name to enable Admins to correct mentions in existing posts and have the mention attributed to the post author.
'pa_id' => isset($_REQUEST['msg']) && !empty($topic) ? $user_info['pa_id'] : $user_info['id'],
'pa_name' => $_POST['guestname'],[/s]
);

These 3 arrays are used for both modifyPost and createPost. I would like to know how i can modify, depending on whether i create or modify, one of the parts. For example, the icon part.

Let's imagine that what i want is to modify a post, and not create it, and that every time it is modified, the icon that i say, which will be called 'test', is placed, and not that you can select the icon you want...

In this code i want realice the modification:

if (!empty($_REQUEST['msg']))
{
// Have admins allowed people to hide their screwups?
if (time() - $row['poster_time'] > $modSettings['edit_wait_time'] || $user_info['id'] != $row['id_member'])
{
$msgOptions['modify_time'] = time();
$msgOptions['modify_name'] = $user_info['name'];
}

// This will save some time...
if (empty($approve_has_changed))
unset($msgOptions['approved']);

// Move the attachments and Delete the old post
if (!empty($modSettings['AutoMergePost_manual_flag']))
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}attachments
SET id_msg = {int:id_msg}
WHERE id_msg = {int:id_ms0}
LIMIT {int:limit}',
array(
'id_msg' => $_REQUEST['msg'],
'id_ms0' => $modSettings['AutoMergePost_manual_flag'],
'limit' => $modSettings['attachmentNumPerPostLimit']
)
);
require_once($sourcedir . '/RemoveTopic.php');
removeMessage($modSettings['AutoMergePost_manual_flag']);
}

modifyPost($msgOptions, $topicOptions, $posterOptions);

As i said, i want the icon in all the modified ones, whatever the selected icon, to be the one called 'landa', for that I do the following before modifyPost(...);

$msgOptions['icon'] == 'landa';
modifyPost($msgOptions, $topicOptions, $posterOptions);

But doing the following doesn't work, and i don't understand why, because i'm modifying the icon part of $msgOptions. What am  doing wrong?
Quote from: Diego Andrés on August 12, 2023, 02:20:18 AMI'm afraid convincing Jotade to upgrade to SMF 2.1 will require bigger effort than your work sanitizing Unicode characters  :laugh:

vbgamer45

The double == sign is used to compare not to set use a single equal
$msgOptions['icon'] = 'landa';
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Jotade29

Quote from: vbgamer45 on March 23, 2024, 12:34:20 AMThe double == sign is used to compare not to set use a single equal
$msgOptions['icon'] = 'landa';

Yeeees, it was a error!! Thanks, vbgamer!!  :laugh:
Quote from: Diego Andrés on August 12, 2023, 02:20:18 AMI'm afraid convincing Jotade to upgrade to SMF 2.1 will require bigger effort than your work sanitizing Unicode characters  :laugh:

Advertisement: