Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Beta Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
View Post Edits v0.01 BETA Details »»
View Post Edits v0.01 BETA
Version: 0.01 BETA, by rjordan rjordan is offline
Developer Last Online: Dec 2012 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 02-14-2005 Last Update: 02-14-2005 Installs: 5
DB Changes
Is in Beta Stage  
No support by the author.

This will be updated. Until then, no further support for this version will be given.

Well, folks, here it is. Your input is appreciated. As this is my first real modification for vB and in PHP, please keep flames to a minimum! :laugh: If any issues are found, please post them here. The final release will be posted after a few weeks of discussion here and any tweaks need to be made.

Screenshots are attached.

--------------
Version History:

v0.01 BETA - 02-15-05 (NO LONGER SUPPORTED)
- This release.
- Renamed from v0.99 BETA. (02-24-05)
- Added version history. (02-24-05)
- Added future release details. (02-24-05)

--------------
Future release: (IN PROGRESS)

- Seperate edits into their own database field.
- Pop-up edits in another window.
- Admin selectable limit of edits displayed.
- Admin selectable forums to track edits rather than global.

--------------

// ************************************************** ********************
// *
// * View Post Edits modification v0.99 BETA
// * Coded by Richard Jordan for vBulletin v3.0.x
// *
// * This a BETA release. As with all releases, make a backup of
// * your forums and database to ensure data integrity in the event there
// * is an unforeseen problem. Testing has been performed to the extent
// * that all possible issues have been addressed, however without proper
// * field testing, this modification CANNOT be certified as complete.
// *
// * This modification may be installed on any site with a legitimate
// * vBulletin license. It may be reposted on other sites freely as
// * long as it is done in its entirety, credit is given to the author,
// * and it is not reposted at any location where anyone must pay in any
// * way for any reason to fully obtain this modification.
// *
// ************************************************** ********************

Overview:
---------
Quote:
This modification will allow viewing of all post edits. It does this
by taking the posts that are edited and appending the original to the
end of the post. This original post is enclosed in new BBCode [EDIT]
and [/EDIT] tags. When this tag is found, the contents are displayed
as a previous edit and is marked as such. This is controlled by user
group. If you would like certain members or groups to have access to
view these edits, simply add this user permission. If a user enters
the new BBCode in any message, the brackets are converted to their
numerical code value thus preventing them from interfering with the
modification.
// ************************************************** ********************
// ************************************************** ********************

Notes:
------
Quote:
- Previous edits are stamped with the time and date as well as who
made the post edit.
- When no reason is given for a post edit, it is automatically set
to "No reason given."
- Usergroup based permissions.
- One added query each time a post edit is submitted or previewed.
- Includes instructions for vBAdvanced CPMS news, however if other
modules/portals/hacks are used to read post data, they will need
to be modified to prevent the displaying of post edits.
- Collapsable tables conserve screen real-estate so only the post
edits you wish to see can be displayed. Scrolling is implemented
to conserve even more space.
- Uses phrases for easy language conversion.
- Uses templates for easy customization.
- Images included in the previous edits will not count toward the
total image count for the post. This should be remembered for
those with users that like to post a lot of images and they edit
those messages with any kind of frequency.
// ************************************************** ********************
// ************************************************** ********************

Modification Summary:
---------------------
Quote:
SQL Queries: 1
New Templates: 2
Modified Templates: -
New Phrases: 5
Modified Phrases: -
New Files: 2
Modified Files: 9 (10 with vBAdvanced CPMS)
// ************************************************** ********************


New Files:
----------
Quote:
./images/buttons/collapse_viewedits.gif
./images/buttons/collapse_viewedits_collapsed.gif
// ************************************************** ********************


Files that will be required for this modification:
--------------------------------------------------
Quote:
./editpost.php
./newreply.php
./newthread.php
./printthread.php
./admincp/usergroup.php
./includes/functions_bbcodeparse.php
./includes/functions_newpost.php
./includes/functions_showthread.php
./includes/init.php

./modules/news.php (Only if vBAdvanced CMPS is installed)
==========================
PLEASE BACK UP THESE FILES
==========================


// ************************************************** ********************
// ************************************************** ********************


Upload new files:
-----------------
Quote:
./images/buttons/collapse_viewedits.gif
./images/buttons/collapse_viewedits_collapsed.gif
// ************************************************** ********************
// ************************************************** ********************


Execute SQL query:
------------------
Code:
	ALTER TABLE `usergroup` ADD `canviewpostedits` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL ;
// ************************************************** ********************
// ************************************************** ********************


Add new phrases:
----------------
Quote:
- Type: permissions
Phrase: can_view_post_edits
Text: Can View Post Edits
- Type: postbit
Phrase: view_edits_after_edit_by_x_on_y_z
Text: After edit by {1} on {2} at {3}:

- Type: postbit
Phrase: view_edits_before_any_edits
Text: Before any edits, post was:

- Type: postbit
Phrase: view_edits_previous_edits
Text: Previous Edits:

- Type: postbit
Phrase: view_edits_no_reason
Text: No reason given.

- Type: postbit
Phrase: view_edits_show_or_hide_edits
Text: SHOW/HIDE POST EDITS
// ************************************************** ********************
// ************************************************** ********************


Create a new template: view_edits
---------------------------------
PHP Code:
 
<if condition="isset($viewedits)">
<!-- 
edits -->
<
br /><br />
<
table width="100%" border="0" cellspacing="0" cellpadding="0">
     <
tr>
         <
td valign="top">
            <
table width="100%" border="0" cellspacing="2" cellpadding="3">
             <
tr>
                 <
td valign="top">
                     <
a style="float:$stylevar[right]href="#top" onclick="return toggle_collapse('view_edit_bit_$post[postcount]')">$vbphrase[view_edits_show_or_hide_edits] <img id="collapseimg_view_edit_bit_$post[postcount]src="$stylevar[imgdir_button]/collapse_tcat_collapsed{$forumid}.gif" alt="" border="0" /></a>
                 </
td>
             </
tr>
            </
table>
         </
td>
     </
tr>
</
table>
 
<
table class="tborder" cellpadding="$stylevar[cellpadding]cellspacing="$stylevar[cellspacing]border="0" width="$stylevar[outertablewidth]align="center" id="collapseobj_view_edit_bit_$post[postcount]style="display:none;">
     <
tbody>
         <
tr>
            <
td>
             <
fieldset class="fieldset" style="height:300px; overflow:auto; margin:0px 0px 0px 0px;">
             <
legend>$vbphrase[view_edits_previous_edits] </legend>
             <
div style="margin:10px; margin-top:5px; <if condition="$show['iewidthfix']">width: 100%;</if>">
                 <
table cellpadding="$stylevar[cellpadding]cellspacing="0" border="0" width="100%">
                     <
tr>
                        <
td class="alt2" style="border:1px inset">
                         
$viewedits
                        
</td>
                     </
tr>
                 </
table>
             </
div>
             </
fieldset>
            </
td>
         </
tr>
     </
tbody>
</
table>
<!-- /
edits -->
</if> 
// ************************************************** ********************
// ************************************************** ********************


Create a new template: view_edits_bit
-------------------------------------
PHP Code:
 
[edit]<div class="smallfont"><em><b>Edit:</b><br /><table cellpadding="$stylevar[cellpadding]cellspacing="0" border="0" width="100%"><tr><td class="alt2" style="border:1px inset"><phrase 1="$bbuserinfo[username]2="$date3="$time">$vbphrase[view_edits_after_edit_by_x_on_y_z]</phrase>
$vbphrase[reason]: $edit[reason]</em></div><hr size="1">$newEdit</td></tr></table><br /><br /><if condition="isset($prevEdits)">$prevEdits</if><if condition="isset($firstEdit)"><table cellpadding="$stylevar[cellpadding]cellspacing="0" border="0" width="100%"><tr><td class="alt2" style="border:1px inset"><div class="smallfont"><em>$vbphrase[view_edits_before_any_edits]</em></div><hr size="1">$firstEdit</td></tr></table></if>[/edit
// ************************************************** ********************
// ************************************************** ********************


FILE: ./editpost.php (4 changes)
--------------------------------

FIND:
-----
PHP Code:
$phrasegroups = array('threadmanage''posting'); 
REPLACE WITH:
-------------
PHP Code:
$phrasegroups = array('threadmanage''posting''Postbit'); 
FIND:
-----
PHP Code:
require_once('./includes/functions_editor.php'); 
BELOW THAT ADD:
---------------
PHP Code:
require_once('./includes/functions_bbcodeparse.php'); 
FIND:
-----
PHP Code:
 verify_post_errors('editpost'$edit$errors); 
ABOVE THAT ADD:
---------------
PHP Code:
    $oldPost fetch_postinfo($postid);
    
$edit['message'] = handle_bbcode_bad_edit_tags($edit['message']);
    
$newEdit $edit['message'];
    
$prevEdits preg_replace('!(.*)\[edit\](.*)\[\/edit\](.*)!is''\\2'$oldPost['pagetext']);
    if (
$oldPost['pagetext'] == $prevEdits) {
        
$firstEdit $oldPost['pagetext'];
        
$prevEdits "";
    }
    
$date vbdate($vboptions['dateformat'], TIMENOW0100);
    
$time vbdate($vboptions['timeformat'], TIMENOW0100);
    if (!
$edit['reason']) {
        
$edit['reason'] = $vbphrase['view_edits_no_reason'];
    }
    eval(
'$edit[\'message\'] .= "' fetch_template('view_edits_bit') . '";'); 
FIND:
-----
PHP Code:
 construct_edit_toolbar($newpost['message'], 0$foruminfo['forumid'], iif($foruminfo['allowsmilies'], 10), iif($postinfo['allowsmilie'] AND $_REQUEST['disablesmilies'] != 110)); 
ABOVE THAT ADD:
---------------
PHP Code:
    $newpost['message'] = handle_bbcode_strip_edit_data($newpost['message']); 
SAVE AND UPLOAD.
----------------


// ************************************************** ********************
// ************************************************** ********************


FILE: ./newreply.php (2 changes)
--------------------------------

FIND:
-----
PHP Code:
require_once('./includes/functions_bigthree.php'); 
BELOW THAT ADD:
---------------
PHP Code:
require_once('./includes/functions_bbcodeparse.php'); 
FIND:
-----
PHP Code:
 eval('$threadreviewbits .= "' fetch_template('newreply_reviewbit') . '";'); 
ABOVE THAT ADD:
---------------
PHP Code:
        $pagetext handle_bbcode_strip_edit_data($pagetext); 
SAVE AND UPLOAD.
----------------


// ************************************************** ********************
// ************************************************** ********************


FILE: ./newthread.php (2 changes)
--------------------------------

FIND:
-----
PHP Code:
require_once('./includes/functions_bigthree.php'); 
BELOW THAT ADD:
---------------
PHP Code:
require_once('./includes/functions_bbcodeparse.php'); 
FIND:
-----
PHP Code:
 if (!($forumperms CANPOSTPOLL)) 
ABOVE THAT ADD:
---------------
PHP Code:
    $newpost['message'] = handle_bbcode_bad_edit_tags($newpost['message']); 
SAVE AND UPLOAD.
----------------


// ************************************************** ********************
// ************************************************** ********************


FILE: ./printthread.php (1 change)
----------------------------------

FIND:
-----
PHP Code:
eval('$postbits .= "' fetch_template('printthreadbit') . '";'); 
ABOVE THAT ADD:
---------------
PHP Code:
    $post['message'] = handle_bbcode_strip_edit_data($post['message']); 
SAVE AND UPLOAD.
----------------


// ************************************************** ********************
// ************************************************** ********************


FILE: ./admincp/usergroup.php (1 change)
----------------------------------------

FIND:
-----
PHP Code:
 print_yes_no_row($vbphrase['can_delete_own_posts'], 'usergroup[candeletepost]'$ug_bitfield['candeletepost']); 
