tinuzz / wp-plugin-trackserver

A WordPress plugin for GPS tracking and publishing
https://wordpress.org/plugins/trackserver/
36 stars 14 forks source link

Support template pages for logged in user #45

Open JohnDBarrett opened 11 months ago

JohnDBarrett commented 11 months ago

The [tsmap] shortcode supported user=@ for the current page's author. This does not allow for template pages where an admin is probably the author. Support has been added for user=@@ which means for the current logged in user.

Also, to allow the user to see their trackerserver URL from the front end, a new shortcode [tsprofile] has been implemented to display the users URL including their username and app password. ts_app_passwords are created in the user profile if they did not exist already. There are no attributes to this shortcode but it is envisaged that profile attributes could be added in future to get other information such as a list of tracks etc.

tinuzz commented 11 months ago

Thank you, John! I will have a look as soon as possible!

tinuzz commented 11 months ago

Just did a quick look at the first commit, but I'm not sure I understand the [tsprofile] shortcode. As I understand it, is intends to display the user's tracking URL in OsmAnd format (given the {0}, {1}, etc. placeholders), but there are a couple of things wrong with it.

First, the commas after each field.. they're not really supposed to be there. Can you explain where they come from?

But more importantly, OsmAnd is just one of the apps that is supported by Trackserver, so a shortcode that displays the OsmAnd URL without any further context does not seem very useful. And as you indicated in your personal email that even you yourself will ultimately not need this functionality, I don't think I can merge it as is.

As for the rest of the PR, I haven't looked at it yet. I'll do it as soon as I can.

Martijn.

tinuzz commented 11 months ago

I just looked at the 'user=@@' addition. I understand what you are trying to achieve here, but I don't think it is going to work. The problem is, that you assume that there is a logged in user, but what if there isn't?

Trackserver's main goal is to provide a way to publish GPS data to other people (visitors of your website, either logged in or not), so I'm not sure how helpful it is to have a shortcode parameter that only displays one's own live track.

Even in the context of your use case, I still cannot see its usefulness. What am I missing?