Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i edit start and end date in already created topic? #7

Closed
se-ti opened this issue Sep 13, 2018 · 7 comments
Closed

How can i edit start and end date in already created topic? #7

se-ti opened this issue Sep 13, 2018 · 7 comments

Comments

@se-ti
Copy link

se-ti commented Sep 13, 2018

Feature request: I'd like to modify start/end date, when i alter first post of a topic with dates.

@marttiphpbb
Copy link
Owner

marttiphpbb commented Sep 13, 2018

This is already possible. But notice (see README.md): This extension is only in the stage of initial development.
But it won't take so long anymore until it will be published on the phpbb.com extension development board.
And this extension depends several other phpBB extensions I am developing at the moment.

@flo18
Copy link

flo18 commented Dec 2, 2018

Dear Martti, thanks for that great extension!

What is the procedure to modify the date of an existing post?

thanks in advance

@marttiphpbb
Copy link
Owner

@flo18 That should normally be possible when you hit "edit" for the first post. However, some people have reported that the date field(s) doesn't show up for them.

@flo18
Copy link

flo18 commented Dec 2, 2018

thanks for reply- on my installation the field does not show up on edit. is there any chance to debug it? or can i edit it manually in the database?

@marttiphpbb
Copy link
Owner

@flo18 So it is a bug. For the moment I don't know on what conditions it depends. The dates are stored as integer "Julian Days" (see PHP documentation) on the topics table.

@mentos
Copy link

mentos commented Jan 17, 2019

@marttiphpbb I believe this doesn't have to do with the way dates are being calculated, but with the way marttiphpbb\calendarmonoinput\event\is_first_post() tries to detect the first post.

More specifically, it seems that some times $post_id and $first_post_id are of different type so you end up with something like this: 1 !== "1" which is always true.

If you cast everything to the same type, it seems to be working as expected:

private function is_first_post(string $mode, int $post_id, $first_post_id):bool
{
	if ($mode === 'edit' && (int)$post_id !== (int)$first_post_id)
	{
		return false;
	}

	if (!in_array($mode, ['post', 'edit']))
	{
		return false;
	}

	return true;
}

I can push a PR that fixes it if you like. cc: @se-ti @flo18

@marttiphpbb marttiphpbb reopened this Jan 17, 2019
marttiphpbb pushed a commit that referenced this issue Jan 17, 2019
@marttiphpbb
Copy link
Owner

So I've add the type casting now. Let's see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants