Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: king kratos - helmikuu 16, 2014, 08:51:09 IP

Otsikko: Prevent users from changing Calendar posting location
Kirjoitti: king kratos - helmikuu 16, 2014, 08:51:09 IP
Hello,

I want to prevent users from changing where a new calendar event can be posted. I think all I really need to do is hide the "Post In:" portion of a new event, but cannot seem to get this to hide. I either receive fatal errors or it just doesn't go away.

Any ideas what I need to do to get this to become invisible?

Thanks,
Kratos
Otsikko: Re: Prevent users from changing Calendar posting location
Kirjoitti: margarett - helmikuu 17, 2014, 10:43:56 AP
That would require some coding, yes... You can easily hide it, although it can be discovered by someone using, eg, Firebug...

Post.template.php
Find:

// If this is a new event let the user specify which board they want the linked post to be put into.
if ($context['event']['new'] && $context['is_new_post'])
{
echo '
<li>
', $txt['calendar_post_in'], '

Replace with:

// If this is a new event let the user specify which board they want the linked post to be put into.
if ($context['event']['new'] && $context['is_new_post'])
{
echo '
<li style="display:none">
', $txt['calendar_post_in'], '

There is a similar code in Calendar.template.php but I can't find where it's used :P

Then you define the board you want in ACP --> Core Features --> Calendar --> Calendar settings --> Default board to post events in
Otsikko: Re: Prevent users from changing Calendar posting location
Kirjoitti: king kratos - helmikuu 17, 2014, 01:44:40 IP
Lainaus käyttäjältä: margarett - helmikuu 17, 2014, 10:43:56 AP
That would require some coding, yes... You can easily hide it, although it can be discovered by someone using, eg, Firebug...

Post.template.php
Find:

// If this is a new event let the user specify which board they want the linked post to be put into.
if ($context['event']['new'] && $context['is_new_post'])
{
echo '
<li>
', $txt['calendar_post_in'], '

Replace with:

// If this is a new event let the user specify which board they want the linked post to be put into.
if ($context['event']['new'] && $context['is_new_post'])
{
echo '
<li style="display:none">
', $txt['calendar_post_in'], '

There is a similar code in Calendar.template.php but I can't find where it's used :P

Then you define the board you want in ACP --> Core Features --> Calendar --> Calendar settings --> Default board to post events in

I'm not too worried about anyone seeing it as I am about them accidentally posting in the wrong forum. The information in my calendar will be on a confidential basis and if they accidentally post to a public forum, the post itself can be seen by anyone.

I will give this a try!

Thank you!

Kratos
Otsikko: Re: Prevent users from changing Calendar posting location
Kirjoitti: king kratos - helmikuu 17, 2014, 05:56:39 IP
Yep, that worked perfectly. Didn't even need to modify the calendar.template.php.

Thanks,

Kratos