PDA

View Full Version : Canned Text


filburt1
03-19-2003, 10:00 PM
This hack allows members to reply to messages with "canned text" (prewritten messages). This is useful for moderators and helpful members who find that they are constantly answering the same question over and over again.

filburt1
03-20-2003, 02:34 PM
Screenshots:

Rose
03-20-2003, 02:37 PM
:D Very nice, Filburt!

* Rose installs immediately

Kars10
03-20-2003, 02:37 PM
Very cool Hack!!
Install this right now... :)

Thanks Filburt1

Overgrow
03-20-2003, 02:37 PM
Hey I requested this a few months ago cuz I was too lazy to do it :D Nice! I'll check the shots... I hope this works in PM!

filburt1
03-20-2003, 02:38 PM
It can be adapted to work anywere, just get the data from the cannedtext table.

Overgrow
03-20-2003, 02:39 PM
>>Don't ever PM me with vB questions. Ever.

If your hack worked in PMs you could just use a canned response :)

filburt1
03-20-2003, 02:41 PM
I just ignore vB PMs.

Xenon
03-20-2003, 02:44 PM
hmm, how did you become mod then? :D

as said in general hacking..
nice hack :)

N9ne
03-20-2003, 03:01 PM
This is a very nice hack filby, thanks :).

Dan
03-20-2003, 03:11 PM
Wow Filbie has turned hacker

-will install this when he gets home-

Dean C
03-20-2003, 03:21 PM
Cool hack filburt. Can we add an admin option to use it only for certain usegroups?

Where you seperate the usergroups with a comma?

Thanks ;)

- miSt

Schorsch
03-20-2003, 03:21 PM
Thanks filburt!

One question, how can I make this only available for admins and mods ?

filburt1
03-20-2003, 03:30 PM
It can if you write it yourself :p

pattox
03-20-2003, 03:31 PM
Wow, thanks Filburt I apreciate you responding to my request so quickly!

Overgrow
03-20-2003, 03:52 PM
>>It can if you write it yourself

LOL a hacker after my own heart.

Kars10
03-20-2003, 03:55 PM
Today at 18:21 Schorsch said this in Post #13 (https://vborg.vbsupport.ru/showthread.php?postid=370017#post370017)
Thanks filburt!

One question, how can I make this only available for admins and mods ?

Hab ich bei mir auch gemacht. ?ber den Logician Template Conditions Hack. :)

I love this hack!! Great work Filburt! ;)

N9ne
03-20-2003, 04:00 PM
Today at 05:55 PM Kars10 said this in Post #17 (https://vborg.vbsupport.ru/showthread.php?postid=370038#post370038)


Hab ich bei mir auch gemacht. ?ber den Logician Template Conditions Hack. :)

I love this hack!! Great work Filburt! ;)


Oh oh, German practise:

"I have done this myself using Logician's conditional templates hack"

Something like that eh?

Xenon
03-20-2003, 04:03 PM
exactly :)

Kars10, kannst doch jetzt nicht einfach hier mit deutsch anfangen :D

Kars10
03-20-2003, 04:36 PM
@ Ni9ne, very Good!! Exactly that!! ;)
@ Xenon, sorry die Gewohnheit ... :(

N9ne
03-20-2003, 05:09 PM
Today at 06:03 PM Xenon said this in Post #19 (https://vborg.vbsupport.ru/showthread.php?postid=370049#post370049)
exactly :)

Kars10, kannst doch jetzt nicht einfach hier mit deutsch anfangen :D


And you said something about not talking in German everytime in threads, "Kars10, can you not in every thread discuss in German" lol, I worded that badly, but it was a word to word translation.

Anyway, I'm taking this too off topic...so um I'll stop now :)

N!ck
03-20-2003, 05:24 PM
Great idea!

Boofo
03-20-2003, 06:12 PM
Good one, Turtle Guy. ;) Thanks!

Intex
03-20-2003, 07:29 PM
Very cool hack m8 :cool:.

