Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: ZachMTA - heinäkuu 28, 2013, 04:58:37 AP

Otsikko: New shortcut in warning template
Kirjoitti: ZachMTA - heinäkuu 28, 2013, 04:58:37 AP
Okay I need some help creating a shortcut.

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fpuu.sh%2F3NDIU.png&hash=a1a332f971d9333dea8dee0bb6842b6c0067bef5)

It's the same as {MESSAGE} but instead of instead of it showing the link I want it to show a quote, but make it stay there so is there anyway to actually implement or do that since I have no experience.

So something like {QUOTE} since the majority of the time the post gets deleted once the person has been warned I would be so thankful if someone could help.

Otsikko: Re: New shortcut in warning template
Kirjoitti: emanuele - heinäkuu 28, 2013, 08:49:41 AP
mmm...interesting idea.

/me wonders if it is worth to include it in SMF...
Otsikko: Re: New shortcut in warning template
Kirjoitti: Chalky - heinäkuu 28, 2013, 08:59:46 AP
Which mod is that?
Otsikko: Re: New shortcut in warning template
Kirjoitti: ZachMTA - heinäkuu 28, 2013, 10:41:24 AP
It's already included in SMF, it's when you create a template for a warning issued to PM.

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fpuu.sh%2F3NMj8.png&hash=bcbece2dcdb1f77a65462394e97f1ce518f89be2)

I'm just wondering if anyone knows how to make the exact same as {message} but instead {quote} as it would be so helpful.
Otsikko: Re: New shortcut in warning template
Kirjoitti: Chalky - heinäkuu 28, 2013, 11:02:30 AP
You've got me now.  I can't find anywhere in SMF to edit the template, which is why I assumed you were using a template editing mod  :-\
Otsikko: Re: New shortcut in warning template
Kirjoitti: Illori - heinäkuu 28, 2013, 01:31:27 IP
moderation center -> warnings -> custom templates -> add template
Otsikko: Re: New shortcut in warning template
Kirjoitti: Chalky - heinäkuu 28, 2013, 01:35:05 IP
Wow I never knew that was there!  Shows how well behaved all my members are  :D. Thanks Illori, I'll get my coat now...  (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fchalkcat.com%2FSmileys%2Ffantasticsmileys%2Fgetmecoat2.gif&hash=bc36bdc418f8fbc61e1f6bce6fee5355b400c3ba)
Otsikko: Re: New shortcut in warning template
Kirjoitti: Illori - heinäkuu 28, 2013, 02:08:39 IP
you dont need to go... now you just need to be our specialist on that feature ;)
Otsikko: Re: New shortcut in warning template
Kirjoitti: ZachMTA - heinäkuu 28, 2013, 06:35:36 IP
So, does anyone know how to make a new short? Or where the template would be?
Otsikko: Re: New shortcut in warning template
Kirjoitti: emanuele - heinäkuu 30, 2013, 03:08:02 AP
Warning: not tested, it may be badly broken.

Profile-Actions.php

Koodi (find) [Valitse]
SELECT subject
Koodi (replace with) [Valitse]
SELECT subject, body

Koodi (find) [Valitse]
list ($context['warned_message_subject']) = $smcFunc['db_fetch_row']($request);
Koodi (replace with) [Valitse]
list ($context['warned_message_subject'], $context['warned_message_body']) = $smcFunc['db_fetch_row']($request);

Koodi (find) [Valitse]
$context['warned_message_subject'] = '';
Koodi (replace with) [Valitse]
$context['warned_message_subject'] = '';
$context['warned_message_body'] = '';


Koodi (find) [Valitse]
if (!$context['warning_for_message'] && strpos($row['body'], '{MESSAGE}') !== false)
Koodi (replace with) [Valitse]
if (!$context['warning_for_message'] && (strpos($row['body'], '{MESSAGE}') !== false || strpos($row['body'], '{QUOTE}') !== false))

Koodi (find) [Valitse]
$context['notification_templates'][$k]['body'] = strtr($name['body'], array('{MEMBER}' => un_htmlspecialchars($context['member']['name']), '{MESSAGE}' => '[url=http://' . $scripturl . '?msg=' . $context['warning_for_message'] . ']' . un_htmlspecialchars($context['warned_message_subject']) . '[/url]', '{SCRIPTURL}' => $scripturl, '{FORUMNAME}' => $mbname, '{REGARDS}' => $txt['regards_team']));
Koodi (replace with) [Valitse]
$context['notification_templates'][$k]['body'] = strtr($name['body'], array('{MEMBER}' => un_htmlspecialchars($context['member']['name']), '{MESSAGE}' => '[url=http://' . $scripturl . '?msg=' . $context['warning_for_message'] . ']' . un_htmlspecialchars($context['warned_message_subject']) . '[/url]', '{quote}' => trim(un_htmlspecialchars(strip_tags(strtr(parse_bbc('[quote]' . $context['warned_message_body'] . '[/quote]', false, $context['warning_for_message']), array('<br />' => "\n", '</div>' => "\n", '</li>' => "\n", '[' => '[', ']' => ']'))))), '{SCRIPTURL}' => $scripturl, '{FORUMNAME}' => $mbname, '{REGARDS}' => $txt['regards_team']));
Otsikko: Re: New shortcut in warning template
Kirjoitti: ZachMTA - heinäkuu 30, 2013, 06:52:59 AP
It doesn't appear to work, has anyone else tried it?
Otsikko: Re: New shortcut in warning template
Kirjoitti: emanuele - heinäkuu 30, 2013, 10:01:38 AP
If maybe you can say what's the error you get... ;)
Otsikko: Re: New shortcut in warning template
Kirjoitti: ZachMTA - elokuu 01, 2013, 10:21:05 AP
I get no error, it's just that nothing comes up and it doesn't work, perhaps I've done something wrong?
Otsikko: Re: New shortcut in warning template
Kirjoitti: emanuele - elokuu 01, 2013, 10:24:24 AP
So you created a new template using {QUOTE} in the text and it is not replaced?
Otsikko: Re: New shortcut in warning template
Kirjoitti: ZachMTA - elokuu 02, 2013, 02:41:30 AP
Lainaus käyttäjältä: emanuele - elokuu 01, 2013, 10:24:24 AP
So you created a new template using {QUOTE} in the text and it is not replaced?

Yes I get no error, but it just doesn't work