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

PHP Fatal error on Ad Server Settings admin page #30

Open
onpubcom opened this issue Feb 16, 2016 · 5 comments
Open

PHP Fatal error on Ad Server Settings admin page #30

onpubcom opened this issue Feb 16, 2016 · 5 comments

Comments

@onpubcom
Copy link
Contributor

With the latest version of the plugin, going to the Ad Server Settings (/wp-admin/edit.php?post_type=ad-layer&page=ad_layers_ad_server_settings) page in wp-admin throws the following exception, resulting in a fatal error:

PHP Fatal error: Uncaught exception 'FM_Submenu_Not_Initialized_Exception' with message 'The Fieldmanger context for this submenu was not initialized'

This renders the plugin no longer fully configurable via the wp-admin UI.

@bcampeau
Copy link
Member

Ad Layers is dependent on Fieldmanager for its admin area. Please ensure you are using the latest version from here: https://github.com/alleyinteractive/wordpress-fieldmanager

Ad Layers requires an update made to Fieldmanager in July 2015 for submenu pages, so it seems that you're running a quite old version.

@onpubcom
Copy link
Contributor Author

Will do. Thanks for this info!

@kala725
Copy link

kala725 commented Feb 8, 2017

Hi @bcampeau : I am facing the same issue, although I have recent versions for both fieldmanager and ad-layers.

@kala725
Copy link

kala725 commented Feb 8, 2017

Hi @bcampeau : I have figured out the issue and it was in my code. However the error returned needs to be fine tuned.

It will happen when I limit the ad-layer access to some capability.

add_filter( 'register_post_type_args', function( $args, $post_type ) {
	if ( 'ad-layer' === $post_type ) {
		$args['capabilities'] = [
			'edit_posts' => 'manage_advertising',
			'edit_others_posts' => 'manage_advertising',
		];
	}
	return $args;
}, 10, 2 );

When the logged in user, doesn't have the capability, this error is returned, while trying to change the settings.

(Ideally if we hide all the options like server settings, then it can be avoided.) If there is other way of doing so, please let me know.

@bcampeau
Copy link
Member

bcampeau commented Feb 8, 2017

We'll take a look at it for the next version, but if you'd like to submit a pull request with a proposed solution you're more than welcome.

@bcampeau bcampeau reopened this Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants