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

user last visit shortcodes (2) look wrong #4665

Closed
Jimmi08 opened this issue Jan 17, 2022 · 3 comments · Fixed by #4741
Closed

user last visit shortcodes (2) look wrong #4665

Jimmi08 opened this issue Jan 17, 2022 · 3 comments · Fixed by #4741
Assignees
Labels
type: bug A problem that should not be happening
Milestone

Comments

@Jimmi08
Copy link
Contributor

Jimmi08 commented Jan 17, 2022

Bug Description

I have imported this field according this
$target['user_lastvisit'] = $source['user_lastvisit'];
and it is not displayed correctly (but it is correct in database)

I think that this:

	function sc_user_lastvisit($parm='')
	{
		return $this->var['user_currentvisit'] ? e107::getDate()->convert_date($this->var['user_currentvisit'], "long") : "<i>".LAN_USER_33."</i>";
	}
	
	
	function sc_user_lastvisit_lapse($parm='')
	{	
		return $this->var['user_currentvisit'] ? e107::getDate()->computeLapse($this->var['user_currentvisit']) : '';
	}

Should be at least:

	function sc_user_lastvisit($parm='')
	{
		return $this->var['user_currentvisit'] ? e107::getDate()->convert_date($this->var['user_currentvisit'], "long") : e107::getDate()->convert_date($this->var['user_lastvisit'], "long");
	}
	
	
	function sc_user_lastvisit_lapse($parm='')
	{	
		return $this->var['user_currentvisit'] ? e107::getDate()->computeLapse($this->var['user_currentvisit']) : e107::getDate()->computeLapse($this->var['user_lastvisit']);
	}

Not sure when user_currentvisit is filled. I suppose it is mean that the user is online? if yes, then a message "online" would be better.

The problem with the solution above is that if that field is not filled it shows the time 1.1.1970 (in according format)

I would suppose that convert_date() or computeLapse() returns nothing if there is no date sent.

value of $this->var['user_lastvisit'] is string(1) "0"

Thanks

@Jimmi08 Jimmi08 added the type: bug A problem that should not be happening label Jan 17, 2022
@Moc
Copy link
Member

Moc commented Jan 17, 2022

Please try and stick as much as possible to the bug report template :)

In these type of reports, it really helps to provide examples or screenshots.

Which values are in the database, what are you seeing as output now and what are you expecting to see instead?

If more information is needed, it will be asked for. Thanks!

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Jan 17, 2022

@Moc
I asked for confirmation that the code is correct. Where is the value from field "user_lastvisit" used?
Now either LAN_USER_33 is returned or field user_currentvisit.

I have imported users with the import plugin.

$target['user_lastvisit'] = $source['user_lastvisit'];

value $target['user_lastvisit'] is not displayed on user profile page.

So what field is correct?

@CaMer0n CaMer0n added this to the e107 2.3.2 milestone Mar 30, 2022
@CaMer0n
Copy link
Member

CaMer0n commented Mar 30, 2022

@Jimmi08 Thanks. PR welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A problem that should not be happening
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants