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

Fatal error being thrown when accessing a protected page on support.newpathconsulting.com #136

Open
asirota opened this issue Apr 25, 2023 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@asirota
Copy link
Member

asirota commented Apr 25, 2023

To simulate error try logging in with MPG credentials [email protected]/

the membership level and group sync just fine to the account in WordPress

But ALL pages whether they have access control or not yield this error:

Fatal error: Uncaught Error: array_key_exists(): Argument #2 ($array) must be of type array, string given
in /homepages/0/d91623022/htdocs/clickandbuilds/startuphaven/wp-content/plugins/newpath-wildapricot-press/src/class-wa-integration.php on line 1865

Call stack:

array_key_exists()
wp-content/plugins/newpath-wildapricot-press/src/class-wa-integration.php:1865
WAWP\WA_Integration::get_wa_post_meta()
wp-content/plugins/newpath-wildapricot-press/src/class-wa-integration.php:1537
WAWP\WA_Integration::create_wa_login_logout()
wp-includes/class-wp-hook.php:308
WP_Hook::apply_filters()
wp-includes/plugin.php:205
apply_filters()
wp-includes/nav-menu-template.php:267
wp_nav_menu()
wp-content/themes/twentytwentyone/template-parts/header/site-nav.php:27
require()
wp-includes/template.php:785
load_template()
wp-includes/template.php:718
locate_template()
wp-includes/general-template.php:204
get_template_part()
wp-content/themes/twentytwentyone/template-parts/header/site-header.php:19
require()
wp-includes/template.php:785
load_template()
wp-includes/template.php:718
locate_template()
wp-includes/general-template.php:204
get_template_part()
wp-content/themes/twentytwentyone/header.php:28
require_once()
wp-includes/template.php:783
load_template()
wp-includes/template.php:718
locate_template()
wp-includes/general-template.php:48
get_header()
wp-content/themes/twentytwentyone/page.php:12
include()
wp-includes/template-loader.php:106
require_once()
wp-blog-header.php:19
require()
index.php:17
@asirota asirota added the bug Something isn't working label Apr 25, 2023
@asirota
Copy link
Member Author

asirota commented May 4, 2023

It appears that WAP processes page in a menu bar differently than pages not in a menu bar. So when a page is in a menu bar access control is checked and the current code doesn't check the access control properly. The access control features for pages/post NOT in a menu bar work just fine.

function get_wa_post_meta() expects an array to be passed into it holding the metadata of a post but currently a post ID is being sent into it and thus line 1882 throws an error when trying to see if an array key exists in a string

	if (array_key_exists(self::RESTRICTED_GROUPS, $meta)) {
			$restricted_groups = $meta[self::RESTRICTED_GROUPS][0];
		}
		if (array_key_exists(self::RESTRICTED_LEVELS, $meta)) {
			$restricted_levels = $meta[self::RESTRICTED_LEVELS][0];
		}

@asirota
Copy link
Member Author

asirota commented May 8, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants