vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Post create date in showthread (https://vborg.vbsupport.ru/showthread.php?t=328131)

vacancy33 07-08-2020 08:45 AM

Post create date in showthread
 
How can i show post create date in showthread template?

$post[postdate] is not work :/ Work for only postbit or postbit_legacy

I have a schema code;

HTML Code:

<script type="application/ld+json">
{
    "@context":"http://schema.org",
    "@type":"DiscussionForumPosting",
    "@id":"********",
    "headline":"$thread[prefix_plain_html] $thread[title]<if condition='$pagenumber>1'> - <phrase 1='$pagenumber'>$vbphrase[page_x]</phrase></if>",
    "articleSection":"$foruminfo[title_clean]",
    "author":{"@type":"Person","name":"$thread[postusername]"},
    "datePublished":"$post[postdate]", [B]// this is not work in showthread template[/B]
    "dateModified":"",
    "image":"********************",
    "interactionStatistic":{
        "@type":"InteractionCounter",
        "interactionType":"https://schema.org/ReplyAction",
        "userInteractionCount":"$thread[replycount]"},
    "publisher":{
        "@type":"Organization",
        "name":"***********",
        "url":"**********",
        "logo":{"@type":"ImageObject",
        "url":"*******************"}
    },
    "mainEntityOfPage":{
        "@type":"WebPage",
        "@id":"***********"}
    }
</script>


z3r0 07-09-2020 07:11 AM

1 Attachment(s)
Which postdate do you want to show?

If it's the first you can create a plugin to do it.

Hook location:Showthread_complete
Title:thread start date
Code
Code:

$thread[startdate] = vbdate("Y-m-d", $thread["dateline"]);

$thread[startdate] (or {vb:raw thread.startdate} for vb4) will then be available in showthread.

Schema also accepts datetime format so you could use Y-m-dTH:i:sP in the plugin instead of Y-m-d for greater accuracy.

Attachment 157670

z3r0 07-09-2020 07:27 AM

After a little more playing, this will give you first and last post dates (you can use last for date modified)

Code:

$thread[startdate] = vbdate("Y-m-dTH:i:sP", $thread["dateline"]);
$thread[lastdate] = vbdate("Y-m-dTH:i:sP", $thread["lastpost"]);


vacancy33 07-09-2020 09:16 AM

Quote:

Originally Posted by z3r0 (Post 2603430)
After a little more playing, this will give you first and last post dates (you can use last for date modified)

Code:

$thread[startdate] = vbdate("Y-m-dTH:i:sP", $thread["dateline"]);
$thread[lastdate] = vbdate("Y-m-dTH:i:sP", $thread["lastpost"]);


Thank you soo much it s work :)


All times are GMT. The time now is 08:15 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01154 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete