If someone posts an event to a forum where they do not have editing rights, then change the date on the calendar item, the post gets split from the item which no longer shows at the beginning of the post.
The best fix for this would be a new feature to allow admin to choose which boards calendar items can be posted into :)
Moved to bug reports :)
Hi, just wondering what happened with this? It is still happening in RC5 and I cannot find it on the bug tracker (by searching 'calendar'). Was it not able to be reproduced or something else?
Here it is a possible fix (the other one I can imagine requires more changes).
Most likely there is a better solution.
In Calendar.php:
// ... or just update it?
else
{
$eventOptions = array(
'title' => substr($_REQUEST['evtitle'], 0, 60),
'span' => empty($modSettings['cal_allowspan']) || empty($_POST['span']) || $_POST['span'] == 1 || empty($modSettings['cal_maxspan']) || $_POST['span'] > $modSettings['cal_maxspan'] ? 0 : min((int) $modSettings['cal_maxspan'], (int) $_POST['span'] - 1),
'start_date' => strftime('%Y-%m-%d', mktime(0, 0, 0, (int) $_REQUEST['month'], (int) $_REQUEST['day'], (int) $_REQUEST['year'])),
);
modifyEvent($_REQUEST['eventid'], $eventOptions);
}
// ... or just update it?
else
{
// There could be already a topic you are not allowed to modify
if(!allowedTo('post_new')){
$request = $smcFunc['db_query']('', '
SELECT id_board, id_topic
FROM {db_prefix}calendar
WHERE id_event = {int:id_event}
LIMIT 1
',
array(
'id_event' => $_REQUEST['eventid'],
));
list($id_board, $id_topic) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
}
$eventOptions = array(
'title' => substr($_REQUEST['evtitle'], 0, 60),
'span' => empty($modSettings['cal_allowspan']) || empty($_POST['span']) || $_POST['span'] == 1 || empty($modSettings['cal_maxspan']) || $_POST['span'] > $modSettings['cal_maxspan'] ? 0 : min((int) $modSettings['cal_maxspan'], (int) $_POST['span'] - 1),
'start_date' => strftime('%Y-%m-%d', mktime(0, 0, 0, (int) $_REQUEST['month'], (int) $_REQUEST['day'], (int) $_REQUEST['year'])),
'board' => isset($id_board) ? (int) $id_board : 0,
'topic' => isset($id_topic) ? (int) $id_topic : 0,
);
modifyEvent($_REQUEST['eventid'], $eventOptions);
}
Thank you emanuele. Yes that fixes it :)
I have a few other things on my plate now however when I have time I will give this a better test.
Don't tell anyone, but I don't like this solution! :P
It's just the one with less edits I could imagine.
BTW, I was checking this again and in the post event page only boards where the member is allowed to post are listed.
The problem, in fact arise if the permissions are changed before editing the event.
So the sequence is:
* post an event,
* change the board permissions for the user removing post new topic
* edit the event
that's the only case I was able to find where the event is split from the topic.
Hi Emanuele, the problem arises if the event is posted to a board where they have the right to post but not to edit i.e. where 'Modify their own post' is off in Admin -> Members -> Permissions -> Edit Profiles :)
Right, right, right, I forgot the edit!
:laugh:
emanuele, does that fix the entire problem?
It should, but honestly I'm not sure about side effects... ;)