Skip to content
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

Is this a user role issue? #503

Open
BurlesonBrad opened this issue Oct 1, 2018 · 5 comments
Open

Is this a user role issue? #503

BurlesonBrad opened this issue Oct 1, 2018 · 5 comments
Assignees

Comments

@BurlesonBrad
Copy link
Contributor

PHP Fatal error: Uncaught Error: Call to a member function has_cap() on boolean in /woocamp/wp-content/plugins/anspress/includes/class/roles-cap.php:1515
Stack trace:
#0 /woocamp/wp-content/plugins/anspress/includes/comments.php(341): ap_user_can_read_comments(Object(WP_Post))
#1 /woocamp/wp-content/plugins/anspress/includes/comments.php(417): ap_the_comments(Object(WP_Post), Array, true)
#2 /woocamp/wp-content/plugins/anspress/templates/single-question.php(113): ap_post_comments()
#3 /woocamp/wp-content/plugins/anspress/includes/common-pages.php(131): include('/woocamp/wp-con...')
#4 /woocamp/wp-content/plugins/anspress/includes/class-theme.php(58): AnsPress_Common_Pages::question_page()
#5 /wordpress/core/4.9.8/wp-includes/class-wp-hook.php(286): AnsPress_Theme::template_include_theme_compat('/woocamp/wp-con...')
#6 /wordpress/core/4.9.8/wp-includes/plugin.php(203): WP_Hook->apply_filters('/woocamp/wp-con...', Array)
#7 /woocamp/wp-content/plugins/anspress/includes/class-theme.php(42): app

Hey @rahularyan , here's the stack trace for the error I'm getting
And, here's the screenshot of the settings:
image
And here's a few links:
https://woocamp.com/questions/categories/plugin-suggestions/
A user_role of "Anyone" should be able to read & see the questions. However....
https://woocamp.com/woocommerce-help/i-am-looking-for-suggestions-for-multi-currency-plugins-for-woocommerce-and-geo-ip-detection/
....only a user_role of "Student" should be able to see the answers.

Have I missed something?

@rahularyan
Copy link
Member

Hi Brad, Let me check this.

@rahularyan rahularyan self-assigned this Oct 2, 2018
@BurlesonBrad
Copy link
Contributor Author

❗️ attn: @rahularyan 👉 Thanks to @jtedrow87 👍, here's the fix:

https://gist.github.com/BurlesonBrad/1503f55b1c999621849e930ce862c73e

@rahularyan
Copy link
Member

Thanks for shearing it.
I cannot add try catch in function, I will replace it with a WP_Error.

@jtedrow87
Copy link

How come you cannot add a try catch?
Should be able to just do a return of a WP_Error object in the catch

@rahularyan
Copy link
Member

Yeh right. will merge it.

@rahularyan rahularyan reopened this Oct 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants