SimplePortal

Customization => Custom Coding => Topic started by: 420connect on February 07, 2015, 07:36:20 AM

Title: [Shoutbox] Combining multiple plugins - on going
Post by: 420connect on February 07, 2015, 07:36:20 AM
 hello! :)

I downloaded "sp-xtra-shoutbox_options-v1.5x.zip" and went to install but get the following test fails:


Code: (Find) [Select]
if (!empty($_REQUEST['shout']))
Code: (Replace) [Select]
if (!empty($count) && $count >= $context['SPortal']['shoutbox']['consecutive'])
$context['SPortal']['shoutbox']['warning'] = str_replace('[#]', $context['SPortal']['shoutbox']['consecutive'], $context['SPortal']['shoutbox']['consecutive_msg']);
elseif (!empty($_REQUEST['shout']) && !$read_only)



and


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) [Select]
<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>';

I've already got the colour drop down, shoutbox sound and PM member plugin's installed..
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: ♦ Ninja ZX-10RR ♦ on February 07, 2015, 07:50:43 AM
[...] Hint: attach the faulty file(s), provide a screeenshot of the failing tests.
Parsing the modifications is ok as well but still missing the files ;D and I don't have the power to fix it without seeing it :P
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: 420connect on February 07, 2015, 02:24:52 PM
Sorry, I never realised I was being so non-specific to which files..
Okay, I tried manually adding in the code but for whatever reason the package manager wasn't finding:

this part:
Code: [Select]
if (!empty($_REQUEST['shout']))on ./Sources/PortalShoutbox.php

but I was able to make that change manually.



I'm now just left with the second one that I'm struggling to make manually as it's already been changed by the other plugins.

So I'm looking to combine the 2 of these into one:
I currently have:
Code: [Select]
<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>';

Package manager wants to find:

