wp-knowledgebase
wp-knowledgebase copied to clipboard
Debug warning: Notice: Use of undefined constant KBE_PLUGIN_SLUG
Upon plugin activation, I get a warning at the top of my WP Admin:
Notice: Use of undefined constant KBE_PLUGIN_SLUG - assumed 'KBE_PLUGIN_SLUG' in /srv/www/ooc.teamrubiconusa.org/current/web/app/plugins/wp-knowledgebase/articles/kbe_articles.php on line 30
Here's a screenshot of the full output:
Not sure if this is caused by the same thing as #62 but wanted to bring to your attention.
This is on a local Vagrant box running PHP 7.0.9-1+deb.sury.org~trusty+1 (cli) ( NTS )
and the Trellis stack with define('WP_DEBUG', true);
There were a number of additional notices (also for undefined constants) when I viewed the front-end, but I don't think those are worth reporting; you can probably see them if you turn on WP_DEBUG. Setting define('WP_DEBUG',false);
removes the notices.
@runofthemill Thanks for reporting. Are you on the latest master branch or the latest plugin from w.org?
I believe this should already be fixed on the master branch, so ready for the next update.
The latest plugin from w.org (via wpackagist.org) - here's the corresponding info from Composer:
name : wpackagist-plugin/wp-knowledgebase
descrip. :
keywords :
versions : * 1.1.4
type : wordpress-plugin
source : [svn] https://plugins.svn.wordpress.org/wp-knowledgebase/ tags/1.1.4
dist : [zip] https://downloads.wordpress.org/plugin/wp-knowledgebase.1.1.4.zip tags/1.1.4
names : wpackagist-plugin/wp-knowledgebase
Hi, I'm getting these notices:
Notice: Use of undefined constant KBE_PLUGIN_SLUG - assumed 'KBE_PLUGIN_SLUG' in /var/www/html/wp-content/plugins/wp-knowledgebase/articles/kbe_articles.php on line 30
Notice: Use of undefined constant KBE_BG_COLOR - assumed 'KBE_BG_COLOR' in /var/www/html/wp-content/plugins/wp-knowledgebase/wp-knowledgebase.php on line 623
Notice: Use of undefined constant KBE_BG_COLOR - assumed 'KBE_BG_COLOR' in /var/www/html/wp-content/plugins/wp-knowledgebase/wp-knowledgebase.php on line 627
Notice: Use of undefined constant KBE_BG_COLOR - assumed 'KBE_BG_COLOR' in /var/www/html/wp-content/plugins/wp-knowledgebase/wp-knowledgebase.php on line 632
Notice: Use of undefined constant KBE_SEARCH_SETTING - assumed 'KBE_SEARCH_SETTING' in /var/www/html/wp-content/plugins/wp-knowledgebase/wp-knowledgebase.php on line 416
I use: WordPress 4.7.2 WP Knowledgebase 1.1.4 PHP 7.1.1
I need to add that in PHP 7.0 it happens as well.
Especially when multisite installation used - then every network site is expecting constants set up.
To solve this it is enough to provide defaults for $kbe_settings
$kbe_settings = array(
'kbe_article_qty' => 4,
'kbe_plugin_slug' => 'kb',
'kbe_search_setting' => 1,
'kbe_breadcrumbs_setting' => 1,
'kbe_sidebar_home' => 0,
'kbe_sidebar_inner' => 2,
'kbe_comments_setting' => 0,
'kbe_bgcolor' => '#fff',
);
}```
and
```$pageId = '';
if ( ! empty( $getSql ) ) {
foreach($getSql as $getRow) {
$pageId = $getRow->ID;
}
}```
in wp-knowledgebase.php file
Best,
Patryk