Opened 3 years ago

Closed 3 years ago

#12258 closed defect (bug) (wontfix)

Bug: Wrong blog title

Reported by: _DorsVenabili Owned by:
Priority: high Milestone:
Component: Themes Version:
Severity: normal Keywords: theme custom header kubrick
Cc: _DorsVenabili

Description

Using the Default theme based on Kubrick theme, when I create a new blog and I go to 'Custom Header' in 'Appearance' in that new blog, if I select 'Show text' and I save changes, it doesn't show the new blog's title, intead that, it shows the default blog's title.\r\n\r\nI have tried this creating in more than one blog and every time happens the same, it's important cause every blog must to show their own title.

Change History (7)

  • Cc _DorsVenabili added
  • Resolution set to fixed
  • Status changed from new to closed

I've fixed it. In file: wp-content/plugins/buddypress/bp-themes/bp-default/header.php in line 44:

<?php global blog_id; ?>
<h1 id="logo"><a href="<?php echo site_url() ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php echo blog_name($blog_id); ?></a></h1>

And we add the next function in functions.php

function blog_name($blogid){

global $wpdb;

$blogname = $wpdb->get_var("SELECT meta_value FROM wp_bp_user_blogs_blogmeta WHERE blog_id='".$blogid."' AND meta_key='name'");

return $blogname;

}

I'm sory, my mistake, the right solution is:

<?php global blog_id; ?>
<h1><a href="<?php echo get_option('home'); ?>/"><?php echo blog_name($blog_id); ?></a></h1>

And we add the next function in functions.php

function blog_name($blogid){

global $wpdb;

$blogname = $wpdb->get_var("SELECT meta_value FROM wp_bp_user_blogs_blogmeta WHERE blog_id='".$blogid."' AND meta_key='name'");

return $blogname;

}

  • Milestone 2.9.3 deleted
  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Resolution set to invalid
  • Status changed from reopened to closed

Is this a bug in BuddyPress? If so it should be reported to http://trac.buddypress.org/.

  • Resolution invalid deleted
  • Status changed from closed to reopened

I'm sorry nacin, but I wrote the solution for the buddypress theme first, but the second solution is right for the wordpress theme, If not, it will show the default blog's name at every blog's header, and that is a WP bug. So it has to be changed in the file:

/wp-content/themes/default/header.php

Line 41:
<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>

And we add the next function in functions.php

function blog_name($blogid){

global $wpdb;

$blogname = $wpdb->get_var("SELECT meta_value FROM wp_bp_user_blogs_blogmeta WHERE blog_id='".$blogid."' AND meta_key='name'");

return $blogname;

}

_DorsVenabili: You're clearly using BuddyPress though. The default themes in WordPress don't account for how a plugin may manipulate them.

That table does not exist in core, it is a BuddyPress table. As a side note, you should be using $wpdb->table_name, which will then handle the prefix. Also, there are APIs for direct queries like that.

  • Resolution set to wontfix
  • Status changed from reopened to closed

Add the function to the theme file.

Note: See TracTickets for help on using tickets.