ABOVE THAT ADD:
---------------
PHP Code:
 print_yes_no_row($vbphrase['can_view_post_edits'], 'usergroup[canviewpostedits]'$ug_bitfield['canviewpostedits']); 
SAVE AND UPLOAD.
----------------


// ************************************************** ********************
// ************************************************** ********************


FILE: ./includes/functions_bbcodeparse.php (1 change)
-----------------------------------------------------

FIND:
-----
PHP Code:
// ###################### Start strip_smilies ####################### 
ABOVE THAT ADD:
---------------
PHP Code:
 
// ###################### Start bbcodehandler_viewpostedits #######################
function handle_bbcode_view_post_edits($code,$canviewedits)
{
    
$oldPost $code;
if (
$canviewedits)
{
        
$code preg_replace('!(.*)\[edit\](.*)\[\/edit\](.*)!is''\\2'$code);
        if (
$oldPost == $code) {
            unset(
$code);
        }
    }
    else {
        unset(
$code);
    }
    return 
$code;
}
 
// ###################### Start bbcodehandler_strippostedits #######################
function handle_bbcode_strip_edit_data($code)
{
    
$code preg_replace('!(.*)\[edit\](.*)\[\/edit\](.*)!is''\\1\\3'$code);
    return 
$code;
}
 
