Main Menu
collapse

Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

User Info

Welcome Guest.
Please log in.

Who's Online

  • Dot Guests: 950
  • Dot Hidden: 0
  • Dot Users: 1
  • Dot Users Online:

Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]


If you're interested in helping other members with support requests, consider joining the Community Support Helpers group.

Private shoutbox message to a clicked user

Started by Alex, January 12, 2013, 02:30:25 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Alex

Hi there ^^

I know that the ShoutBox of Simple Portal have a simple function that lets you send private messages to users by entering on the chat line, for instance:

@Nickname: Hi

But I need a bit more for this.

Alex

Well, I achieved my goal by replacing in PortalShoutbox.template.php this:

Code ("Find") Select
               ', !$shout['is_me'] ? '<li class="smalltext"><strong>' . $shout['author']['link'] . ':</strong></li>' : '', '

By this:

Code ("Replace") Select
               ', !$shout['is_me'] ? '<li class="smalltext"><a onclick="javascript:document.getElementById(&apos;new_shout_1&apos;).value=&apos;@' . $shout['author']['name'] . ': &apos;">@</a><strong>' . $shout['author']['link'] . ':</strong></li>' : '', '

And it appears that works as I expected:


But there is a problem... when you refresh the shoutbox (not the page) or when you write something there, the modification turns to be normal:



How can I keep this modification as seen at the first image?

Greetings

phantomm

#2
Exactly which line did you replaced? Because it is working great for me on Chrome, FF or Opera.

//edit: with few modifications I did found solution, I'll post it in 30-60 minutes ;)

edit:

Here it is :)

./Themes/default/PortalSoutbox.template.php:
Code (Find) Select

<li class="smalltext">', !$shout['is_me'] ? '<strong>' . $shout['author']['link'] . ':</strong> ' : '', $shout['text'], '<br />', !empty($shout['delete_link_js']) ? '<span class="shoutbox_delete">' . $shout['delete_link_js'] . '</span>' : '' , '<span class="smalltext shoutbox_time">', $shout['time'], '</span></li>';

Code (Replace with) Select

<li class="smalltext">', !$shout['is_me'] ? '<a href="javascript:void(0);" onclick="document.getElementById(\'new_shout_'. $shoutbox['id']. '\').value=\'@' . $shout['author']['name'] . ': \'">@</a> <strong>' . $shout['author']['link'] . ':</strong> ' : '', $shout['text'], '<br />', !empty($shout['delete_link_js']) ? '<span class="shoutbox_delete">' . $shout['delete_link_js'] . '</span>' : '' , '<span class="smalltext shoutbox_time">', $shout['time'], '</span></li>';


Code (Find) Select

<author>', htmlspecialchars($shout['author']['link']), '</author>

Code (Replace with) Select

<author>', htmlspecialchars($shout['author']['link']), '</author>
<author_name>', htmlspecialchars($shout['author']['name']), '</author_name>


./Themes/default/scripts/portal.js
Code (Find) Select

, author,

Code (Replace with) Select

, author, author_name,


Code (Find) Select

author = shout.getElementsByTagName("author")[0].childNodes[0].nodeValue;

Code (Replace with) Select

author = shout.getElementsByTagName("author")[0].childNodes[0].nodeValue;
author_name = shout.getElementsByTagName("author_name")[0].childNodes[0].nodeValue;


Code (Find) Select

new_body += '<li class="smalltext">' + (is_me == 0 ? '<strong>' + author + ':</strong> ' : '') + content + '<br />' + (delete_link != 0 ? ('<span class="shoutbox_delete">' + delete_link + '</span>') : '') + '<span class="smalltext shoutbox_time">' + time + '</span></li>';

Code (Replace with) Select

new_body += '<li class="smalltext">' + (is_me == 0 ? '<a href="javascript:void(0);" 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>') : '') + '<span class="smalltext shoutbox_time">' + time + '</span></li>';


Note: This code is for Shoutbox with ID = 1. Of course this can be done for every Shoutbox, but when I tried to make it work forum was not loading at all :|

@Alex, can I make this as mod package and post it here? I'm asking because you figured out how to make it work ;)

edit: http://simpleportal.net/index.php?topic=12338.0

Alex

#3
Yes, you can! Thanks!

PS: I replaced all the codes and I'm again in the same problem of refreshing  :( I'm using Google Chrome and Firefox.
After refreshing cache (Ctrl+Shift+R) it works finely. Thank you for your help!  :)

phantomm

yeah, portal.js was in your browser cache, it needed to be refreshed :)

And I'll post package later.