Firefox PHP

Editor_tools smiley hack.

Posted by sirgrim 
All files from this thread

File Name File Size   Posted by Date  
smileyheadline.zip 5.3 KB open | download sirgrim 04/05/2006 Read message
posting_messageform.tpl 24.9 KB open | download M@AATW 04/10/2006 Read message
smileyheadline.zip 5.3 KB open | download sirgrim 07/14/2006 Read message
Editor_tools smiley hack.
April 05, 2006 06:28AM
I was looking for a mod yesterday like Editor_tools except able to handle headline insertion.

So I hacked it into submission. Here it is in semi-mod form. Basically I've just changed variables and functions so they can run at the same time. I made changes to a few core files to only display the headline smileys for new posts and removed subject changing for replies. If you have any questions I'll try to follow up with this thread, or find me at my page. Thanks Editor_Tools and Phorum creators for a great product!

This hack will overwrite subject line each time you click a new icon and put it at the front. Eventually I'd like to get it to check for only one headline icon in the subject so people don't spam my smileys. Maybe some radio buttons that only allow it at the front or so. Let me know if you get something like that working.

I couldn't find an editor_tools forum to post it on, so hope this one is right for you guys.

Cheers and good foruming..


Forgot to mention there's a demo at my page [www.godsjihad.com] no registration required, avatars, spam filter, etc. latest phorum fully cranking.



Edited 1 time(s). Last edit at 04/05/2006 06:30AM by sirgrim.
Attachments:
open | download - smileyheadline.zip (5.3 KB)
Re: Editor_tools smiley hack.
April 06, 2006 03:33AM
Here's some other considerations/hacks for the smileys plugin.

Changing this function in your smileys.php will make it so only one smiley can be used in the headline/subject, and makes sure the smiley is always at the front. Removes duplicates also.

function phorum_mod_smileys_format($data)
{
$PHORUM = $GLOBALS["PHORUM"];

// Return immediately if we have no active smiley replacements.
if (!isset($PHORUM["mod_smileys"])||!$PHORUM["mod_smileys"]["do_smileys"]){
return $data;
}

// Run smiley replacements.
$replace = $PHORUM["mod_smileys"]["replacements"];
foreach ($data as $key => $message)
{
// Do subject replacements.
if (isset($replace["subject"]) && isset($message["subject"])) {
$subjectonce = 0;
for($i = 0; $i < count($replace["subject"][0]); $i++)
{
if ($subjectonce == 0)
{
if (strpos($message["subject"], $replace["subject"][0][$i]) !== false)
{
$data[$key]['subject'] = str_replace($replace["subject"][0][$i], "", $message["subject"]);
$data[$key]['subject'] = $replace["subject"][1][$i] . $data[$key]['subject'];
$subjectonce = 1;
}
}
else
{
$data[$key]['subject'] = str_replace($replace["subject"][0][$i], "", $data[$key]['subject']);
}
}
}

// Do body replacements.
if (isset($replace["body"]) && isset($message["body"])) {
$data[$key]['body'] = str_replace ($replace["body"][0] , $replace["body"][1], $message['body'] );
}
}

return $data;
}


I also add a hook for tpl_editor_buttons_end and move editor_tools down there and put the headline smileys where editor_tools used to be. My smiley list is pretty big, so having it expandable after the buttons is very nice.
Re: Editor_tools smiley hack.
April 06, 2006 03:35AM
why don't you do this with javascript avoiding core code changes?


Thomas Seifert
Re: Editor_tools smiley hack.
April 06, 2006 04:20AM
Hacking phorum is the best way to learn it and I'm decently new. I'll probably release some stuff eventually, otherwise just posting for anyone looking for something like this or wishes to read what other people have tried. (Who knows, the smileys creators might like it and integrate it with their official release)
Re: Editor_tools smiley hack.
April 06, 2006 04:57AM
Could this be put in a mod? I think it's very good, but don't want to really play with the core code.
Re: Editor_tools smiley hack.
April 08, 2006 11:18AM
I'm having problems installing this.

the link to 'smilies' appears at the top of my posting_messageform. When I click on an icon, I get a pop up window error saying that it's outside the textarea, please inform admin of the error.
Re: Editor_tools smiley hack.
April 08, 2006 11:37AM
This is the error:

There seems to be a technical problem. The textarea cannot be found on the page. The textarea should have id="phorum_textarea" in the definition for this feature to be able to find it. etc....
Re: Editor_tools smiley hack.
April 09, 2006 05:35PM
What browser are you using? That error should only come up if it can't determine your browser, the java is different for IE and Mozilla.
Re: Editor_tools smiley hack.
April 10, 2006 03:30AM
... or if there is no textarea with id="phorum_textarea" in the posting form.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Editor_tools smiley hack.
April 10, 2006 07:05AM
Quote
mmakaay
... or if there is no textarea with id="phorum_textarea" in the posting form.

Yep that seems to be it ;-)

I'm on IE
Sorry, only registered users may post in this forum.

Click here to login