// ###################### Start bbcodehandler_invalidviewpostedits #######################
function handle_bbcode_bad_edit_tags($code)
{
    
$editTagFind = array("'\[edit\]'si""'\[\/edit\]'si");
    
$editTagReplace = array("[edit]""[/edit]");
    
$code preg_replace($editTagFind$editTagReplace$code);
    return 
$code;

SAVE AND UPLOAD.
----------------

// ************************************************** ********************
// ************************************************** ********************


FILE: ./includes/functions_newpost.php (2 changes)
--------------------------------------------------

FIND:
-----
PHP Code:
 if ($vboptions['maximages'] != AND fetch_character_count(parse_bbcode($post['message'], $foruminfo['forumid'], $post['enablesmilies'], 1), '<img') > $vboptions['maximages']) 
REPLACE WITH:
-------------
PHP Code:
    $imgCheck handle_bbcode_strip_edit_data($post['message']);
if (
$vboptions['maximages'] != AND fetch_character_count(parse_bbcode($imgCheck$foruminfo['forumid'], $post['enablesmilies'], 1), '<img') > $vboptions['maximages']) 
FIND:
-----
PHP Code:
 $previewmessage parse_bbcode($newpost['message'], $foruminfo['forumid'], iif($newpost['disablesmilies'], 01)); 
ABOVE THAT ADD:
---------------
PHP Code:
    $newpost['message'] = handle_bbcode_strip_edit_data($newpost['message']); 
SAVE AND UPLOAD.
----------------


// ************************************************** ********************
// ************************************************** ********************


FILE: ./includes/functions_showthread.php (1 change)
----------------------------------------------------

FIND:
-----
PHP Code:
 // highlight words from search engine ($_REQUEST[highlight]) 
ABOVE THAT ADD:
---------------
PHP Code:
            $canviewedits $permissions[canviewpostedits];
            if (
$canviewedits)
            {
                
$viewedits handle_bbcode_view_post_edits($post['message'], $canviewedits);
                if (!empty(
$viewedits))
                {
                    eval(
'$viewedits = "' fetch_template('view_edits') . '";');
                }
            }
            
$post['message'] = handle_bbcode_strip_edit_data($post['message']).$viewedits
SAVE AND UPLOAD.
----------------


// ************************************************** ********************
// ************************************************** ********************


FILE: ./includes/init.php (1 change)
------------------------------------

FIND:
-----
PHP Code:
// ### INSERT PLUGIN USERGROUP PERMISSIONS BITFIELDS HERE ###
// ---------------------------------------------------------- 
BELOW THAT ADD:
---------------
PHP Code:
 $_BITFIELD['usergroup']['canviewpostedits'] = array(
'canviewpostedits' => 1,
); 
SAVE AND UPLOAD.
----------------

// ************************************************** ********************
// ************************************************** ********************


FILE: ./modules/news.php (1 change) (Only if vBAdvanced CMPS is installed)
-----------------------------------

FIND:
-----
PHP Code:
 $news['message'] = parse_bbcode2($news['pagetext'], $vba_options['portal_news_enablehtml'], $vba_options['portal_news_enablevbimage'], $allowsmilie$vba_options['portal_news_enablevbcode']); 
BELOW THAT ADD:
---------------
PHP Code:
    $news['message'] = handle_bbcode_strip_edit_data($news['message']); 
SAVE AND UPLOAD.
----------------


// ************************************************** ********************

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 02-15-2005, 02:05 PM
-=Sniper=- -=Sniper=- is offline
 
Join Date: May 2002
Posts: 605
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

excellent hack dude! I think maybe a forum based options is needed?

you'd want to keep a track of all edits in the buy/sell/trade forums? and not test forums etc

also maybe the option to delete entries from the postbit?
Reply With Quote
  #13  
Old 02-15-2005, 02:23 PM
rjordan's Avatar
rjordan rjordan is offline
 
Join Date: Sep 2004
Posts: 326
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm... forum based options... that is not a bad idea. I will have to look at that after this goes through some more trials.

Freeze, check your PM.
Reply With Quote
  #14  
Old 02-16-2005, 09:02 AM
Freezerator Freezerator is offline
 
Join Date: Nov 2001
Location: Den Haag
Posts: 197
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't think my error lies in editpost.php but in the parsing of bbcode?
Reply With Quote
  #15  
Old 02-16-2005, 09:30 AM
rjordan's Avatar
rjordan rjordan is offline
 
Join Date: Sep 2004
Posts: 326
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Still looking into it. Check your e-mail again. The issue seems to lie where in editpost.php calls the view_edits_bit template. When it calls the template, it is adding the HTML comment to the text field. For those who have already installed this, have you seen this issue?
Reply With Quote
  #16  
Old 02-16-2005, 12:52 PM
Freezerator Freezerator is offline
 
Join Date: Nov 2001
Location: Den Haag
Posts: 197
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rjordan
Hmm... sounds like you have
Add Template Name in HTML Comments enabled... but that should not cause what you are seeing. I just turned mine on and could not replicate it here. You are seeing this when exactly? Is it when you click on Edit and it displays the post in the text field?
Well, i have turned HTML Comments off and now there gone. It seems to work just like it should now. Thanks for the support!
Reply With Quote
  #17  
Old 02-16-2005, 03:39 PM
rjordan's Avatar
rjordan rjordan is offline
 
Join Date: Sep 2004
Posts: 326
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now I question why I do not see that when I turn my Add Template Name in HTML Comments on, though.
Reply With Quote
  #18  
Old 02-16-2005, 04:20 PM
Freezerator Freezerator is offline
 
Join Date: Nov 2001
Location: Den Haag
Posts: 197
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you use the WYSIWYG editor?
Reply With Quote
  #19  
Old 02-16-2005, 09:08 PM
rjordan's Avatar
rjordan rjordan is offline
 
Join Date: Sep 2004
Posts: 326
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tested it all ways I could find with all interfaces. That is why I am (no offense) hoping it is just you.
Reply With Quote
  #20  
Old 02-17-2005, 05:58 AM
Freezerator Freezerator is offline
 
Join Date: Nov 2001
Location: Den Haag
Posts: 197
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, lets hope it's just me then. I will install this maybe this week on my other board.
So far it's is doing what it should do, and this is a very handy hack.
Reply With Quote
  #21  
Old 02-17-2005, 08:06 AM
Freezerator Freezerator is offline
 
Join Date: Nov 2001
Location: Den Haag
Posts: 197
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For your information, i am running 3.0.6
My other admins are really happy with this hack.

Also when you like to implement forum based options i will be the first to test it
Maybe a suggestion for the Show/Hide posts edits, this can be also done in the postbit template? I was wondering if it could be done so i can customise it into my different styles

Keep up the great work!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:33 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05454 seconds
  • Memory Usage 2,460KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (34)bbcode_php
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete