Can't get "expiry-time" in PM page

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
gvp9000
Registered User
Posts: 59
Joined: Mon Oct 02, 2023 4:03 pm

Can't get "expiry-time" in PM page

Post by gvp9000 »

When I reply on a message I can get expiry-time via javascript and the expiry-time is the right one (= end session time)
post.jpg
When I open a PM (personal message) page (in compose, reply, forward or quote message) the expiry-time is ZERO !!!
Untitled 2.jpg
Why is that ?
Is it a bug or can I get the RIGHT expiry-time via a javascript call (for example to MongoDbSessionHandler.php) or there is another way ?

All I want to do is to get the RIGHT expiry-time via javascript code when I open a PM page instead of "0=zero".

Thanks.
You do not have the required permissions to view the files attached to this post.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53443
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Can't get "expiry-time" in PM page

Post by Brf »

Where is that coming from?
User avatar
halil16
Registered User
Posts: 1321
Joined: Fri Jul 24, 2020 11:30 pm
Location: Turkiye
Name: Halil

Re: Can't get "expiry-time" in PM page

Post by halil16 »

Most likely an extension you are using is doing this. It embeds some code into the template. Which extensions do you use?
My board: phpBB GroupO BeldeThatTowns*for sale*
Hire me for your phpBB board. ⭐
Introducing Mobile Upgrade! Make your phpBB board like an app! 📢
"The day we will need ideas more than possessions, we will find the secret to true wealth." - Peyami Safa
gvp9000
Registered User
Posts: 59
Joined: Mon Oct 02, 2023 4:03 pm

Re: Can't get "expiry-time" in PM page

Post by gvp9000 »

I use latest Post local storage extension.
Any idea why $session_expiry_time is "0" only in PM (personal message) pages ?

In event/listener.php

Code: Select all

	public function check_expiry_time($event)
	{
		// error_log('[phpBB3 postlocalstorage] Dumping \$event in check_expiry_time()' + print_r($event, true));
		error_log('[phpBB3 postlocalstorage] checking for expiry time...');

		try
		{
			/**
			 * Session length, as defined on the configuration parameters, in seconds.
			 * If it doesn't exist, or throws an error, we'll set it to zero and that's it.
			 *
			 * @var int
			 */
			$session_length = (int) $this->config['session_length'];
		}
		catch (Exception $e)
		{
			error_log('[phpBB3 postlocalstorage] Something is wrong with session_length: ' . $e->getMessage());
			$session_length = 0;
		}
		$session_expiry_time = $this->time_now + $session_length;

		error_log('[phpBB3 postlocalstorage] check_expiry_time: $this->time_now is ' . $this->time_now
			. ' $session_length is ' . $session_length
			. '; Total is: ' . $session_expiry_time);

		$this->template->assign_vars(array(
			'EXPIRY_TIME' => $session_expiry_time,
		));
	}
		
In \styles\all\template\event\posting_editor_options_prepend.html

Code: Select all

<div id="expiry-time" style="visibility: hidden; display: none;">
{%- if EXPIRY_TIME -%}
{{- EXPIRY_TIME -}}
{%- else -%}
0
{%- endif -%}
</div>
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26631
Joined: Fri Aug 29, 2008 9:49 am

Re: Can't get "expiry-time" in PM page

Post by Mick »

Support for that extension is in the ‘Post Local Storage’ dedicated Discussion/Support forum.
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel
User avatar
halil16
Registered User
Posts: 1321
Joined: Fri Jul 24, 2020 11:30 pm
Location: Turkiye
Name: Halil

Re: Can't get "expiry-time" in PM page

Post by halil16 »

I looked, Mick. The extension the OP is talking about is somet ext. else. This just creates a cookie with JS so that it is remembered in the browser. The one the OP uses seems to be a bit more complicated. OP should still ask the author on the page/website where he downloaded the extension. or change the code like this:

Code: Select all

<div id="expiry-time" style="visibility: hidden; display: none;">
{%- if EXPIRY_TIME -%}
{{- EXPIRY_TIME -}}
{%- else -%}{% if S_PRIVMSGS %}{% else %}
0
{% endif %}{%- endif -%}
</div>
My board: phpBB GroupO BeldeThatTowns*for sale*
Hire me for your phpBB board. ⭐
Introducing Mobile Upgrade! Make your phpBB board like an app! 📢
"The day we will need ideas more than possessions, we will find the secret to true wealth." - Peyami Safa

Return to “phpBB Custom Coding”