Recent Topics

1 Feb 18, 2006 03:07    

Function: This Hack provides a checkbox to enable/disable the Modification Date timestamp.

Version: Phoenix Alpha v1.6 2005-11-25

Credit: Special thanks to 'blueyed' for his guidance. Inspired from http://blog.yakaledo.net/b2e/index.php/2005/08/13/test.

Scenario: There are 2 different dates for each post - Creation Date & Modification Date. (By default, Modification Date is automatically updated to its current timestamp during each post update.) I sort my posts by Modification Date. There are posts which I make corrections (not updates) occasionally and wouldn't want to update its Modification Date to its lastest timestamp.

Things to do: Edit 3 files in total. Look for comments // ms6682 mod_date_change in each file and edit acordingly.

Find in /evocore/_dataobject.class.php (2 lines to edit)

	function dbupdate()
	{
		global $DB, $localtimenow, $mod_date_change, $current_User; // ms6682 mod_date_change

		if( $this->ID == 0 ) { debug_die( 'New object cannot be updated!' ); }

		if( count( $this->dbchanges ) == 0 )
			return;	// No changes!

		if( !empty($this->datemodified_field) && $mod_date_change ) // ms6682 mod_date_change
		{	// We want to track modification date:
			$this->set_param( $this->datemodified_field, 'date', date('Y-m-d H:i:s',$localtimenow) );
		}

Find in /admin/_item.form.php (1 paragraph to insert)

	// ############################ ADVANCED #############################

	$Form->begin_fieldset( T_('Advanced properties') );

	if( $current_User->check_perm( 'edit_timestamp' ) )
	{ // ------------------------------------ TIME STAMP -------------------------------------
		$Form->date( 'item_issue_date', $edited_Item->get('issue_date'), T_('Issue date') );
		$Form->time( 'item_issue_time', $edited_Item->get('issue_date'), '' );
		if( $next_action == 'create' )
		{ // If not checked, create time will be used...
			$Form->checkbox( 'edit_date', 0, '', T_('Edit') );
		}
		echo ' '; // allow wrapping!

// ms6682 mod_date_change start
		?>
			<div>
				<span class="line">
				<input type="checkbox" class="checkbox" name="mod_date_change" value="1" id="timestamp"
							tabindex="13" <?php if( $mod_date_change ) echo 'checked="checked"' ?> />
				<label for="timestamp"><strong><?php echo T_('Update modification timestamp to current time') ?></strong></label>
				</span>
			</div>
		<?php
// ms6682 mod_date_change end

Find in /admin/b2edit.php (1 line to insert)

	case 'edit':
		/*
		 * --------------------------------------------------------------------
		 * Display post editing form
		 */
		param( 'post', 'integer', true, true );
		$edited_Item = $ItemCache->get_by_ID( $post );
		$post_locale = $edited_Item->get( 'locale' );
		$cat = $edited_Item->get( 'main_cat_ID' );
		$blog = get_catblog($cat);
		$Blog = Blog_get_by_ID( $blog );

		$AdminUI->title = T_('Editing post').': '.$edited_Item->dget( 'title', 'htmlhead' );
		$AdminUI->title_titlearea = sprintf( T_('Editing post #%d in blog: %s'), $edited_Item->ID, $Blog->get('name') );

		$post_status = $edited_Item->get( 'status' );
		// Check permission:
		$current_User->check_perm( 'blog_post_statuses', $post_status, true, $blog );

		$mod_date_change = 0; // ms6682 mod_date_change

		break;

2 Apr 26, 2006 16:33

After doing the changes in these three files a get this error on the "write" panel from the admin site: "Parse error: syntax error, unexpected $end in http://localhost/admin/_item.form.php on line 514" This is the last line of the file (?>). How can I fix it?

3 Apr 26, 2006 21:02

jolaus wrote:

After doing the changes in these three files a get this error on the "write" panel from the admin site: "Parse error: syntax error, unexpected $end in http://localhost/admin/_item.form.php on line 514" This is the last line of the file (?>). How can I fix it?

You seems to have a missing syntax. Re-check your codes, or paste your changes here.


Form is loading...