Kars10
03-20-2003, 07:41 PM
@ Filburt, how can we integrate this to Firefly?s Quickreplybox?? :confused:

Kars

ULTIMATESSJ
03-20-2003, 08:23 PM
i've been looking for something like this for my forums, it's very useful for mods and admins who have to deal with the same spammers and problems

Boofo
03-20-2003, 08:55 PM
For anyone interested in having this show only to Admins and SuperMods (and Mods, if desired), use Logician's Dynamic Templates hack (and if you're not, shame on you!) and just do a conditional in the usercpnav template for the link in the navbar and the $jscannedbits in the newreply template. ;)

Chris Gwynne
03-20-2003, 09:03 PM
I was going to suggest that to Mist, Boofo :p

This is the way I'm doing it and it works well. :p

Boofo
03-20-2003, 09:06 PM
The only drawback is that they can still run the cannedtext.php file from the url bar and save text that way. ;)

Rose
03-20-2003, 09:23 PM
Isn't there a way to prevent certain usergroups from viewing certain php files?

filburt1
03-20-2003, 10:02 PM
Well by editing the PHP file yes:

if (!in_array($bbuserinfo['usergroupid'], array(list of bad usergroupids)))
{
...
}

Link14716
03-20-2003, 10:42 PM
Or... if (in_array($bbuserinfo['usergroupid'], array(list of bad usergroupids))) {
exit;
}

Nice hack. :)

* Link14716 (c)licks install. :)

Chris Gwynne
03-20-2003, 11:14 PM
Well, only YOU know about cannedtext.php in the first place. So, I don't think it's a problem. :)

Boofo
03-20-2003, 11:16 PM
So, if we replace both instances of this:

if ($bbuserinfo['userid'] == 0 or $ctmax == 0) show_nopermission();

with this:

if (!in_array($bbuserinfo['usergroupid'], array(5, 6, 7)) or $ctmax == 0) {
show_nopermission();
}

in the cannedtext.php file, then we should be all set? ;)

filburt1
03-20-2003, 11:26 PM
Yup, looks right.

Schorsch
03-21-2003, 12:28 AM
Yesterday at 06:30 PM filburt1 said this in Post #14 (https://vborg.vbsupport.ru/showthread.php?postid=370022#post370022)
It can if you write it yourself :p

yeah man i'm not a hacker! great support here :(

filburt1
03-21-2003, 12:33 AM
As the title clearly states:
The hacker cannot guarantee to provide support for this hack.
So I don't think the one star rating was really necessary, now was it? I'm a busy man, I can't customize every hack I write for every user who asks.

Schorsch
03-21-2003, 12:35 AM
1 star ? I gave u 5!

!!BUSH SUCKS!!

filburt1
03-21-2003, 12:36 AM
Well somebody did, circumstances just seemed to point to you.

That Bush thing was sure out of nowhere...

Boofo
03-21-2003, 12:50 AM
He's busy working on his math. ;)

Xscape
03-21-2003, 01:44 AM
Hmm... I like the idea... And I installed...

But I don't get why I see nothing in under
"Edit Canned Text"

filburt1
03-21-2003, 01:47 AM
If the textboxes are empty it's because you haven't defined any custom text yet.

Xscape
03-21-2003, 01:49 AM
No, there's just nothing there. The table ends after "Edit Canned Text".

filburt1
03-21-2003, 01:50 AM
Then you didn't install the hack correctly, or you're not using my normal requirements of PHP 4.3.0 and vB 2.3.0 RC3.

Boofo
03-21-2003, 04:44 AM
To have the usercp navbar appear at the top of the page in your cannedtext page:

NOTE: You may want to edit the first part here. I have 9 items in my navbar. You may have less or more.

Add this:

$cpnav[1]="#1C5780";
$cpnav[2]="#1C5780";
$cpnav[3]="#1C5780";
$cpnav[4]="#1C5780";
$cpnav[5]="#1C5780";
$cpnav[6]="#1C5780";
$cpnav[7]="#1C5780";
$cpnav[8]="#1C5780";
$cpmenu[9]="class=\"fjsel\" selected";
$cpnav[9]="#13486D";

