Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Changes The Instant UBBCode boxes are now added to the preview page as well.

Mod Name / Version Instant UBBCode boxes on PM v1.1
Description This is a hack that adds the Instant UBBCode boxes to the PM pages.
Working under UBB.threads 6.0.1
Any pre-requisites None
Author(s) Gardener
Credits JoshPet who came up with the idea; paulf, Astaran, Aglavalin, Lisa_P for comments.
Demo See attached screenshot
Files Altered sendmessage.tmpl, sendprivate.tmpl, mess_handler.tmpl, mess_reply.tmpl, sendprivate.php, mess_handler.php, mess_reply.php, sendmessage.php
Database Altered No
New Files None
Any other info Please report any problems you might have and I'll try to fix them as soon as possible.

Step 1
Edit the following template files: sendmessage.tmpl, sendprivate.tmpl, mess_handler.tmpl, mess_reply.tmpl

First you will have to change the form tag in all these files. It is slightly different in some of the files, but that doesn't matter, there should only be one in each file. It will look something like this (and is at line 18 in most of them):
code:
<form method="post" action="{$config['phpurl']}/sendmessage.php">



Add the part in red below to the form. Make sure that the action attribute stays the same as before and that you remove the old name attribute!
code:
<form[:"red"] name="replier"[/] method="post" action="{$config['phpurl']}/sendmessage.php">



After that you will have to update the Textarea tag in all of the files. Find the tag that looks like this, again, there should only be one textarea tag in each file. If you have downloaded the zip-version of UBB.threads, the textarea tags might be called textareahtml instead. The two lines below are actually on one line in the files.
code:
<textarea cols="$TextCols" rows="$TextRows" class="formboxes"
name="Message">$RawBody</textarea>



Change the parts in red below. Please make sure that the old name attribute is removed!
code:
<textarea cols="$TextCols" rows="$TextRows" class="formboxes"[:"red"]
wrap="soft" name="Body" onkeyup="storeCaret(this);"
onclick="storeCaret(this);"[/]>$RawBody</textarea>
$instant_ubbcode


Please note that the name attribute is changed, and that you won't have to insert the wrap="soft" in all files since it is already in some. It is also vitally important that the $instant_ubbcode is inserted after the textarea, otherwise the boxes won't show up.


Step 2
In the files sendmessage.tmpl and mess_reply.tmpl you will also have to change the input tag looking like this:
code:
<input type="hidden" name="Message" value="$FormBody" />



And change the red parts below. Note that the name attribute has changed, so the old one has to be removed. Also, since the value attribute is different, make sure you don't change that.
code:
<input type="hidden"[:"red"] name="Body"[/] value="$FormBody" />




Step 3
Open up the files sendprivate.php, mess_handler.php and mess_reply.php and do the following:

Find the line that looks something like this (it is the only one in each file that has the "send_header" part):
code:
$html -> send_header("{$ubbt_lang['PRIV_HEAD']} $User",$Cat,0,$user);



And add this line before it:
code:
$instant_ubbcode = $html -> instant_ubbcode();




Step 4
Now open mess_reply.php and sendmessage.php and do the following in both files:

Find this line near the beginning:
code:
$RawBody = $Message;



And change it into this:
code:
$RawBody = $Body;
$Message = $Body;



Step 5
Open sendmessage.php and do the following:

Find these lines:
code:
// --------------------------------------------------------------
// Now if we are doing a preview of the post, we do this
if ($preview) {



And add this line AFTER:
code:
$instant_ubbcode = $html -> instant_ubbcode();




That's it, you should now have the Instant UBBCode boxes on the PM pages.
Attachments
52904-PM_instantubbcode-1_1.zip (0 Bytes, 55 downloads)

Sponsored Links
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
thank you, any major changes from the last version?


- Allen wavey
- What Drives You?
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
I actually wrote that in the first line of the post =] But here it is again, for those who missed it:
Changes The Instant UBBCode boxes are now added to the preview page as well.

This is the addition that paulf mentioned in the Beta forum. The new part is Step 5, wihch makes sure that the instant_ubbcode is read so it shows up on the preview page. The variable $instant_ubbcode should already be added to the template sendmessage.tmpl, but you might need to check that.

Last edited by Gardener; 07/20/2002 6:37 PM.
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
oops. ok, I should read a bit more closely


