The MU forums have moved to WordPress.org

hacking the install blog defaults function in wpmu-functions.php (4 posts)

  1. heyitsaj
    Member
    Posted 19 years ago #

    I need an expert to help me.

    I want to edit the install blog defaults function in wpmu-functions.php to create multiple first pages.

    Currently it creates an about page and then exits.

    What I would like to do is expand the code that creates the about page (line 1241 on my build) and have it create 4 or 5 more pages with dummy text inserted into them.

    Has this been documented somewhere?

    Anyone up for some contract work?

    TIA

  2. lunabyte
    Member
    Posted 19 years ago #

    make a copy of the original wpmu-functions.php.

    open the original.

    copy the code that sticks in the "about" page.

    edit it.

    repeat.

    if it mucks up... that's why you made a copy before you started. ;)

  3. heyitsaj
    Member
    Posted 19 years ago #

    looking for an expert to help me create a standard set of pages for my users - i see how the about page is created in the DB but looking for more direction on how to create a second page using the insert command

  4. jaredbangs
    Member
    Posted 19 years ago #

    I'd advise against hacks in general, or at least avoid them if at all possible.

    In this case, you can do what you want without modifying the base code. If it were up to me, I'd add a plugin (to the mu-plugins dir), with an "add_action" call hooking the "wpmu_activate_blog" action. This should point to a function that will handle creating the additional posts.

    As for creating the posts / pages, I'd recommend trying to stick to as high level as possible, as opposed to doing direct database inserts. Adding posts and pages using the wp_insert_post function will take care of a lot of other stuff that you otherwise have to remember to do yourself manually. For an example of how this could be done fairly easily, I'd refer you to the import routines (/wp-admin/import/wordpress.php for example).

    The process_posts function in that file is very similar to what the function that you would call on the wpmu_activate_blog action would need to do.

    Depending on your comfort level with PHP, this may or may not be easy enough for you to do yourself. If not, it sounds like you're already expecting to look for some contract help. I unfortunately don't have any time to spare (busy with a few contracts already, including a couple WPMU customization projects), but hopefully you will get this done one way or another.

    Hope that helps a bit.

About this Topic

  • Started 19 years ago by heyitsaj
  • Latest reply from jaredbangs