Opened 12 years ago
Closed 12 years ago
#5716 closed defect (bug) (fixed)
bp_core_load_template() missing $wp_query declaration
| Reported by: | SGr33n | Owned by: | r-a-y |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.1 |
| Component: | Core | Version: | 1.5 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: |
Description
Hi,
I don't know if this is a Google or a BuddyPress issue, but just on BuddyPress user pages, the Google Plugin report some notices:
Notice: Undefined property: WP_Query::$post in sitelocalpath/httpdocs/wp-content/plugins/google-publisher/Utils.php on line 55
Notice: Trying to get property of non-object in sitelocalpath/httpdocs/wp-content/plugins/google-publisher/Utils.php on line 55
The line code is:
if (is_page()) {
global $wp_query;
$template_name = get_post_meta(
// The following is line 55.
$wp_query->post->ID, '_wp_page_template', true);
if ($template_name != 'default') {
return 'customPageTemplate';
}
return 'page';
}
Thanks :)
Attachments (1)
Change History (9)
#1
@
12 years ago
- Component Core → Rewrite Rules
- Keywords reporter-feedback added
- Milestone Awaiting Review → 2.1
#4
@
12 years ago
- Component Rewrite Rules → Core
- Owner set to
- Status new → assigned
- Summary BuddyPress & Official Google Publisher Plugin → Theme compatibility - Reset post issue
I think this is a theme compatibility reset post issue.
Will take a look at it.
#5
@
12 years ago
- Keywords has-patch added
- Summary Theme compatibility - Reset post issue → bp_core_load_template() missing $wp_query declaration
- Version → 1.5
This is actually not a theme compatibility issue; it's an issue with bp_core_load_template().
bp_core_load_template() attempts to set some $wp_query properties to avoid notices, but doesn't set all of them. Attached patch fixes the missed $wp_query->post property declaration, which caused the notice that the Google Publisher plugin triggered.
Will commit this patch and do some further clean up of bp_core_load_template() that I eluded to in ticket:5241#comment:13.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Thanks, we'll look into it and see if it's us. How exactly do we recreate this? Just activate that plugin, and then visit a BP user profile page? Anything else?