Open hayhurst opened 1 year ago
Don't have permission to add a branch to offer a proposed solution to these two issues so are the changes I'd like to see in comment form...
Remove this to allow for the shortcode to work on non-'wp-admin' pages
Replace this
echo 'No user id defined.';
return;
If
!is_admin
is false, then the 'Connected Devices' shortcode returns nothing at all - leaving you with the 'Connected Devices' header, and no explanation to the end user as to why there isn't any content returned.At the very least this should echo a text response explaining what the issue is?
But equally... we're implementing this on a profile page for end users outside of the
wp-admin
ecosystem, which is possibly why this hasn't been an issue before...https://github.com/usefulteam/jwt-auth/blob/84087733a6ed087df2ca53e6b4be767854754eb5/class-devices.php#L341
The same goes for the below section where we've had to add in an or operator to the if statement to account for a custom profile page.
Originally upon installing this plugin, the
die()
function was running, killing any further rendering of this page. This seems like an unwarranted use of die which should really only be used for Ajax requests (and even then,wp_die()
is preferable).This should probably be changed to
return echo 'No user id defined'
so that it fails a little more gracefully.