• Resolved jasmines

    (@jasmines)


    Hi, I’ve found two bugs.
    1) I want to massively edit expiration dates for selected posts. I change the dates in the mass edit form, but nothing is really changed in the DB.
    2) If I try to sort posts by expiration date, it doesn’t work, and the posts are still in the deafult order, even though the sort arrow indicator appears correctly in the column named “expires”.
    Please solve!

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Steve Burge

    (@stevejburge)

    Hi @jasmines

    Thanks for the bug reports.

    I can confirm the first bug with the Bulk Edit.

    We can’t replicate the ordering issue. Could you share more details, please?

    Thread Starter jasmines

    (@jasmines)

    Regarding the bulk edit bug, can you say when will it be fixed more or less? I can’t believe there aren’t other plugins to achieve the expiration on wordpress… So yours is a must have it!

    Regarding the ordering bug, I’m using Admin Columns Pro by https://www.admincolumns.com/ to add sortable/filterable columns to backend list tables. It works with all kind of fields, from several plugins, except of yours…
    And I can’t find out why…

    Plugin Author Steve Burge

    (@stevejburge)

    Thanks @jasmines

    The Bulk Edit should get fixed in the next release.

    With the columns, please try without that extra Admin Columns plugin.

    Thread Starter jasmines

    (@jasmines)

    I deactivated the Admin Columns plugin, but I’m still having the bug.

    Plugin Author Steve Burge

    (@stevejburge)

    Hi @jasmines. Sorry, we don’t see this in testing.

    Can you see this problem on a second site? If so, please share specific details of the ordering problem.

    Thread Starter jasmines

    (@jasmines)

    I’m using your plugin on a single site.
    Sorting by “expires” column definitely doesn’t work as expected.
    The records are “moving”, when I click on the sorting arrow near “Expires” field, but I can’t understand what logic is used for the obtained sequence.
    So I tried to have a deeper look in the database, where everything seems ok: I found out your plugin is adding a few post_meta to expiring posts, and I saw the meta_value is a timestamp-like value, so sorting is quite obvious.
    I executed the query

    SELECT p.ID, p.post_title, p.post_type, pm.meta_value FROM wp_postmeta as pm inner join wp_posts as p on pm.post_id = p.ID where pm.meta_key like “_expiration-date” order by pm.meta_value

    Mysql is ordering the records as expected.

    Really I don’t understand why the table list is behaving so strangely…
    I really would like to help with further details…

    Thread Starter jasmines

    (@jasmines)

    I fixed it the ordering bug for you!

    In post-expirator.php, find

    function my_expirationdate_orderby( $query ) {
        	if( ! is_admin() )
            	return;
    
    	$orderby = $query->get( 'orderby');
    
    	if( 'expirationdate' == $orderby ) {
    
    		$query->set('meta_query',array(
        			'relation'  => 'OR',
    	    		array(
            			'key'       => '_expiration-date',
            			'compare'   => 'EXISTS'
    	    		),
        			array(
            			'key'       => '_expiration-date',
            			'compare'   => 'NOT EXISTS',
    	        		'value'     => ''
        			)
    		));
            	$query->set('orderby','meta_value_num');
    
       	}
    }

    and replace with:

    function my_expirationdate_orderby( $query ) {
        	if( ! is_admin() )
            	return;
    
    	$orderby = $query->get( 'orderby');
    
    	if( 'expirationdate' == $orderby ) {
    		$query->set( 'meta_key', '_expiration-date' );
    
    		$query->set('meta_query',array(
        			'relation'  => 'OR',
    	    		array(
            			'key'       => '_expiration-date',
            			'compare'   => 'EXISTS'
    	    		),
        			array(
            			'key'       => '_expiration-date',
            			'compare'   => 'NOT EXISTS',
    	        		'value'     => ''
        			)
    		));
            	$query->set('orderby','meta_value_num');
    
       	}
    }

    Note the addition:

    $query->set( 'meta_key', '_expiration-date' );

    Thread Starter jasmines

    (@jasmines)

    You’re welcome, however:)

    Plugin Author Steve Burge

    (@stevejburge)

    Thanks for reporting this @jasmines. We’ll get it fixed in the next release.

    Thread Starter jasmines

    (@jasmines)

    How much longer do we have to wait for the next release???
    Please provide estimation time!

    Plugin Author Steve Burge

    (@stevejburge)

    Hi @jasmines

    You reported the possible fix 6 days ago.

    We are working to validate and release it quickly. Sorry, no ETA yet.

    We have just taken over managing this plugin and still have a little setup work to do.

    Plugin Author Steve Burge

    (@stevejburge)

    Hi @jasmines

    We’re looking into this. Please can you follow up here?
    https://github.com/publishpress/PublishPress-Future/issues/13#issuecomment-846422756

    Thread Starter jasmines

    (@jasmines)

    Ehy, you are the developer… Aren’t you?
    That bug is 8 years old and it was FIXED.
    You should think about this little particular: your plugin is not the first handling date formatted postmeta.

    Plugin Author Steve Burge

    (@stevejburge)

    Hi @jasmines

    Please follow up on that Github issue. It is the best place to discuss code issues like this.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘BUG: mass edit and sorting’ is closed to new replies.