Pat Gilmour
asked 10 years ago

Hi,
I’m trying to install DW Question Answer on WP 3.8.1 on my WPEngine Staging server but I’m getting this error:

Fatal error: Call to a member function add_cap() on a non-object in /nas/wp/www/staging/*my-site-account-name*/wp-content/plugins/dw-question-answer/inc/roles.php on line 192

I disabled all plugins and still got the error. Any suggestions about what else I can try?
Thanks!

Pat Gilmour
replied 10 years ago

The code at line 192 is:

$role->add_cap( ‘dwqa_can_’ . $key . ‘_question’ );

Part of:

$role = get_role( $role_name );
foreach ($perms[‘question’] as $key => $val) {
if( isset($value[$role_name][‘question’][$key]) && $value[$role_name][‘question’][$key] ) {

$role->add_cap( ‘dwqa_can_’ . $key . ‘_question’ );

} else {
$role->remove_cap( ‘dwqa_can_’ . $key . ‘_question’ );
}
}

Looks like if I comment it out, then asking questions is going to get screwed up – right?

Pat Gilmour
replied 10 years ago

If I comment out the lines 191-211 in inc/roles.php it installs.

Theses are the lines that add capabilities with add_cap()

I don’t really understand it, but could it be a roles based issue?

Powered by DW Question & Answer Pro