News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

About PersonalMessage.template.php scripting help

Started by Mick., May 17, 2019, 10:37:53 AM

Previous topic - Next topic

Mick.

PersonalMessage.template.php is a file i've never ventured in before. Let me pick your brain for a sec, lately i've been getting PM's by folks that want support and we all know we ignore them since that's why we have support boards. I've been wanting to add a warning message when users want to send me (admin, user#1) PM. Some simple text like: "Please do not PM for support, blah blah blah".

Question is, i can't use if ($context['user']['is_admin']) i would be the only who reads it. Then i thought using member id but that too confuses me. How would i go about the message i want to display is towards me and me only when users want to PM me?

Any help much appreciated, M.

Mick.

The easiest way would be in here.... adding a simple text but everyone would read it when they message each other. Which is not so bad either. Please do not contact author for support, use article system blah blah

// Main message editing box.
echo '
<div class="cat_bar">
<h3 class="catbg">
<span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/im_newmsg.gif" alt="', $txt['new_message'], '" title="', $txt['new_message'], '" />&nbsp;', $txt['new_message'], '</span>
</h3>

<div>Some warning text can be placed here</div>
</div>';

Arantor

The question becomes displaying something if not admin, right?

if (!$context['user']['is_admin']) {
   // stuff goes here for non admins
}
Holder of controversial views, all of which my own.


Illori

he wants if the to line has the admin user then it shows x message.

Arantor

Ooh, good luck with that, that's basically hell to implement.
Holder of controversial views, all of which my own.


Mick.

#5
Thank you guys... I went with something much simpler. At first i wanted the message when people PM me, not each other.  But now i have it where everyone reads the message regardless who are they PMing.

Find:

echo '
<dl id="post_header">';


Add after:

        echo '
                                <div class="pm-warning">Please, do not contact the author for support. Instead, reply to articles so others can also find the answer. Regards, The idesignSMF team.</div>';


The CSS

.pm-warning {
   background-color: #2ecc71;
   width: 100%;
   color: #ffffff;
   font-size: 18px;
   line-height: 22px;
   text-align: center;
   padding: 15px;
   display: block;
   margin-bottom: 20px;
}

Mick.

Quote from: Arantor on May 17, 2019, 11:04:35 AM
Ooh, good luck with that, that's basically hell to implement.
hahhaa that's what i thought. No worries brother, I went the easy way.

Advertisement: