Topic Closed
franck
14 Posts

Hi,

When you save your articles as drafts, they aren't hidden in the Archive gadget.

Even when you set a publish date in the future.

I had a look inside StaticGenerator.php and it looks like I could filter out the drafts in this section :

  /**

   * Regenerate the static content used to display the archive gadget

   *

   */

  static function GenArchiveGadget(){

    global $addonPathData;

 

    //get list of posts and times

    $list = SimpleBlogCommon::AStrToArray( 'post_times' );

    if( !count($list) ) return;

 

    //get year counts

    $archive = array();

    foreach($list as $post_id => $time){

      $ym = date('Y-m',$time); //year&month

      $archive[$ym][] = $post_id;

    }

The thing is that I would need to know which is a draft and which isn't so that I could do something like

if (!IsDraft) {

$archive[$ym][] = $post_id;

}

An uglier way would be to filter out every date in the future but the management of articles would become less user friendly.

Any advice?

Thanks!

 

 

 

 

 

6 years ago#10539

juergen
1.5K Posts
65.1K Downloads
16 Plugins

You should be able to obtain the draft status using

$post_drafts = SimpleBlogCommon::AStrToArray('drafts');

and then filter it with

if( !isset($post_drafts[$post_id]) ){
  $archive[$ym][] = $post_id;
}

 

see Posts.php -> ShowPost() on GitHub

6 years ago#10540

juergen
1.5K Posts
65.1K Downloads
16 Plugins
See also this pull request
6 years ago#10541

franck
14 Posts

Juergen,

Thank you very much!

Works like a charm!

Have a great day.

6 years ago#10542

Topic Closed

 

News

elFinder 2.1.50 in Upcoming Release
12/28/2019

A new release for Typesetter is in the works with a lot of improvements including the ... Read More

Typesetter 5.1
8/12/2017

Typesetter 5.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

More News

Log In

  Register