Closed fmfernandes closed 5 months ago
We could implement those checks on the plugin side by checking an endpoint first for user existence and/or category and render a message in the shortcode if not properly configured.
I think this is the safest route, from the plugin's perspective, since it would also validate against FeedLand connection errors.
Could we just verify that an OPML file is being returned from the OPML URL, and add an admin notice if nothing is there?
Note: in the https://github.com/a8cteam51/feedland-blogroll/issues/8#issuecomment-2048059740, it is being discussed whether FeedLand.com should be the default server, so I would expect that to be a further change in this PR.
Hey @NickGreen, can you please check the latest commit (8f49a78)? Specially the feedland_validate_options
function which handles validation on our side upon saving the settings.
I'm not sure if it would be best to split each setting into its own but I'm happy moving forward with an array. I'm thinking about that because I think the sanitize_callback
function would be better applied to each setting individually but since we do not need any other validation I think we're good moving forward with that implementation. Let me know what you think.
I'm using the /isuserindatabase?screenname={username}
endpoint to check if the user exists and then trying to grab the feed from /getfeedlistfromopml?url={url}
to get the feed. FeedLand will throw the message I mentioned in the PR if it can't be found, thus, defaulting to ''
for the category.
@fmfernandes This worked great for me! Excellent work. I didn't even have to deactivate/reactivate the plugin, it just worked.
A couple of changes:
https://feedland.com
(instead of .social)Category (optional)
or something simple like that?That's it, though, the code looks good and adheres to WP standards, is properly escaped, etc.
Don’t make the category optional, make it default to blogroll, for the reason you mention.
--
@NickGreen, agreed on the placeholder! Removed it and also changed the server.
It's worth noting, though, that @scripting doesn't have a blogroll
category set up on feedland.com, so the validation fails and we default to a category that doesn't exist.
The plugin checks the https://feedland.com/getfeedlistfromopml?url=https%3A%2F%2Ffeedland.com%2Fopml%3Fscreenname%3Ddavewiner%26catname%3Dblogroll
URL which contains the message
we look for the error and still uses it.
If we default it to optional, then the URL would be https://feedland.com/getfeedlistfromopml?url=https%3A%2F%2Ffeedland.com%2Fopml%3Fscreenname%3Ddavewiner
which returns a valid response.
@fmfernandes As per the Slack convo this morning, the plan is to leave category out entirely. So, the category input goes away, and we don't build a cat modifier into the URL string.
@NickGreen -- do you agree with the idea? i could be wrong. you're the one with the eyes on the actual software here. i'm not watching very closely, here to advise.
@scripting Totally on board with simplifying the UI in this way. We can always "pave the cowpaths" later, right?
@NickGreen, implemented changes on 66cd60a.
LGTM! This is good to merge.
Screenshot in current state for posterity:
Changes proposed
This PR addresses #8. On the settings page (
/wp-admin/options-general.php?page=feedland_blogroll_settings
) more options were added:There's a small description for username and placeholders for helping.
Before and after screenshots
Testing
Known issues
There's no input validation on the plugin side, i.e. we do not validate if a given server URL is in fact a FeedLand server or if the category/username exist.
A possible solution for this is:
err.message == Can't get the feed list because there are no feeds in the OPML file.
.err.message == There was an error communicating with the server.
.Or:
We could implement those checks on the plugin side by checking an endpoint first for user existence and/or category and render a message in the shortcode if not properly configured.
Screenshot of the rendered shortcode when improperly configured
_This is using the Twenty Twenty-Three theme._