- Allen wavey
- What Drives You?
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Damn, you're fast, I edited the post and added the info on which step has been added and a link to the post where it is mentioned.

Sponsored Links
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
Hi all!

I have installed this on 6.1b version and it works fine (sort of).

It all works well when the user starts typing a pm and then clicks ok, previews it and then submits the pm.

However:
The user types the message (inclusive of some graemlins) and clicks on submit, the message is previewed. Then at the bottom he/she has the original message where additions and modifications are allowed and a button to repreview it.

If the user at that time (while in preview mode) tries to add a new graemlin to the message (maybe they forgot the 7th ), then nothing happens and at the bottom of the IE you get a javascript error. The error is as follows:
code:
Line 368
Char 50
Error: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus
Code 0
URL http://www.mywebsite.com/ubbthreads/mess_reply.php



If the user unchecks the "Preview" check box and clicks submit, all is fine!

Any suggestions are more than welcome.

Warm regards

Nikos


Nikos
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
Another one popped up!

A user sends a private messate to me for instance.

I click reply and type my reply (even if I don't use any graemlins). I click submit and a screen comes up saying that All the necessary fields have not been filled up

I click the back button and check OFF the "I want to preview my message" and it gets posted fine.



Any suggestions are more than welcome.

Warm regards

Nikos


Nikos
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Hey,

Sorry you are having trouble.

The "not all fields filled in" when you click Reply usually means it was installed in the wrong place.

Check this thread in the Beta Mods forum....where this hack came about. It seems half of the people installing misunderstood some of the install directions and put some code in the wrong part.

See if Gardener's clarification as to where the code goes helps the problem.

Hope that helps,

Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
Thanks a million Josh. It was indeed the $FormMessage that I stupidly translated to $FormBody.

Thanks for Gardener as well for clarifying this in the other thread.

Warm regards

Nikos


Nikos
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191


Sorry guys but the problem still persists. I checked the code possibly 30 times and it is identical to the instructions. Also I ensured that the $FormMessage is there instead of $FormBody.

Could I please ask a big favor, for someone that has 10 minutes to spare to check the files affected by this hack - I can send them via email. They say 4 eyes are better than 2

If you can help me please send me a private message and I will email you the files. Maybe this will clear it.

Thanks in advance.

Warm regards

Nikos


Nikos
Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
You can send them to me and I'll see if I can find what's wrong. I can "compare" them to my working versions.

My email is in my profile.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
OK -
Numerous issues at play.... BUT
This Hack Does Work fine in Ver 6.1 br1
I've just installed and got it running.

A couple of notes to be careful of. General Install tips if you will.

If when you are previewing a post, you are unable to add graemlins... make sure that in mess_reply.tmpl you add the name="replier" part to the SECOND <form tag. The first form just shows you the message to be previewed... the second one is where the editing is done.

Also....
If things aren't working correctly... try a fresh install. Pay special attention to the fact that you are only inserting/changing the parts in RED above. Don't copy and paste the whole line as the rest of the lines may vary from file to file.
So only add/alter the parts Gardener's got in red above.

Hope this clarifies a bit.

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Here are some updated instructions for 6.1.1, I hope they are a bit easier to follow, maybe not
Attachments
58972-PM_instantubbcode-611.txt (0 Bytes, 61 downloads)


- Allen wavey
- What Drives You?
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Just a note. This will be in for 6.2. This should have been in earlier, but I totally forgot about the PM section. This hack helped remind me


UBB.threads Developer
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Sounds great, then I won't need to update the hack. =]

How about adding signatures to the PM:s as well?

Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
That's what I'm trying to do. I know it's a pain for everyone to update their hacks, so with each version I'll try and get a few of the hacks into the main distribution

Sigs, shouldn't be too hard to add.


UBB.threads Developer
Joined: Apr 2003
Posts: 15
Newbie
Newbie
Offline
Joined: Apr 2003
Posts: 15
When I previewed a new reply, the edit some more box was empty, so I changed:

<textarea name="Body" onkeyup="storeCaret(this);" onclick="storeCaret(this);" cols="$TextCols" rows="$TextRows" wrap="soft" class="formboxes">$RawBody</textarea>

to

<textarea name="Body" onkeyup="storeCaret(this);" onclick="storeCaret(this);" cols="$TextCols" rows="$TextRows" wrap="soft" class="formboxes">[:"red"]$Message[/]</textarea>

and now the Edit Some More box includes my current message for future editing.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)