Undefined Index Notices
-
I’m receiving a couple undefined index notices whenever viewing the settings page:
PHP Notice: Undefined index: args in /wp-content/plugins/bbpress/includes/admin/admin.php on line 370 PHP Notice: Undefined index: sanitize_callback in /wp-content/plugins/bbpress/includes/admin/admin.php on line 374
Any ideas what could be causing this?
-
I suspect it is a conflict.
It could be a theme or plugin issue
Themes
As a test switch to a default theme such as twentyfifteen, and see if this fixes.
Plugins
If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.
Then come back
Hi,
I have a notice of undefined index too after being imported some demo-data and deleted most of them. I tried to switch to 2017 theme and reactive the theme but it does not work.
Here the notice :
Notice: Undefined index: reply_count in /var/www/html/xxxx/wp-content/themes/cera/bbpress/content-statistics.php on line 70
Thanks for your helpok, that’s an error from your theme, so we’d need to see that file. Do you know how to look at theme files using ftp ?
I access through ssh + vi. Tell which one would you like to see. Thanks
ok, what I need is for you to copy this file to your pc
/var/www/html/xxxx/wp-content/themes/cera/bbpress/content-statistics.php
then open it, and post the contents in this thread please
Here it is :
<?php /** * Statistics Content Part * * @package bbPress * @subpackage Theme */ // @codingStandardsIgnoreFile // Allow plugin text domain in theme. // Get the statistics. $stats = bbp_get_statistics(); ?> <?php do_action( 'bbp_before_statistics' ); ?> <div class="widget_display_stats"> <div class="row stats_list"> <div class="col-12 stats_list_item mb-2"> <div class="bg-black-faded rounded-card p-2 h-100"> <div class="row align-items-center"> <div class="col-auto text-center d-flex pr-0 align-items-center justify-content-center"> <i class="cera-icon cera-users text-primary fa-2x p-3 card"></i> </div> <div class="col"> <h3 class="mb-0"><?php echo esc_html( $stats['user_count'] ); ?></h3> <h5 class="text-muted text-uppercase small font-weight-bold mb-0"><?php esc_html_e( 'Registered Users', 'bbpress' ); ?></h5> </div> </div> </div> </div> <div class="col-12 stats_list_item mb-2"> <div class="bg-black-faded rounded-card p-2 h-100"> <div class="row align-items-center"> <div class="col-auto text-center d-flex pr-0 align-items-center justify-content-center"> <i class="cera-icon cera-message-square text-primary fa-2x p-3 card"></i> </div> <div class="col"> <h3 class="mb-0"><?php echo esc_html( $stats['forum_count'] ); ?></h3> <h5 class="text-muted text-uppercase small font-weight-bold mb-0"><?php esc_html_e( 'Forums', 'bbpress' ); ?></h5> </div> </div> </div> </div> <div class="col-12 stats_list_item mb-2"> <div class="bg-black-faded rounded-card p-2 h-100"> <div class="row align-items-center"> <div class="col-auto text-center d-flex pr-0 align-items-center justify-content-center"> <i class="cera-icon cera-alert-circle text-primary fa-2x p-3 card"></i> </div> <div class="col"> <h3 class="mb-0"><?php echo esc_html( $stats['topic_count'] ); ?></h3> <h5 class="text-muted text-uppercase small font-weight-bold mb-0"><?php esc_html_e( 'Topics', 'bbpress' ); ?></h5> </div> </div> </div> </div> <div class="col-12 stats_list_item mb-2"> <div class="bg-black-faded rounded-card p-2 h-100"> <div class="row align-items-center"> <div class="col-auto text-center d-flex pr-0 align-items-center justify-content-center"> <i class="cera-icon cera-radio text-primary fa-2x p-3 card"></i> </div> <div class="col"> <h3 class="mb-0"><?php echo esc_html( $stats['reply_count'] ); ?></h3> <h5 class="text-muted text-uppercase small font-weight-bold mb-0"><?php esc_html_e( 'Replies', 'bbpress' ); ?></h5> </div> </div> </div> </div> </div> </div><!-- .widget_display_stats --> <?php do_action( 'bbp_after_statistics' ); ?> <?php unset( $stats );
ok, looks like something is a bit corrupt – how did you delete the demo data?
I switched a lot of time the structure of the permalinks (because I had problems with groups and forums) and then I deleted some articles, forums, subjects etc. through the WP UI (no script in database) before recreating some others (per the WP UI).
Screenshot : https://ibb.co/q7CXmXmok, can you try
dashboard>tools>forums>repair forums and try recalculating replies
I did not know these features ! But sadly I executed all in Repair forums and Update forums but it did not fix it.
hmm..something is amiss, let me think about what you might try next !
OK. Just to know : could it be that the reply_count is null (because there is for instance no response to a subject) and that this case is mishandled ?
Have you tried adding a reply to a topic?
Yes, I had tried it (answer to a subject as admin and connected as simple user too) ; it does not fix the pb :-/ (and I notice then that my previous post was non sense)
ok, this could take some debugging !
firstly in dashboard>replies how many replies do you have?
can you copy the
All (1,090) | Mine (129) | Published (1,089) | Pending (1) | Bin (1) | Spam (2)
answer into this thread
YEAH !
I had added some new subjects and no reply ! So The number of reply was still to 0. By asking me to put the number of reply that appears in the dashboeard, I notice that it was to 0….
And after being published a real reply on a subject, it is ok : no notice anymore !
A big thank to you both for your help.
Take care !great – glad you ae fixed !
- You must be logged in to reply to this topic.