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 |
Registered: 18 years ago Posts: 29 |
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.
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.
Re: Editor_tools smiley hack. April 06, 2006 03:33AM |
Registered: 18 years ago Posts: 29 |
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.
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 |
Admin Registered: 21 years ago Posts: 9,240 |
Re: Editor_tools smiley hack. April 06, 2006 04:20AM |
Registered: 18 years ago Posts: 29 |
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 |
Registered: 19 years ago Posts: 278 |
Re: Editor_tools smiley hack. April 08, 2006 11:18AM |
Registered: 19 years ago Posts: 278 |
Re: Editor_tools smiley hack. April 08, 2006 11:37AM |
Registered: 19 years ago Posts: 278 |
Re: Editor_tools smiley hack. April 09, 2006 05:35PM |
Registered: 18 years ago Posts: 29 |
Re: Editor_tools smiley hack. April 10, 2006 03:30AM |
Admin Registered: 19 years ago Posts: 8,532 |
... 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
Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Editor_tools smiley hack. April 10, 2006 07:05AM |
Registered: 19 years ago Posts: 278 |
Sorry, only registered users may post in this forum.