Above this:

eval("\$cpnav = \"".gettemplate("usercpnav")."\";");

And put:

<br>
$cpnav
<br>

In the cannedtext template right BELOW this:

<table cellpadding="2" cellspacing="0" border="0" width="95%" align="center">
<tr>
<td width="100%"><normalfont>
<b><img src="https://vborg.vbsupport.ru/images/vb_bullet.gif" align="middle" alt="$bbtitle - powered by vBulletin version $templateversion">
<a href="index.php?s=$session[sessionhash]">$bbtitle</a>
&gt; Edit Canned Text</normalfont></td>
</tr>
</table>

You will have to ajust the colors accordingly since vb.org parses them out here. But you should all get the idea. ;)

pattox
03-21-2003, 12:09 PM
I dont seem to have permission to access cannedtext.php, I am admin...

filburt1
03-21-2003, 12:13 PM
With my original cannedtext.php? It will load if your userid is not 0 (i.e., you're not a guest). Make sure you're logged in.

pattox
03-21-2003, 12:19 PM
You do not have permission to access this page. This could be due to one of several reasons:
You do not have permission to access the page that you were trying to. Are you trying to edit someone else's post or trying to access administrative features? Check that you are allowed to perform this action in the Forum Rules.
If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logged in user: Owen [logout]

filburt1
03-21-2003, 12:34 PM
What are the first few lines of cannedtext.php?

pattox
03-21-2003, 12:42 PM
<?
if ($_POST['action'] == "save")
{
$templateused = "standardredirect,redirect_cannedtextsaved";
require("./global.php");
if ($bbuserinfo['userid'] == 0 or $ctmax == 0) show_nopermission();

$userid = $bbuserinfo['userid'];

// force the update to work if the rows don't exist yet
$DB_site->query("DELETE FROM cannedtext WHERE userid = $userid");
$DB_site->query("INSERT INTO cannedtext (userid, number, contents)
VALUES ($userid, 1, \"\"), ($userid, 2, \"\"), ($userid, 3, \"\"), ($userid, 4, \"\"), ($userid, 5, \"\")");

lalo landa
03-21-2003, 12:48 PM
the same happends to me....
do U know what's goin on?

filburt1
03-21-2003, 12:51 PM
Make sure that you have the canned text settings correct in the admin CP

lalo landa
03-21-2003, 12:53 PM
there's options only in the MAIN options of the vb?
because the only settig that i see is the max of words...

lalo landa
03-21-2003, 12:56 PM
the problem is in here

if ($bbuserinfo['userid'] == 0 or $ctmax == 0) show_nopermission();

I take out the line and works grate.. but.. the unregistred can access

lalo landa
03-21-2003, 01:02 PM
Ready

change the line
if ($bbuserinfo['userid'] == 0 or $ctmax == 0) show_nopermission();

for
if ($bbuserinfo['userid'] == 0 ) show_nopermission();


and works fine but U can't disable the "service"

Boofo
03-21-2003, 01:27 PM
I think you need to go to the Admin CP and open the cannedtext options and save it for it to work right. I am using the same code (with a few usergroupids added) that you took out and it works fine for me. ;)

pattox
03-21-2003, 01:57 PM
yea, that woz the problem. I didnt realise that installer added the settings...

filburt1
03-21-2003, 02:01 PM
What's more the installer makes the settings defaults of not 0 so it's weird that it happened. Either way that line works: if the user is a guest or the system is disabled, then deny access.

Boofo
03-21-2003, 02:08 PM
filburt, you might want to add that to the instruction file where they have to go to the options and hit enter to make it work. ;)

filburt1
03-21-2003, 02:10 PM
I have to edit my install script to edit the options template too (stupid vB way of doing settings...).

edit: I can't until I get home anyway because it's tricky to compress stuff in OS X.

Boofo
03-21-2003, 02:17 PM
Whenever is fine. It will save you a lot of "it's not working, what's wrong" messages. I know how much time you need for math. Just trying to help. ;)

