Jump to content

michel v

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by michel v

  1. Thanks for the welcome ?

    Basically, I want to compare the "created" timestamp of the new page with the "created" timestamp of another page.

    I have since found out that I can do it by calling $pages->get() with the id of the newly created page:

    $testPage = $pages->add('basic-page', '/', [
      'title' => 'This is the page title',
      'body' => 'Lorem ipsum'
    ]);
    
    $newPage = $pages->get($testPage->id);
    
    var_dump($newPage->created);   // result: 1618991002

    I don't really understand why I can't get at it directly though. If $testPage has an id, I would think it has been saved to the database, and all fields would be populated. But hey, whatever works ?

    • Like 1
  2. Hi!

    After adding a page with $pages->add(), the value of the returned page object's "created" property is always 0. I thought it would give me the timestamp of when the page was created.

    In the admin, I can see that the page has been added and that the created/modified times are correct.

    $testPage = $pages->add('basic-page', '/', [
      'title' => 'This is the page title',
      'body' => 'Lorem ipsum'
    ]);
    
    var_dump($testPage->title);     // result: "This is the page title"
    var_dump($testPage->created);   // result: 0

    Is there a way to get the correct timestamp after adding a page with the API?

    Thanks!

  3. Teppo,

    I'm writing my first message on this forum (hi!) to thank you for this module. I'm testing it on a small local test site at the moment, and really liking it so far!

    • Like 4
×
×
  • Create New...