dopetalk

Technology => SMF Forum Code Modifications => Topic started by: Chip on August 22, 2016, 10:29:59 PM

Title: SP Shoutbox PM Button
Post by: Chip on August 22, 2016, 10:29:59 PM
http://simpleportal.net/index.php?topic=12338

SP Shoutbox PM Button

This mod will add sign @ before username in Shoutbox, and it will insert in message box something like this:

Code: [Select]
@UserName:
Now you can write some text after it :) It's just built in Shoutbox PM function, mod is just adding this button. Useful, because some users have complicated usernames

Message should be visible for author, for recipient and for admin.
Be aware, that PM function is built in in SimplePortal, this mod only adds button which allows to insert username in message box (with correct formatting for PM), nothing more.
Title: Re: SP Shoutbox PM Button
Post by: Chip on May 02, 2018, 02:25:33 AM
version 1.1 fixed some SMF patch issues and currently works with 2.0.15

package-info.xml

Code: [Select]
<?xml version="1.1"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
<id>phantom:sp_shoutbox_pm_button</id>
<name>Shoutbox PM button - SimplePortal 2.3.6</name>
<version>1.1</version>

<install for="2.0 - 2.0.99">
<modification format="xml" type="file">install.xml</modification>
</install>

<uninstall for="2.0 - 2.0.99">
<modification format="xml" type="file" reverse="true">install.xml</modification>
<redirect type="inline" url="$scripturl?action=admin;area=packages">You are being automatically redirected to the Package Manager Page...</redirect>
</uninstall>
</package-info>

install.xml

Code: [Select]
<?xml version="1.1"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>phantom:sp_shoutbox_pm_button</id>
<name>Shoutbox PM button - SimplePortal 2.3.6</name>
<version>1.1</version>

<file name="$themedir/PortalShoutbox.template.php">
<operation>
<search position="replace"><![CDATA[<li class="smalltext">', !$shout['is_me'] ? '<strong>' . $shout['author']['link'] . ':</strong> ' : '', '<span style="word-wrap: break-word;overflow-y: auto;overflow-x: hidden;">' . $shout['text'], '</span><br /><span class="shoutbox_delete">', (!empty($shout['edit_link_js']) ? $shout['edit_link_js'] : '&nbsp;'), (!empty($shout['delete_link_js']) ? $shout['delete_link_js'] : '&nbsp;'), '</span><span class="smalltext shoutbox_time">', $shout['time'], '</span></li>';]]></search>
<add><![CDATA[<li class="smalltext">', !$shout['is_me'] ? '<a href="javascript:void(0);" title="'.$txt['sp_shoutbox_pm_title'].'" onclick="document.getElementById(\'new_shout_'. $shoutbox['id']. '\').value=\'@' . $shout['author']['name'] . ': \'">@</a><strong>' . $shout['author']['link'] . ':</strong> ' : '', '<span style="word-wrap: break-word;overflow-y: auto;overflow-x: hidden;">' . $shout['text'], '</span><br /><span class="shoutbox_delete">', (!empty($shout['edit_link_js']) ? $shout['edit_link_js'] : '&nbsp;'), (!empty($shout['delete_link_js']) ? $shout['delete_link_js'] : '&nbsp;'), '</span><span class="smalltext shoutbox_time">', $shout['time'], '</span></li>';]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ <author>', htmlspecialchars($shout['author']['link']), '</author>]]></search>
<add><![CDATA[ <author>', htmlspecialchars($shout['author']['link']), '</author>
<author_name>', htmlspecialchars($shout['author']['name']), '</author_name>
<author_name_txt>', $txt['sp_shoutbox_pm_title'] , '</author_name_txt>]]></add>
</operation>
</file>

<file name="$languagedir/SPortal.english.php">
<operation>
<search position="end"></search>
<add><![CDATA[$txt['sp_shoutbox_pm_title'] = 'Send Shoutbox PM';]]></add>
</operation>
</file>

<file name="$themedir/scripts/portal.js">
<operation>
<search position="replace"><![CDATA[, author,]]></search>
<add><![CDATA[, author, author_name, author_name_txt,]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ author = shout.getElementsByTagName("author")[0].childNodes[0].nodeValue;]]></search>
<add><![CDATA[ author = shout.getElementsByTagName("author")[0].childNodes[0].nodeValue;
author_name = shout.getElementsByTagName("author_name")[0].childNodes[0].nodeValue;
author_name_txt = shout.getElementsByTagName("author_name_txt")[0].childNodes[0].nodeValue;]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[new_body += '<li class="smalltext">' + (is_me == 0 ? '<strong>' + author + ':</strong> ' : '') + content + '<br />' + (delete_link != 0 ? ('<span class="shoutbox_delete">' + delete_link + '</span>') : '') + (edit_link != 0 ? ('<span class="shoutbox_delete">' + edit_link + '</span>') : '') + '<span class="smalltext shoutbox_time">' + time + '</span></li>';]]></search>
<add><![CDATA[new_body += '<li class="smalltext">' + (is_me == 0 ? '<a href="javascript:void(0);" title="'+ author_name_txt +'" onclick="document.getElementById(\'new_shout_'+ shoutbox_id +'\').value=\'@' + author_name + ': \'">@</a><strong>' + author + ':</strong> ' : '') + content + '<br />' + (delete_link != 0 ? ('<span class="shoutbox_delete">' + delete_link + '</span>') : '') + (edit_link != 0 ? ('<span class="shoutbox_delete">' + edit_link + '</span>') : '') + '<span class="smalltext shoutbox_time">' + time + '</span></li>';]]></add>
</operation>
</file>
</modification>
SimplePortal 2.3.6 © 2008-2014, SimplePortal