Boofo
03-25-2003, 11:50 AM
filburt, I put this hack in the newthread.php too, but I want to make sure I have to code in the right spot so as not too mess with anything else in there. I put the code for this hack below the following code:

// check to see if signature required
if ($bbuserinfo[userid]!=0 and !$previewpost) {
if ($bbuserinfo[signature]!="") {
$signaturechecked="CHECKED";
} else {
$signaturechecked='';
}
if ($bbuserinfo[emailnotification]) {
$emailchecked="checked";
} else {
$emailchecked='';
}
}

Is that ok or do I need to move it somewhere else?

filburt1
03-25-2003, 01:07 PM
It should be pretty much anywhere after the permission checks and before showthread is eval'ed.

Boofo
03-25-2003, 01:22 PM
Well, it's in the Start New Thread section and the only permissions in there are for the poll posting. That is the last section of the file and a few lines up from the dooutput newthread. Hopefully it will be ok there.

drumsy
03-25-2003, 03:28 PM
Why does the "Canned Text" Nav option display correctly when accessing my User CP but when I click on anything else like Edit Options or Private Messages, it get's blacked out?

drumsy
03-26-2003, 01:13 PM
Bump! :)

filburt1
03-26-2003, 02:12 PM
I think it's a bug, look at that whole block of the same code with indicies 1 to 7 and add the 8th where appropriate.

Boofo
03-26-2003, 06:02 PM
filburt, is there a way to allow canned text to be added to the message instead of writing over anything we have in the message box when we use it? Right now, if I write anything in the message and click any canned text, it erases what is there and inserts the canned text.

filburt1
03-26-2003, 07:00 PM
Edit the Javascript added via the template mod (no, don't know how).

Boofo
03-26-2003, 07:09 PM
You and me both. ;) I'm disappointed now, filburt. I thought you were the "Ultimate Hacker" these days, capable of almost anything, with all of the great hacks you've been releasing. ;)

Does anyone else reading this thread know how to accomplish this?

filburt1
03-26-2003, 07:11 PM
Today at 04:09 PM Boofo said this in Post #70 (https://vborg.vbsupport.ru/showthread.php?postid=373744#post373744)
You and me both. ;) I'm disappointed now, filburt. I thought you were the "Ultimate Hacker" these days, capable of almost anything, with all of the great hacks you've been releasing. ;)


I'm working on yet another addition to the Major Additions category :p

Boofo
03-26-2003, 07:13 PM
Well, I guess we'll just have to see if you keep the "Ultimate Ultimate Hacker" status after you release it then, huh? ;)

You're going to have to do something pretty amazing to recover from this, though, I'm afraid. :p

drumsy
03-27-2003, 01:41 PM
Yesterday at 11:12 AM filburt1 said this in Post #67 (https://vborg.vbsupport.ru/showthread.php?postid=373608#post373608)
I think it's a bug, look at that whole block of the same code with indicies 1 to 7 and add the 8th where appropriate.

I'm not quite following you....:(

drumsy
04-01-2003, 12:06 AM
Bump! :)

sabret00the
04-01-2003, 03:12 PM
Great hack, will be installing this on my boards soon

Boofo
04-02-2003, 11:14 AM
filburt, how do we make it so the canned text boxes have 2 on each line instead of one box on each line and wasting all that space?

filburt1
04-02-2003, 12:00 PM
Just edit the cannedtext template but you'll loose the ability to dynamically show the correct number of textareas.

Boofo
04-02-2003, 02:34 PM
If I knew how to do it, I wouldn't have bothered you with it. ;)

I'm still new at tables, but isn't there a way to make it do 2 tables side by side for each line and do it something like that?

filburt1
04-02-2003, 02:36 PM
Would be more efficient to make it 4 columns instead of the 2 it is now.

