Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#6335 closed defect (bug) (no action required)

Blank pages overload

Reported by: danbp's profile danbp Owned by:
Milestone: Priority: highest
Severity: normal Version: 2.2
Component: Core Keywords:
Cc:

Description

Don't know if it's really BP related, but it's the second time a user mention an issue concerning (no title) pages automatically created when they activate BP.

https://buddypress.org/support/topic/blank-pages-overload/
https://buddypress.org/support/topic/problem-after-updating/

Change History (11)

#1 @r-a-y
10 years ago

  • Keywords reporter-feedback added
  • Version changed from 2.2.1 to 2.2

bp_core_add_page_mappings() is a function that can create a new page:
https://buddypress.trac.wordpress.org/browser/tags/2.2.1/src/bp-core/bp-core-functions.php?marks=606#L598

However, this function is only called on upgrades or when the "Settings > BuddyPress > Components" admin page is submitted.

Need more info as to how the new pages are created and triggered.

#2 @wellgolly
10 years ago

"Need more info as to how the new pages are created and triggered."

All I know is everything was working fine until I updated bp. The pages are automatically being made, this is due to the update.

#3 @r-a-y
10 years ago

@wellgolly - Put the following code in your theme's functions.php or /wp-content/plugins/bp-custom.php:

function ray_log( $message ) {
	if ( empty( $message ) )
		return;

	error_log( '[' . gmdate( 'd-M-Y H:i:s' ) . '] ' . $message . "\n", 3, WP_CONTENT_DIR . '/ray.log' );
}

function my_log_new_posts( $post_id, $post ) {
	if ( empty( $post->post_title ) && 'page' === $post->post_type ) {
		ray_log( 'empty post: ' . print_r( debug_backtrace(), true ) );
	}

}
add_action( 'save_post', 'my_log_new_posts', 10, 2 );

What this code does is log information about how the new, empty pages are being created into a file called /wp-content/ray.log.

Once a new, empty page is generated, please copy the contents of that file and paste it on a site like Pastebin.com. Then, copy the Pastebin link and post it here.

Last edited 10 years ago by r-a-y (previous) (diff)

#4 @wellgolly
10 years ago

here you go r-a-y, hope I did this right.

http://pastebin.com/xXmH48mB

#5 @r-a-y
10 years ago

Sorry, can you try the updated code in comment:3?

The previous code logged any post with an empty title. We're only concerned with empty pages. Update the code and delete ray.log on your server and wait for a new, empty page to be generated.

#6 @r-a-y
10 years ago

I'm seeing an attempt by Sterling to update the post on line 17 of this file:
/wp-content/themes/Sterling/framework/global/theme-functions.php

Can you paste the full contents of theme-functions.php?

This problem is partially caused by BuddyPress (see ticket:6230#comment:3), but mostly caused by the Sterling theme.

Please try a different theme other than Sterling and report back.

Last edited 10 years ago by r-a-y (previous) (diff)

#7 @r-a-y
10 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Severity changed from critical to normal
  • Status changed from new to closed

This is the offending code:

function tt_get_comments_status()
{
	global $post;
	//do this only in page, to force comment open for all pages in WordPress posts table,
	//let showing of comments template decide by our theme's custom post meta only
	if (is_page()) {
		$_post = get_post($post->ID);
		//if by default page comments is closed, we set to open.
		if ($_post->comment_status == 'closed') {
			$update_post                   = array();
			$update_post['ID']             = $post->ID;
			$update_post['comment_status'] = 'open';
			$update_post['ping_status'] = 'open';
			wp_update_post($update_post);
		}
	}
}
add_action('template_redirect', 'tt_get_comments_status');

This code is not good at all.

You can remove this with the following code snippet:

remove_action('template_redirect', 'tt_get_comments_status');

#8 @wellgolly
10 years ago

Sterling comes with 3 themes, they are

Sterling Theme
Sterling Child Theme
Sterling Buddypress Theme

I have mine theme set to Sterling BuddyPress Theme.

Also you telling me to change

add_action('template_redirect', 'tt_get_comments_status');

to

remove_action('template_redirect', 'tt_get_comments_status'); ?

#9 @r-a-y
10 years ago

You should put the remove_action line in the theme's functions.php for the theme you are currently using.

Or you can just comment out the add_action call like this:
//add_action('template_redirect', 'tt_get_comments_status');

Or you can (and also tell the TrueThemes developers to) change this line in tt_get_comments_status() from:

if (is_page()) {

to:

if (is_page() && ! empty( $post->ID ) ) {

Last edited 10 years ago by r-a-y (previous) (diff)

#10 @wellgolly
10 years ago

Ray and Dan, this seems to working. I want to thank both of you for taking to the time on this matter.

#11 @DJPaul
8 years ago

  • Component changed from API to Core
Note: See TracTickets for help on using tickets.