-
Notifications
You must be signed in to change notification settings - Fork 7
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
WIP: 404 in favor of 400 in progress controller #185
base: dev
Are you sure you want to change the base?
Conversation
// Store preexisting global values. | ||
$temp_post = $post; | ||
$temp_is_singular = $wp_query->is_singular; | ||
|
||
// Override them. | ||
$post = get_post( $post_id ); | ||
$wp_query->is_singular = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was following this approach on my branch https://github.com/eri-trabiccolo/lifterlms-rest/tree/restrictions
eri-trabiccolo@debe8b5#diff-5ce7aeb33633a2220e61908290ff5aedR806-R815
I needed to set the query's queried_object
and the queried_object_id
as well, I cannot remember exactly why at the moment. But just in case you'd find some inconsistencies during your tests, take this into account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I saw you start doing something like this somewhere but I couldn't find it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the reason I added this as a function was because I was pretty sure you were doing something like this and figured we'd need it elsewhere at somepoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you did it right.
I did it inside the "loop" in the post controller because I needed it in the posts loop but I will adapt my code using the new function. Looks more clean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eri-trabiccolo I'm working on reworking llms_page_restricted()
to be useable outside a loop. This function is some very stringy code and needs a refactor. I'm taking it on instead of writing a hack around it.
This is a early WIP to per #181
(I named the branch wrong)
@eri-trabiccolo can you have a look through the changes here and see if I'm track per our discussion in #181
I'm submitting this early because I want to make some progress on this but I'm feeling uncertain whether I'm moving in the right direction.
This still requires the following before it can be submitted as a full PR and merged:
llms_rest_page_restricted()