Boofo
04-02-2003, 02:42 PM
Ok, how can we do that?

filburt1
04-02-2003, 02:43 PM
Would take too much time to explain, would prefer to just help with the normal hack :)

Mathiau
04-10-2003, 07:58 AM
Ignore - got it - just had to change and save an admin option and they show!

wicked hack m8 - u rule!

+Fares+
04-12-2003, 10:04 PM
filburt1 , help me with this please everything was fine , except this one to selet the canned text ..

as u see in the attach file ..the rest are working more then great except this didn't appears ..

filburt1
04-12-2003, 11:09 PM
Make sure you followed the instructions and that you ran the script properly for all style sets.

+Fares+
04-13-2003, 01:09 AM
same thing i followed everything all over again but still can't get the it man :(

+Fares+
04-17-2003, 01:51 PM
evertyhign thing works more then great now :-)

any way to use the canned text in the PM too ?

Great work man !:)

filburt1
04-17-2003, 03:12 PM
Yes, just get the appropriate info from the cannedtext table and use the same routine I did to clean it for Javascript.

vB-Host.com
04-25-2003, 07:46 PM
In template new reply I have...
$message</textarea><br>
<smallfont><a href="javascript:checklength(document.vbform);">[check message length]</a>$jscannedbits </smallfont></td>

but if I reply to a message .. http://www.vb-host.com/forum/newreply.php?s=&action=newreply&threadid=20 there is no place to get the canned text from... only the message lenth.

filburt1
04-25-2003, 07:47 PM
Do you have any canned text set up in your user CP?

vB-Host.com
04-25-2003, 10:09 PM
yes I sure do ... three different ones and the limit is set to 25 in the acp options

filburt1
04-25-2003, 10:20 PM
Then I don't know what to say. Make sure you followed the instructions to the letter.

vB-Host.com
04-25-2003, 11:19 PM
redid the hack three times.. ran the installer three times... nothing

yxboom
04-29-2003, 10:41 PM
I had the problems of no permission to access the canned text but did what Boofo said to just click Save in the Admin Options and it worked without any alteration to the hack. Just FYI :)

Boofo
06-01-2003, 12:16 PM
I wouldn't trust a whole lot of what Boofo says. He's wrong more than he is right.

Chris M
06-01-2003, 03:57 PM
I'll vouch for that Bob;):p

Nice filby;)

Satan

Intex
06-01-2003, 06:21 PM
Works great. Excellent idea Filburt1. I had a problem initially. I couldn't see the canned text drop-down and had the permission denied message when selecting the link for the Canned Text in the usercp.

I read a little further on and noticed that the reason was because you needed to visit the admincp and just save the options to activate everything. Once I'd done this - everything worked fine. May be a good idea to update the instructions to help others :).

* Intex clicks install.

Boofo
06-01-2003, 07:34 PM
Today at 11:57 AM hellsatan said this in Post #95 (https://vborg.vbsupport.ru/showthread.php?postid=402943#post402943)
I'll vouch for that Bob;):p

Nice filby;)

Satan

You're only saying that because it's true.

Test time! Ok, Chris, you should know this one, then. How do I edit the javascript to allow me to add the canned text to a message instead of it replacing a message in a reply?

reismarktq2
06-10-2003, 06:37 PM
Test time! Ok, Chris, you should know this one, then. How do I edit the javascript to allow me to add the canned text to a message instead of it replacing a message in a reply?You guys are going to be kicking yourselves: Changing the code so that the canned text is added to the message instead of replacing the message only requires the addition of ONE CHARACTER to ONE LINE of code.

In the newreply template, find:if (number != 0) document.vbform.message.value = cannedtext[number];Change it to:if (number != 0) document.vbform.message.value += cannedtext[number];Just goes to show you that nine hundred-ninety-nine times out of a thousand, the answer is simpler than we expect it to be...

Now I have a question of my own: Any idea how I can add the canned text drop-down to my newthread.php, so that my users can use their canned text when posting a new thread?

