Open toolstack opened 8 months ago
Search uses tokens for authentication so check to see if we have a current token in addition to a logged in user.
To be honest, it's been a while since I touched this part of the code but when the user has a token they should be logged in, no?
To be honest, it's been a while since I touched this part of the code but when the user has a token they should be logged in, no?
I think so now, but when I wrote this I was still getting used to the codebase and this was the solution I came up with. Let me double check it and swap over to the logged in user call if it works.
Ok, I double checked it and no, during a token auth session the wp user is not set:
I think it should be though, so I'll change the PR to add that code just above the was_used() call like it is in the logged in session.
In fact, looking a little deeper, have_token_permission()
is only used for search, not anywhere else and adding the login code makes it identical to logged_in_permission()
, so I think we should simply remove have_token_permission()
and switch search over to logged_in_permission()
.
Search uses tokens for authentication so check to see if we have a current token in addition to a logged in user.
Cleanup the parameter passing to $this->get_posts() as well as otherwise some values can be set to null which break wp_getposts() in some circumstances.