Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to get rid of the default blog post

  • Avatar of Matt Kern
    Matt Kern
    Participant

    @mattkern

    The fact that mu makes a default blog post, “Hello World”, is not a good thing in buddypress for a number of reasons.

    Is there a way to make make no default post when adding a new user?

    thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Avatar of Fishbowl81
    fishbowl81
    Participant

    @fishbowl81

    There is a great plugin,

    http://wpmudev.org/project/New-Blog-Defaults

    Updated for WPMU 2.7 – New features include the ability to delete the Mr. WordPress initial comment, the ability to place the initial Hello World post in draft mode (so it won’t show up on the site), a bunch of new discussion settings for 2.7 users, the default large image size, and more. Allows a site admin to set new blog defaults via an administrative screen in the site admin area.

    Avatar of Matt Kern
    Matt Kern
    Participant

    @mattkern

    Thats awesome. Thanks Mr. Fishbowl.

    I started writing my own, but this one will work better.

    Thanks

    Avatar of Ben (oldskoo1)
    oldskoo1
    Participant

    @oldskoo1

    Give this plugin ago but last time i tried it, the blogs were still being listed in the BP blogs directory, but when you click through, it said something like not found here.

    Avatar of Matt Kern
    Matt Kern
    Participant

    @mattkern

    Thanks Ben.

    Worst case scenario maybe I could see what they were doing and jumpstart the plugin I was working on to get it done.

    Avatar of Ben (oldskoo1)
    oldskoo1
    Participant

    @oldskoo1

    I asked a very similar question recently Matt.

    My community is filled with Hello World blog posts which spoils the blog directory. The Blog defaults didn\’t work for me. Taking a look at the SQL that grabs these blogs / posts you see why.

    Anyway, since you asked this i\’ve dug into the code myself and made a dirty little hack. Looking at the SQL used to pull out blogs / posts for listings, the only reliable way i could find to ignore any default posts was to compare the registered datetime and the last_updated datetime. The common trend was that the two datetimes were typically recorded within seconds (as you would expect as its a default post inserted when the blog is created). So i used a MySQL function EXTRACT(DAY_MINUTE FROM…).

    So, simply put, add the following SQL : AND EXTRACT(DAY_MINUTE FROM wb.last_updated)!=EXTRACT(DAY_MINUTE FROM wb.registered)

    to the functions :

    function get_by_letter

    function get_all

    in the file:

    /wp-content/mu-plugins/bp-blogs/directories/bp-blogs-directory-blogs.php

    Its a hack and it will get overwritten with any updates, but its the best i can do until / if this gets included by default, in some way.

    Avatar of Matt Kern
    Matt Kern
    Participant

    @mattkern

    Thanks Ben. My network has no users so I am trying to address this from the start.

    Here is what I had from last night. Doesn’t work yet though.

    add_action('wpmu_new_blog', 'mk_delete_default_post');

    function mk_delete_default_post($blog_id) {

    global $wpdb;
    $query = "DELETE * from {$wpdb->posts}";
    echo $query;
    $wpdb->get_results($query, ARRAY_A);
    }

    wpmu_new_blog() returns the int of the new post. Originally I was going to assemble the string to the table because I could not find a reliable way to get the table name yet.

    something like

    $table = $table_prefix . wpmu_new_blog() .’_post’;

    $query = “DELETE * from {$table}”;

    I got distracted so I haven’t quite quite got it going yet.

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.