Code: [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>';
and replace with:

Code: [Select]
<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> ' : '', $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>';

(this is in PortalShoutbox.template.php)



updated
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: ♦ Ninja ZX-10RR ♦ on February 07, 2015, 03:03:51 PM
My php knowledge is not enough to do that so I'd suggest to wait for Chen Zhen or another competent coder for this one :)
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: Chen Zhen on February 07, 2015, 03:25:20 PM

420connect,

  What you currently have (as stated) is what the mod you referenced (sp-xtra-shoutbox_options-v1.5) changes the code to so I do not see you specifically having an issue with my mod. You seem to be having an issue with whatever mod is attempting to add the last bit of code you posted which is not my plug-in.
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: Chen Zhen on February 07, 2015, 03:35:08 PM
Keep in mind that both those plug-ins will no longer uninstall properly since you are altering the code with manual edits.

find:
Code: [Select]
<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>';
replace with:
Code: [Select]
<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>';
Without knowing exactly which plug-in is displaying the extra link, how it is displayed and with how you posted the code I am not sure if I was supposed to include a space after the @ character, so if it is required just add it.
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: 420connect on February 07, 2015, 04:17:27 PM
Thank you very much!
that seems to have worked perfectly!

I'm not worried about undoing any of the plugins.
I plan to keep with the Shoutbox now I've found a reliable one :D

I've just noticed actually, when I click the wrench to edit what was said
after what was originally there this is there:

Code: [Select]
<script type="text/javascript">function spSound(){var beep = document.getElementById("beep");beep.play(1);}</script><object id="beep" type="application/x-shockwave-flash" data="Themes/default/images/sp/shout_sounds.swf" width="0" height="0"><param name="movie" value="Themes/default/images/sp/shout_sounds.swf" /><param name="FlashVars" value="onLoad=spSound" /></object>
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: Chen Zhen on February 07, 2015, 05:39:44 PM
420connect,

  You can use regex to remove the sound effect code and I suppose it is not necessary to add it back again afterwards.

file: ../Sources/PortalEdit.php

find:
Code: [Select]
$bodyShout = preg_replace('~<div id="edit_shout_' . $shout_id . '" style="display: inline;">(.*?)</div>(?!\s*<div id="edit_shout_' . $shout_id . '" style="display: inline;">)~', '', $bodyShout);

add after above code (next line):
Code: [Select]
$bodyShout = preg_replace('~<script type="text/javascript">function spSound(){var beep = document.getElementById("beep");beep.play(1);}</script><object id="beep" type="application/x-shockwave-flash" data="Themes/default/images/sp/shout_sounds.swf" width="0" height="0"><param name="movie" value="Themes/default/images/sp/shout_sounds.swf" /><param name="FlashVars" value="onLoad=spSound" /></object>~', '', $bodyShout);
  If that does not work properly then I will have to test it myself as I have not done so. Please let me know how that works.

Regards.
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: 420connect on February 07, 2015, 07:58:19 PM
420connect,

  You can use regex to remove the sound effect code and I suppose it is not necessary to add it back again afterwards.

file: ../Sources/PortalEdit.php

find:
Code: [Select]
$bodyShout = preg_replace('~<div id="edit_shout_' . $shout_id . '" style="display: inline;">(.*?)</div>(?!\s*<div id="edit_shout_' . $shout_id . '" style="display: inline;">)~', '', $bodyShout);

add after above code (next line):
Code: [Select]
$bodyShout = preg_replace('~<script type="text/javascript">function spSound(){var beep = document.getElementById("beep");beep.play(1);}</script><object id="beep" type="application/x-shockwave-flash" data="Themes/default/images/sp/shout_sounds.swf" width="0" height="0"><param name="movie" value="Themes/default/images/sp/shout_sounds.swf" /><param name="FlashVars" value="onLoad=spSound" /></object>~', '', $bodyShout);
  If that does not work properly then I will have to test it myself as I have not done so. Please let me know how that works.

Regards.

That add in worked perfectly, thank you very much!
*e-hugs*
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: 420connect on February 08, 2015, 05:31:10 PM
sorry, after further testing it appears, the shoutbox isn't updating as it should now :S

a: smftest
pw: smftest
@ 420connect.co.uk

if you'd like to test.

I need to post then refresh to see what I just typed or see new replies.




Surely I can't be the first person to want to combine all the plugins for the shoutbox?  :-X
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: ♦ Ninja ZX-10RR ♦ on February 08, 2015, 07:15:46 PM
Surely I can't be the first person to want to combine all the plugins for the shoutbox?  :-X
I'll get there as well :P I already have 135+ mods, all SP plugins can't be missing ;D

The account you provided doesn't have the permission to write in the shoutbox since I couldn't find the relative input field... LOL
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: Chen Zhen on February 08, 2015, 08:22:31 PM
420connect,

The refresh rate of the shoutbox should be set to ie. 10 or 12 seconds for it to function properly using this plug-in.
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: 420connect on February 09, 2015, 01:23:10 AM
Hmm, strange..

I've just discovered one of the recent changes must have had an unexpected effect.

whilst I'm still able to see the inputbox/shout button etc. as admin
these are missing for regular users although they should be able to see it? :S

My refresh rate is set to 12 secs and correct permissions set for use/view of shoutbox.

:X

(off to work now but I'll attach any files that could be related when I get back!)

many thanks!

Title: Re: [Shoutbox] xtra options - failing on test install
Post by: 420connect on February 09, 2015, 11:07:13 AM
Since getting in, I've uninstalled all portal related MOD's/plugins then reinstalled SimplePortal alone.
This has at least fixed the ability to post / have it show fault.


I think I'll hang on until someone who knows what their doing tries out the shoutbox with all avail. plugins :P
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: Chen Zhen on February 09, 2015, 04:08:39 PM
420connect,

  The options plugin adds extra permissions from within your membergroup permission settings for the shoutbox. These must be enabled/disabled for your various membergroups depending on what you want to allow them to do.
Title: Re: [Shoutbox] xtra options - failing on test install
Post by: 420connect on February 09, 2015, 06:06:24 PM
Hello,

firstly thank you for your replies!
(I'll update the thread title to something more appropriate now this has changed.)

Since removing all the extras I've tried adding the extra options plugin and can now see the "extra options"
I'm able to install the 'colours' mod with no problems as well as the 'options' mod but both the 'PM' mod & 'Sounds' mod have fails.

Would anyone mind trying the combination on their test site if possible and sharing a fix to have them all work smoothly, I'd be super thankful and sure others would like to be able to add these features together too.

Title: Re: [Shoutbox] Combining multiple plugins - on going
Post by: Chen Zhen on February 09, 2015, 06:24:13 PM
420connect,

  For the shout sounds I was going to write that into the next version of the options mod and for the other plug-ins you are using it would be better for me to also possibly add them to the same plug-in. A link for PM's and membergroup coloured user names is fairly straight forward as far as coding goes. Hopefully I may have time to do this within the next week or so. This will eliminate your need to use more than the single plug-in for all those options.

Regards.
Title: Re: [Shoutbox] Combining multiple plugins - on going
Post by: ♦ Ninja ZX-10RR ♦ on February 09, 2015, 07:55:56 PM
420connect,

  For the shout sounds I was going to write that into the next version of the options mod and for the other plug-ins you are using it would be better for me to also possibly add them to the same plug-in. A link for PM's and membergroup coloured user names is fairly straight forward as far as coding goes. Hopefully I may have time to do this within the next week or so. This will eliminate your need to use more than the single plug-in for all those options.

Regards.
I second that thing a LOT, thanks VERY much dude! Your help is always much appreciated. A fully modded SP is exactly what I want, yet it's pretty hard to combine everything to make it work properly so it would be truly awesome.
Title: Re: [Shoutbox] Combining multiple plugins - on going
Post by: 420connect on February 10, 2015, 06:47:17 AM
420connect,

  For the shout sounds I was going to write that into the next version of the options mod and for the other plug-ins you are using it would be better for me to also possibly add them to the same plug-in. A link for PM's and membergroup coloured user names is fairly straight forward as far as coding goes. Hopefully I may have time to do this within the next week or so. This will eliminate your need to use more than the single plug-in for all those options.

Regards.

Hi Chen!

Thank you very much again for the reply and that would be ideal! - You're a star!  :angel:
Excitedly awaiting options v2! :)
Title: Re: [Shoutbox] Combining multiple plugins - on going
Post by: 420connect on March 07, 2015, 05:20:14 AM
Just wondering you have had a chance to play around with this yet?

Many thanks
SimplePortal 2.3.8 © 2008-2024, SimplePortal