filburt1
06-10-2003, 06:39 PM
That won't insert it at the caret, but still good nonetheless ;)

Boofo
06-10-2003, 11:26 PM
Thank you very much, reismarktq2. That works a lot better than it did. Any idea how to reset the drop down after we pick a canned text from the listing so we can add more than one per message if needed?

By the way, I have it in the newthread also. Basically just do the same thing in newthread as you did in the newreply and it will work. ;)

reismarktq2
06-11-2003, 10:58 AM
Boofo: That was my guess, but I asked the question because I couldn't find the same block of code in newthread.php as in newreply.php, and I wasn't sure where to put the hack code in the file. Where did you put it in newthread.php?

As for adding more than one canned message - the code as is doesn't prevent you from doing that. If you click on the listing and pick another item, it still will add it. It's just a visual rather than a function distraction right now.

Boofo
06-11-2003, 11:04 AM
If I pick a canned text from the drop down I have to set the drop down at the default (Select canned text:) before I can do another pick from the listing. I want it to go back to the default after I have picked a canned text from the listing so I can pick another one instead of having to manually going back to the default first. Does that make any sense?

In newthread, I put the same code for newreply after this:

if ($bbuserinfo[emailnotification]) {
$emailchecked="checked";
} else {
$emailchecked='';
}
}

reismarktq2
06-11-2003, 11:22 AM
Today at 08:04 AM Boofo said this in Post #102 (https://vborg.vbsupport.ru/showthread.php?postid=407469#post407469)
If I pick a canned text from the drop down I have to set the drop down at the default (Select canned text:) before I can do another pick from the listing. I want it to go back to the default after I have picked a canned text from the listing so I can pick another one instead of having to manually going back to the default first. Does that make any sense?Unfortunately, it doesn't to me, because I don't have to go back to the default... I can just select the next item and it'll add it without a problem.

In newthread, I put the same code for newreply after this:

if ($bbuserinfo[emailnotification]) {
$emailchecked="checked";
} else {
$emailchecked='';
}
} Thanks, this did the trick. :)

Boofo
06-11-2003, 12:04 PM
Maybe it's because I only have 1 canned text in there now. I'll add a few more and try it. ;)

Glad you got it working in the newthread. I also have it in the editpost but I only have it turned on for Admins and Mods.

If there a way to have it add the canned text wherever the cursor is at? Or do we need to go in the js files for that?

Holidazed
07-01-2003, 05:13 PM
Boofo, your addon for the newthread is awesome. However, you also need to follow the newreply template instructions on put them in the newhtread template instead. Works like a charm.

Awesome hack filbert. How do I add this to the PM system. I am constantly getting PMs that require the same reply. Can we add this there?

I would also like to see and option to turn off the PM Canned text like the Thread Canned text canned be turned off.

Holidazed
07-07-2003, 02:39 PM
Well, it seems that only Admins and Moderators can make use of this hack. Can somebody please tell me how to make this available to everybody?

Holidazed
07-15-2003, 02:15 PM
Come on guys!! I need a bit of help here.

proxyMX
07-15-2003, 03:30 PM
Canned Text is sorta a macro tool then?

Sadie Frost
01-16-2004, 12:50 AM
Well, it seems that only Admins and Moderators can make use of this hack. Can somebody please tell me how to make this available to everybody?

I just installed this and it worked fine for registered members as well :)

Crank
02-29-2004, 03:52 PM
i have installed but am having trouble trying to integrate to the quick reply box on my site. anyone able to help please?

Nutz
03-25-2006, 07:03 PM
Any chance of this being converted to 3.5?

Thanks,
Mat

GrantHorizons
04-03-2006, 12:04 PM
Yes - VERY useful - but 3.5 PLEASE! :)

Nutz
04-03-2006, 11:07 PM
I found the same type of hack for 3.5 :)
https://vborg.vbsupport.ru/showthread.php?t=103027&highlight=quick+clip

Thanks,
Mat