Skip to content

Commit

Permalink
Merge pull request #23 from iamsayan/develop
Browse files Browse the repository at this point in the history
Release v1.8.3
  • Loading branch information
iamsayan authored May 30, 2022
2 parents 572124e + 265c184 commit 6b500b0
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 54 deletions.
65 changes: 36 additions & 29 deletions assets/js/edit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function($) {
( function( $ ) {

// Copy of the WP inline edit post function.
var $wp_inline_edit = inlineEditPost.edit;
Expand Down Expand Up @@ -49,7 +49,7 @@
$( '#inline-edit-col-modified-date', $edit_row ).remove();
}

$( '.time-modified', $edit_row ).change( function() {
$( '.time-modified', $edit_row ).on( 'change', function() {
/*if ( ! $( '#wplmi_disable', $edit_row ).is( ':checked' ) ) {
$( '#wplmi-change-modified', $edit_row ).val( 'yes' );
}*/
Expand All @@ -59,21 +59,31 @@
$( '#wplmi_disable', $edit_row ).prop( 'checked', false );
});

$( '#wplmi_disable', $edit_row ).change( function() {
if ( $(this).is( ':checked' ) ) {
$( '#wplmi_disable', $edit_row ).on( 'change', function() {
if ( $( this ).is( ':checked' ) ) {
$( '#wplmi-disable-hidden', $edit_row ).val( 'yes' );
}
if ( ! $(this).is( ':checked' ) ) {
if ( ! $( this ).is( ':checked' ) ) {
$( '#wplmi-disable-hidden', $edit_row ).val( 'no' );
}
}).change();
} ).trigger( 'change' );
}

};

$( '#inline-edit-col-modified-date' ).appendTo( '.inline-edit-col-left:first-child .inline-edit-col .inline-edit-date' );

$( '#bulk_edit' ).on( 'click', function() {
$( 'body' ).on( 'click', '#bulk_edit', function( e ) {
var el = $( this );
if ( el.hasClass( 'prevented' ) ) {
return;
}

e.preventDefault();
el.addClass( 'prevented' );

// let's add the WordPress default spinner just before the button
el.after( '<span class="spinner is-active"></span>' );

// define the bulk edit row
var $bulk_row = $( '#bulk-edit' );
Expand All @@ -82,7 +92,7 @@
var $post_ids = new Array();
$bulk_row.find( '#bulk-titles' ).children().each( function() {
$post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) );
});
} );

// get the custom fields
var $modified_month = $bulk_row.find( 'select[name="mmm"]' ).val();
Expand All @@ -91,25 +101,22 @@
var $modified_hour = $bulk_row.find( 'input[name="hhm"]' ).val();
var $modified_minute = $bulk_row.find( 'input[name="mnm"]' ).val();
var $modified_disable = $bulk_row.find( 'select[name="disable_update"]' ).val();

// save the data
$.ajax({
url: wplmi_edit_L10n.ajaxurl,
type: 'POST',
async: false,
cache: false,
data: {
action: 'wplmi_process_bulk_edit',
post_ids: $post_ids,
modified_month: $modified_month,
modified_day: $modified_day,
modified_year: $modified_year,
modified_hour: $modified_hour,
modified_minute: $modified_minute,
modified_disable: $modified_disable,
security: wplmi_edit_L10n.security
}
});
});

})(jQuery);
var wplmiBulkData = {
action: 'wplmi_process_bulk_edit',
post_ids: $post_ids,
modified_month: $modified_month,
modified_day: $modified_day,
modified_year: $modified_year,
modified_hour: $modified_hour,
modified_minute: $modified_minute,
modified_disable: $modified_disable,
security: wplmi_edit_L10n.security
};

