Skip to:
Content

bbPress.org

Opened 3 years ago

Closed 3 years ago

#3379 closed defect (bug) (fixed)

undefined $topic_id with buddypress

Reported by: robin-w's profile Robin W Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6.6 Priority: normal
Severity: normal Version:
Component: General Keywords:
Cc:

Description

These errors appear in dashboard with just bbpress and buddypress

Notice: Undefined variable: topic_id in /www/sites/e12/ee6/gos.rewweb.co.uk/web/wp-content/plugins/bbpress/includes/replies/template.php on line 461

Notice: Undefined variable: topic_id in /www/sites/e12/ee6/gos.rewweb.co.uk/web/wp-content/plugins/bbpress/includes/replies/template.php on line 467

Attachments (2)

Capture.JPG (98.4 KB) - added by Robin W 3 years ago.
dashboard photo
jjj-sc-2020-06-06 at 22.26.27@2x.png (524.8 KB) - added by johnjamesjacoby 3 years ago.
Not seeing it yet, but still looking around

Download all attachments as: .zip

Change History (9)

@Robin W
3 years ago

dashboard photo

#1 @Robin W
3 years ago

$topic_id is not being set in bbp_get_reply_url

<?php
// Juggle reply & topic IDs for unpretty URL formatting
                if ( bbp_is_reply( $reply_id ) ) {
                        $topic_id = bbp_get_reply_topic_id( $reply_id );
                        $topic    = bbp_get_topic( $topic_id );
                } elseif ( bbp_is_topic( $reply_id ) ) {
                        $topic_id = bbp_get_topic_id( $reply_id );
                        $topic    = bbp_get_topic( $topic_id );
                        $reply_id = $topic_id;
                }

#2 @johnjamesjacoby
3 years ago

  • Milestone changed from Awaiting Review to 2.6.6
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

Hey @robin-w! Always nice to see ya 👋

Is it possible to get the call stack to that point?

I'm having a hard time imagining a reason why bbp_get_reply_url() would be called on the Plugins page in WordPress Admin. Maybe BuddyPress Notifications has one pending that's trying to link to something incorrectly? If so, that would be indicative of a bug someplace else.

If $reply_id is neither a topic nor a reply, there isn't much of a URL to get. 😁

@johnjamesjacoby
3 years ago

Not seeing it yet, but still looking around

#3 @Robin W
3 years ago

only appears for keymasters !

NOTICE: wp-content/plugins/bbpress/includes/replies/template.php:461 - Undefined variable: topic_id
require_once('wp-admin/admin-header.php'),
do_action('in_admin_header'),
WP_Hook->do_action,
WP_Hook->apply_filters,
wp_admin_bar_render, 
do_action_ref_array('admin_bar_menu'),
WP_Hook->do_action,
WP_Hook->apply_filters,
bp_members_admin_bar_notifications_menu,
bp_notifications_toolbar_menu,
bp_notifications_get_notifications_for_user, 
apply_filters_ref_array('bp_notifications_get_notifications_for_user'),
WP_Hook->apply_filters,
bbp_format_buddypress_notifications,
bbp_get_reply_url
Last edited 3 years ago by johnjamesjacoby (previous) (diff)

#4 @Robin W
3 years ago

so in bbpress

\bbpress\bbpress.2.6.5\bbpress\includes\extend\buddypress\notifications.php

<?php
function bbp_format_buddypress_notifications( $content, $item_id, $secondary_item_id, $action_item_count, $format, $component_action_name, $component_name, $id ) {

starts at line 62

#5 @johnjamesjacoby
3 years ago

In 7138:

Replies: Set a default topic ID in bbp_get_reply_url().

This commit prevents a PHP notice when calling this function on an oddly formed reply ID.

In trunk, for 2.7. See #3379.

#6 @johnjamesjacoby
3 years ago

In 7139:

Replies: Set a default topic ID in bbp_get_reply_url().

This commit prevents a PHP notice when calling this function on an oddly formed reply ID.

In branches/2.6, for 2.6.6. See #3379.

#7 @johnjamesjacoby
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

Marking as fixed.

I think the output can still be improved, but that is worthy of a separate issue IMO.

Note: See TracTickets for help on using tickets.