The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Quick Edit! -Edit posts directly from within the thread itself Details »» | |||||||||||||||||||||||||||
Quick Edit! -Edit posts directly from within the thread itself
Developer Last Online: May 2021
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). (by sv1cec) *Show the "edit reason" field in the Quick Edit form. (Requested by Convergys) *Alternate Quickedit icon image (by ryancooper) *Another alternate Quickedit icon (by sv1cec) *Another alternate Quickedit icon (by charlesk) *Yet another alternate Quickedit icon (by iguanairs) *Give users the option to disable quick edit in the usercp (by pco) If you find this hack useful please click the install button. Screenshot attached: Show Your Support
|
Comments |
#192
|
||||
|
||||
John,
To make it function exactly as it does in editpost.php you'd need to add this bit of code to functions_showthread.php: Code:
// find out if first post $getpost = $DB_site->query_first(" SELECT postid FROM " . TABLE_PREFIX . "post WHERE threadid=$threadinfo[threadid] ORDER BY dateline LIMIT 1 "); if ($getpost['postid'] == $postid) { $isfirstpost = true; } else { $isfirstpost = false; } Dewayne |
#193
|
|||
|
|||
Quote:
Let me understand that. You mean that the existing conditionals cannot function, until the $isfirstpost is set by the code you gave me? Well, the code does not work as it is, it produces 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 I also tried to fool the hack, by inserting a $isfirstpost = true statement, just above the conditionals. The behaviour is still the same. For some reason, it never sets the $show['deletepostoption'] to true, even though the $isfirstpost is always true. I am not sure what the problem is, but $isfirstpost doesn't seem to be the solution. Rgds |
#194
|
||||
|
||||
Change $threadinfo[threadid] to $thread[threadid] in the query and it should work.
|
#195
|
|||
|
|||
Quote:
I even added another IF, to check if the user ID is 1, if the user ID and the poster are the same and if the post is the first one. It still does not work. I am doomed! Here is the code from functions_showthread HTML Code:
// Quick Edit hack if ($post['userid'] == $bbuserinfo['userid']) { $edittext = htmlspecialchars_uni($post['pagetext']); eval('$quickedit = "' . fetch_template('showthread_quickedit') . '";'); } else { $edittext=""; $quickedit=""; } // 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'] == $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; } // I ADDED THIS IF BELOW, IT STILL DOES NOT SHOW THE DELETE PART OF MY QE. else if ($bbuserinfo['userid'] == 1 AND $bbuserinfo['userid'] == $post['userid'] AND $isfirstpost) { $show['deletepostoption'] = true; } else { $show['deletepostoption'] = false; } // End Quick Edit hack HTML Code:
$forumperms = fetch_permissions($thread['forumid']); if ( !$thread['isdeleted'] AND ( can_moderate($thread['forumid'], 'caneditposts') OR can_moderate($thread['forumid'], 'candeleteposts') OR ( $thread['open'] AND $post['userid'] == $bbuserinfo['userid'] AND ($forumperms & CANEDITPOST) AND ( $post['dateline'] >= (TIMENOW - ($vboptions['edittimelimit'] * 60)) OR $vboptions['edittimelimit'] == 0 ) )) I am not trying to be a smart-a**, just trying to help here, with my limited knowledge. Again, I have to thank you for paying attention to my requests. Rgds P.S. (later this evening): No matter what I tried, I cannot make the QE show me the Delete post part, if the post is the first post in the thread. I guess this is beyong my abilities. You are my only solution. Rgds |
#196
|
||||
|
||||
John,
I have it working on my forum (even in the first post) using this code: In functions_showthread.php find and delete the old code you added. Now find this: Code:
// Quick Edit hack Code:
$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; } 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"> <table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" align="left"> <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]" /> <tr> <td class="tcat" align="left"> <strong>$vbphrase[edit_post]</strong> </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[title]:</div> <div><input type="text" class="bginput" name="title" value="$post[title]" size="60" 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:433px; height:125px;" wrap="virtual" tabindex="1">$edittext</textarea></div> </div> </div> </div> <div style="margin-top:6px"> <input type="submit" class="button" name="sbutton" value="Save Changes" accesskey="s" tabindex="1" /> <input type="submit" class="button" name="preview" value="Preview Changes" accesskey="p" tabindex="1" /> <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> </div> </td> </tr> </tbody> </form> <if condition="$show['deletepostoption']"> <br /> <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 class="tcat" align="left"> $vbphrase[delete_this_message] </td> </tr> <tbody id="collapseobj_editpost_delete" style="$vbcollapse[collapseobj_editpost_delete]"> <tr> <td class="panelsurround" align="center"> <div class="panel"> <div style="width:65" align="$stylevar[left]"> <div class="fieldset"> <div>$vbphrase[delete_message_check_appropriate_option]</div> <if condition="$show['firstpostnote']"> <div>$vbphrase[deleting_message_deletion_of_thread]</div> </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> <div style="margin-top:$stylevar[cellpadding]px"> <input type="submit" class="button" value="$vbphrase[delete_this_message]" tabindex="1" accesskey="s" /> </div> </td> </tr> </tbody> </form> </if> </table> </div> Quote:
|
#197
|
|||
|
|||
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:
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] <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> Rgds |
#198
|
||||
|
||||
Nice job sv1cec ! I added a link to your post so that others can add your mod.
|
#199
|
|||
|
|||
not sure if this has been asked, but can u make it where it shows on everypost for Moderators and Admins? so we can edit someones post quickly?
|
#200
|
|||
|
|||
Quote:
Rgds |
#201
|
||||
|
||||
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 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|