$.post( wplmi_edit_L10n.ajaxurl, wplmiBulkData, function( response ) {
$( 'body' ).find( '#bulk_edit' ).trigger( 'click' );
} );
} );

} )( jQuery );
2 changes: 1 addition & 1 deletion assets/js/edit.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* Call the republish function directly
*
* @since 1.8.0
* @param int $post_id Post ID
* @param array $args Republish args
* @param bool $escape Escape true|false
* @param bool $only_date Return only date true|false
*/
function get_the_last_modified_info( $escape = false, $only_date = false ) {
$template = new \Wplmi\Core\Frontend\TemplateTags( compact( 'escape', 'only_date' ) );
Expand All @@ -32,8 +32,8 @@ function get_the_last_modified_info( $escape = false, $only_date = false ) {
* Call the republish function directly
*
* @since 1.8.0
* @param int $post_id Post ID
* @param array $args Republish args
* @param bool $escape Escape true|false
* @param bool $date Return only date true|false
*/
function the_last_modified_info( $escape = false, $date = false ) {
// displays/echos the last modified info.
Expand Down
14 changes: 8 additions & 6 deletions inc/Core/Backend/DashboardWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ public function widget_callback() {
$num = ! empty( $widget_options['number'] ) ? intval( $widget_options['number'] ) : 5;

$args = $this->do_filter( 'dashboard_widget_args', [
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => $num,
'orderby' => 'modified',
'no_found_rows' => true,
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => $num,
'orderby' => 'modified',
'order' => 'DESC',
'no_found_rows' => true,
'suppress_filters' => true,
] );
$posts = new WP_Query( $args );

Expand Down Expand Up @@ -139,7 +141,7 @@ public function widget_control_callback() {
<table>
<tr>
<td><label for="post-count"><strong><?php esc_html_e( 'Number of Posts to Display', 'wp-last-modified-info' ); ?>:</strong></label></td>
<td><input class="widefat" id="post-count" name="wplmi_widget_options[number]" type="number" placeholder="5" min="3" value="<?php echo esc_attr( $value ); ?>" /></td>
<td><input class="widefat" id="post-count" name="wplmi_widget_options[number]" type="number" placeholder="5" min="3" max="100" value="<?php echo esc_attr( $value ); ?>" /></td>
</tr>
</table>
<?php
Expand Down
22 changes: 16 additions & 6 deletions inc/Core/Backend/EditScreen.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,13 @@ public function bulk_save() {

$newdate = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );

set_transient( 'wplmi_temp_modified_date', $newdate, 30 );

foreach ( $post_ids as $post_id ) {
if ( ! in_array( get_post_status( $post_id ), [ 'auto-draft', 'future' ] ) ) {
if ( $mmm != 'none' ) {
$wpdb->update( $wpdb->posts, [
'post_modified' => $newdate,
'post_modified_gmt' => get_gmt_from_date( $newdate ),
], [ 'ID' => $post_id ] );

clean_post_cache( $post_id );
$this->update_meta( $post_id, '_wplmi_last_modified', $newdate );
$this->update_meta( $post_id, '_wplmi_bulk_update', 'yes' );
}

if ( $disable != 'none' ) {
Expand Down Expand Up @@ -310,6 +308,18 @@ public function update_data( $data, $postarr ) {
$this->update_meta( $postarr['ID'], '_edit_last', get_current_user_id() );
}

$modified_temp = get_transient( 'wplmi_temp_modified_date' );
$proceed = $this->get_meta( $postarr['ID'], '_wplmi_bulk_update' );

if ( $modified_temp && $proceed == 'yes' ) {
$data['post_modified'] = $modified_temp;
$data['post_modified_gmt'] = get_gmt_from_date( $modified_temp );

$this->delete_meta( $postarr['ID'], '_wplmi_bulk_update' );

return $data;
}

if ( ! isset( $postarr['wplmi_modified'], $postarr['wplmi_change'], $postarr['wplmi_disable'] ) ) {
$temp_date = $this->get_meta( $postarr['ID'], 'wplmi_temp_date' );
if ( ! empty( $postarr['wplmi_modified_rest'] ) ) {
Expand Down
2 changes: 1 addition & 1 deletion inc/Core/Backend/MiscActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function sorting_order( $query ) {
$order = $this->is_equal( 'admin_default_sort_order', 'published' ) ? 'asc' : 'desc';

if ( ! $this->is_equal( 'admin_default_sort_order', 'default' ) ) {
if ( is_admin() && 'edit.php' === $pagenow && ! isset( $_REQUEST['orderby'] ) ) {
if ( is_admin() && 'edit.php' === $pagenow && ! ( $query->get( 'orderby' ) || $query->get( 'order' ) ) ) {
$query->set( 'orderby', 'modified' );
$query->set( 'order', $order );
}
Expand Down
8 changes: 4 additions & 4 deletions languages/wp-last-modified-info.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the GPLv3.
msgid ""
msgstr ""
"Project-Id-Version: WP Last Modified Info 1.8.2\n"
"Project-Id-Version: WP Last Modified Info 1.8.3\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-last-modified-info\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2022-05-24T12:50:13+00:00\n"
"POT-Creation-Date: 2022-05-30T13:57:38+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.5.0\n"
"X-Domain: wp-last-modified-info\n"
Expand Down Expand Up @@ -466,11 +466,11 @@ msgstr ""
msgid "Last Updated"
msgstr ""

#: inc/Core/Backend/DashboardWidget.php:71
#: inc/Core/Backend/DashboardWidget.php:73
msgid "Recently Updated"
msgstr ""

#: inc/Core/Backend/DashboardWidget.php:141
#: inc/Core/Backend/DashboardWidget.php:143
msgid "Number of Posts to Display"
msgstr ""

Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: infosatech
Tags: last modified, timestamp, modified time, post modified, sort by modified, time, date
Requires at least: 4.7
Tested up to: 6.0
Stable tag: 1.8.2
Stable tag: 1.8.3
Requires PHP: 5.6
Donate link: https://www.paypal.me/iamsayan/
License: GPLv3
Expand Down Expand Up @@ -164,6 +164,12 @@ Post detailed information about the issue in the [support forum](https://wordpre

If you like WP Last Modified Info, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/wp-last-modified-info/reviews/?rate=5#new-post). It helps to keep development and support going strong. Thank you!

= 1.8.3 =
Release Date: May 30, 2022

* Fixed: Bulk Editing is not working.
* Fixed: Dashbaord Widget Posts List Order was wrong on some cases.

= 1.8.2 =
Release Date: May 24, 2022

Expand Down
4 changes: 2 additions & 2 deletions wp-last-modified-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WP Last Modified Info
* Plugin URI: https://wordpress.org/plugins/wp-last-modified-info/
* Description: Ultimate Last Modified Plugin for WordPress with Gutenberg Block Integration. It is possible to use shortcodes to display last modified info anywhere on a WordPress site running 4.7 and beyond.
* Version: 1.8.2
* Version: 1.8.3
* Author: Sayan Datta
* Author URI: https://sayandatta.in
* License: GPLv3
Expand Down Expand Up @@ -37,7 +37,7 @@
}

// Define constants
define( 'WPLMI_VERSION', '1.8.2' );
define( 'WPLMI_VERSION', '1.8.3' );

// Require once the Composer Autoload
if ( file_exists( dirname( __FILE__ ) . '/vendor/autoload.php' ) ) {
Expand Down

0 comments on commit 6b500b0

Please sign in to comment.