Back to vBulletin 3.0 Add-Ons

Quick Edit! -Edit posts directly from within the thread itself
Mod Version: 2.00, by EvilLS1

This modification is in the archives.
vB Version: 3.0.6 Rating: (1 vote - 5.00 average) Installs: 145
Released: 04 Jan 2004 Last Update: 25 Jan 2005 Downloads: 27
Not Supported  

This hack will allow your users to edit their posts without having to load the editpost page..

How it works: In the bottom right-hand corner of all your posts will be a small Quick Edit icon (users will only see it in posts which belong to them).. When you click it a text box will drop down below your post allowing you to edit it instantly in the thread itself.

This will save you a lot of time when fixing those spelling mistakes, typos, or broken links. It should also help save on bandwidth since your users will no longer need to load the editpost page.

Very easy to install.. 2 file edits, 2 template edits, and 1 template to add.

Known bug: Quick Edit will NOT work with Opera web browsers. Those who use Opera simply won't see the option to quick edit (icon will be invisible when viewed in that browser). It'll work fine in other browsers such as IE or firefox.

Support: Due to work my time is limited as of late so this hack is released AS IS with no support. However, several questions have already been answered in this thread.

Update (7-25-04): Fixed a minor bug with the QE window moving further to the left with each click in mozilla/firefox browsers. To update simply replace your showthread_quickedit template with the new one. Thanks to sv1cec for this bug fix.

Add Ons:
*Show the "delete post" option for those who have permission in the Quick Edit form (also adds edit reason).

Spoiler (click to open)


Dewayne,

Great, that did it. One small problem, it breaks the PM system, when you try to view a PM. We need to have that part of the code, work only in showthreads and not in ... showPM (that doesn't exist obviously, just joking).

What happens is that when a user tries to see one of the PMs in his inbox, the query is run and he gets the following error:

Database error in vBulletin 3.0.1:

Invalid SQL:
SELECT postid
FROM post
WHERE threadid=
ORDER BY dateline
LIMIT 1

mysql error: You have an error in your SQL syntax near 'ORDER BY dateline
LIMIT 1
' at line 5

mysql error number: 1064

Date: Wednesday 28th of July 2004 02:19:04 AM
Script: http://forum.m1911.org/private.php?do=showpm&pmid=733
Referer: http://forum.m1911.org/private.php?
Username: John
IP Address:

Here is what I found:

Replace the QE code in includes/function_showthread.php, with the one below:

PHP Code:
        // Quick Edit hack
        
if (THIS_SCRIPT=='showthread' AND $post['editlink'] AND $bbuserinfo[userid]>0)
        {
    
$forumperms fetch_permissions($thread['forumid']);
    
        
// find out if first post
        
$getpost $DB_site->query_first("
            SELECT postid
            FROM " 
TABLE_PREFIX "post
            WHERE threadid=
$thread[threadid]
            ORDER BY dateline
            LIMIT 1
        "
);
        if (
$getpost['postid'] == $post['postid'])
        {
            
$isfirstpost true;
        }
        else
        {
            
$isfirstpost false;
        }
    
    
        if (
$isfirstpost AND can_moderate($thread['forumid'], 'canmanagethreads'))
        {
            
$show['deletepostoption'] = true;
        }
        else if (!
$isfirstpost AND can_moderate($thread['forumid'], 'candeleteposts'))
        {
            
$show['deletepostoption'] = true;
        }
        else if ((((
$forumperms CANDELETEPOST) AND !$isfirstpost) OR (($forumperms CANDELETETHREAD) AND $isfirstpost)) AND $bbuserinfo['userid'] == $post['userid'])
        {
            
$show['deletepostoption'] = true;
        }
        else
        {
            
$show['deletepostoption'] = false;
        }
        
                if (
$post['userid'] == $bbuserinfo['userid'])
            {
                
$edittext htmlspecialchars_uni($post['pagetext']);
                eval(
'$quickedit = "' fetch_template('showthread_quickedit') . '";');
            } 
            else 
            {
                
$edittext="";
                
$quickedit="";
            }
    }
        
// End Quick Edit hack 
With this if in the beginning, it works fine.

Below is my version of the showthread_quickedit template. I've made it a bit cramped, so that it is indeed a QUICK edit. It includes the editing and the deleting function.

HTML Code:
<span id="quickedit_$post[postid]">
				<img src="$stylevar[imgdir_button]/quickedit_icon.gif" alt="Quick Edit" border="0" />
				<script type="text/javascript"> vbmenu_register("quickedit_$post[postid]", true); </script>
			</span>
<div id="quickedit_$post[postid]_menu" style="display:none">
<form enctype="multipart/form-data" name="vbulletinform" style="display:inline;" action="editpost.php" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="do" value="updatepost" />
<input type="hidden" name="p" value="$post[postid]" />
<input type="hidden" name="posthash" value="$posthash" />
<input type="hidden" name="poststarttime" value="$poststarttime" />
<input type="hidden" name="emailupdate" value="9999" />
<input type="hidden" name="disablesmilies" value="0" />
<input type="hidden" name="parseurl" value="1" id="cb_parseurl" />
<input type="hidden" name="iconid" value="$post[iconid]" />	
<table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" align="left" bgcolor="#D6DAE5">
<tr>
<td bgcolor="#3A5383" align="left">
<TABLE width="100%">
<TR>
<TD align="left"><font color="#ffffff">
$vbphrase[edit_post]</FONT>
</TD>
<TD align="right"><font color="#ffffff">
<div class="smallfont" align="right">Click anywhere outside this box, to cancel editing.</DIV></FONT>
</TD>
</TR>
</TABLE>
</td>
</tr>
<tbody> 
<tr valign="top">
<td class="panelsurround" align="center">
<div class="panel">
<div align="left">
	<div class="smallfont" style="margin-bottom:$stylevar[formspacer]px">
	 <div>$vbphrase[reason_for_editing]:</div>
	 <div><input type="text" class="bginput" name="reason" value="$newpost[reason]" size="50" maxlength="200" tabindex="1" title="$vbphrase[optional]" /><input type="hidden" name="reason_exists" value="$edit[reason_exists]" /></div>
	</div>
	<div class="smallfont" style="margin-bottom:$stylevar[formspacer]px">
	 <div>New $vbphrase[title]:</div>
	 <div><input type="text" class="bginput" name="title" value="$post[title]" size="50" maxlength="85" tabindex="1" /></div>
	</div>
	<div class="smallfont" style="margin-bottom:$stylevar[formspacer]px">
	 <div>$vbphrase[message]:</div>
	 <div><textarea name="message" class="bginput" style="width:470px; height:125px;" wrap="virtual" tabindex="1">$edittext</textarea></div>
	</div>
</div>
</div>
<TABLE width="100%">
<TR>
<TD ALIGN="LEFT">
	 <if condition="$bbuserinfo['signature'] != ''">
	<input type="checkbox" name="signature" value="1" checked /><span class="smallfont">Signature</span></if>
</TD>
<TD ALIGN="RIGHT">
<input type="submit" class="button" name="sbutton" value="Save Changes" accesskey="s" tabindex="1" />
</TD>
</TR>
</TABLE>
</td>
</tr>
</tbody>
</form>
<if condition="$show['deletepostoption']">
<form action="editpost.php" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="p" value="$post[postid]" />
<input type="hidden" name="do" value="deletepost" />
<tr>
	<td bgcolor="#3A5383" align="left">
		<font color="#ffffff">$vbphrase[delete_this_message]</font>
	</td>
</tr>
<tbody id="collapseobj_editpost_delete" style="$vbcollapse[collapseobj_editpost_delete]">
	<tr>
		<td class="panelsurround" align="center">
		<div class="panel">
			<div align="$stylevar[left]">
			<div class="fieldset"> 
	$vbphrase[delete_message_check_appropriate_option]&nbsp;
				<if condition="$isfirstpost">
					$vbphrase[deleting_message_deletion_of_thread]
				</if>
			</div>
			<fieldset class="fieldset">
				<legend>$vbphrase[delete_options]</legend>
				<div style="padding:$stylevar[formspacer]px">
					<div>
						<label for="rb_del_leave"><input type="radio" name="deletepost" value="" id="rb_del_leave" tabindex="1" checked="checked" />$vbphrase[do_not_delete_message]</label>
					</div>
					<div>
						<label for="rb_del_soft"><input type="radio" name="deletepost" value="delete" id="rb_del_soft" tabindex="1" />$vbphrase[delete_message]</label>
						<if condition="$show['physicaldeleteoption'] AND $show['keepattachmentsoption']">(<label for="cb_keepattachments"><input type="checkbox" name="keepattachments" value="1" id="cb_keepattachments" tabindex="1" />$vbphrase[keep_attachments]</label>)</if>
					</div>
					<if condition="$show['physicaldeleteoption']">
					<div>
						<label for="rb_del_hard"><input type="radio" name="deletepost" value="remove" id="rb_del_hard" tabindex="1" />$vbphrase[physically_remove_message]</label>
					</div>
					</if>
				</div>
			</fieldset>
			<div class="smallfont">
				<div>$vbphrase[reason_for_deletion]:</div>
				<input type="text" class="bginput" name="reason" size="50" tabindex="1" title="$vbphrase[optional]" />
			</div>
			</div>
		</div>
<TABLE width="100%">
<TR>
<TD ALIGN="LEFT">
<div class="smallfont">Click anywhere outside this box, to cancel editing.</div>
</TD>
<TD ALIGN="RIGHT">
<input type="submit" class="button" value="$vbphrase[delete_this_message]" tabindex="1" accesskey="s" />
</TD>
</TR>
</TABLE>
</td>
</tr>
</tbody>
</form>
</if>
</table>
</div>
Maybe this helps some other folks here.

Rgds
Attached Images
File Type: jpg qe1.jpg (61.0 KB, 146 views)
File Type: jpg qe2.jpg (65.6 KB, 125 views)

Close
(by sv1cec)
*Show the "edit reason" field in the Quick Edit form.

Spoiler (click to open)


Thank you.

Quote by Convergys
An idea for this as an addon, have the option for adding the edit reason...?
Nice idea. To add the edit reason field, open your showthread_quickedit template and find:
Code:
		<td><textarea name="message" class="bginput" style="width:455px; height:85px;" wrap="virtual" tabindex="1">$edittext</textarea><br>
Below it add:
Code:
		<!-- edit reason field -->
		<div class="smallfont" style="margin-bottom:$stylevar[formspacer]px">
			<div>$vbphrase[reason_for_editing]:</div>
			<div><input type="text" class="bginput" name="reason" value="$newpost[reason]" size="50" maxlength="200" tabindex="1" title="$vbphrase[optional]" /><input type="hidden" name="reason_exists" value="$edit[reason_exists]" /></div>
		</div>
		<!-- / edit reason field -->

Close
(Requested by Convergys)
*Alternate Quickedit icon image

Spoiler (click to open)


If you are anal like me I have attached a image that goes with the default VB style.

Also add " class="inlineimg" " to the image tag in the showthread_quickedit to have it line up perfectly.

Thanks for a great hack!! :devious:
Attached Images
File Type: gif wuick_reply.gif (3.1 KB, 111 views)
File Type: gif quickedit_icon.gif (400 Bytes, 458 views)
File Type: gif ip.gif (379 Bytes, 444 views)

Close
(by ryancooper)
*Another alternate Quickedit icon

Spoiler (click to open)


Quote by EvilLS1
sv1cec,
Very strange. It doesn't seem to be happening on my site. Not sure what could be causing it.

Try this and let me know if it still happens:

In the QE template find:
Code:
	 <if condition="$bbuserinfo['signature'] != ''"> <label for="cb_signature"><input type="checkbox" name="signature" value="1" id="cb_signature" tabindex="1" checked /><span class="smallfont">Signature</span></label></if>
Replace it with:
Code:
	 <if condition="$bbuserinfo['signature'] != ''">
	<input type="checkbox" name="signature" value="1" checked /><span class="smallfont">Signature</span></if>
THANK YOU SIR!

This seems to fix the problem. The admins post do not loose their signature now, and a user who had a post when he had no signature, can now edit, and the QE hack respects the new condition and adds the signature.

The final issue I have, has to do with the location of the window, which opens up for QE. Suppose I have a post and I hit the QE button. Then I cancel it. Then I hit QE again, and the window open a bit further to the left, than the first time. Cancel it again and hit QE again, and the window is almost 50% out of the screen. Something works incrementaly in the location of the window, as far as its horizontal positioning is concerned.

On the same issue, if the post's QE button, is too low on your screen, the QE window opens up below the button, so sometimes it hardly appears on the screen. I assume that if this is the case (QE button too far down), the window should open above it, instead of below it.

On another issue, could you please update the instructions on the following two issues:

- If one wants to give the user the ability to delete his post, what should one add to the showthread_quickedit template?
- If one wants to show the QE to people who can moderate and administrate, as well as the poster, what are the changes that need to be made? The ones descrined in post #9, seem to be outdated now. I also do not want to go with the method described in the early stages of this thread, using $bbuserinfo['usergroupid'] ==6 , I'd rather have can_moderate($forum[forumid]). In this case thought, there should be some changes in the signature handling, where $postinfo['signature'] should be used. I am not sure however, where these changes should occur. Any help?

Another issue, would it be possible to have a working "Cancel" button. The method of clicking outside the QE box is logical for programmers etc. but not so intuitive for end-users. Plus, sometimes clicking outside the box does not close it (if you click right next to the box, to its left or to its right) and you have to click again, above it or below it, to make it go.

Finally, if I may add my 2 Eurocents, I think that the QE button should be just before the Edit button. I think this is a more logical position than between the Quote and the Quick Reply buttons. I also took some time to make a QE button to match the other buttons in the standard vB installation. If you like it you may use it.



Have I clicked install? I think I have.

Thank you for a nice addition to my forum.

Close
(by sv1cec)
*Another alternate Quickedit icon

Spoiler (click to open)


Awesome hack, thank you.

As a newbie hacker, my feeble contribution is my rendition of a quick-edit button, which I think looks nice.

Charles
Attached Images
File Type: gif quickedit_icon.gif (2.1 KB, 195 views)

Close
(by charlesk)
*Yet another alternate Quickedit icon

Spoiler (click to open)


Hello,
I never add much to the site,but I read from here frequently. I too created a button that matches my site and figured I would add it here for anyone to use. Opposed to adding transparency to the outer edges of the buttons,I just filled the color with the color I am using on my site. It appears as if it came with the program.
To make this appear as mine does in the screen shot, just fill the outside color with the color of your forum,or add transparency.
Ok,I have finally added something. lol




Close
(by iguanairs)
*Give users the option to disable quick edit in the usercp

Spoiler (click to open)


Either radio buttons or a single checkbox in User Options, here's single checkbox:
In admincp make a new user profile field called say "Use Quick Edit" Type "Multiple Selection Checkbox", press continue. Enter description of your choice and in the field Options just add 1 Option called "No" (without the quotes). Edit the other field options as required ie. "field editable by user YES" but "not shown on memberlist" etc. Set the "Display page" to "Options: other", then press save and read what the field number is for this field, ie. field8. Now edit the postbit(_legacy) template(s) and change the line(s) starting with
Code:
<if condition="THIS_SCRIPT=='showthread' and $post['editlink'] and $bbuserinfo[userid]>0">
to this

Code:
<if condition="THIS_SCRIPT=='showthread' and !$post['field8'] and $post['editlink'] and $bbuserinfo[userid]>0">
Additionally put this around your showthread_quickedit template:

Code:
line 1: 
<if condition="!$post['field8']">
last line:
</if>
Don't forget to change the 8 from above to your field number.

The Quick Edit will still be switched on now for everyone in their profiles by default. Those who want to have it off/not loaded anymore have to tick the "No" box in their UserCP Options to get rid of it. If you want to have it the other way round(Quick Edit off for everyone by default) then name the Quick Edit field Option "Yes" and not "No" and remove the exclamation marks:

Code:
!$post['field8']
becomes

Code:
$post['field8']
Good luck

Close
(by pco)

If you find this hack useful please click the install button.

Screenshot attached:

Download

This modification is archived and cannot be downloaded.

Screenshots

 

Similar Mods

Quick Edit! -Edit posts directly from within the thread itself vBulletin 2.x Full Releases

vblts.ru supports vBulletin®, 2022-2024