The MU forums have moved to WordPress.org

Adding PHP scripts to WPMU core (6 posts)

  1. buzz2050
    Member
    Posted 17 years ago #

    Hi,

    I am working with Wordpress MU to develop a portal expected to host around 50k blogs. WPMU is pure joy once you get past the initial installation and 'playing around' phase. I am looking at adding my own pages(forms) to the existing core. I understand that to load the wordpress environment for your page(or PHP file), the wp file 'wp-blog-header.php' has to be included; any other files apart from this required?

    Hope to get some pointers here!

    Thanks,
    Sib.

  2. kgraeme
    Member
    Posted 17 years ago #

    This can probably be accomplished with plugins and themes rather than modifying the core.

    See the Blog Topics plugin for an example of adding a topics page.

    In our heavily customized version in our install we have added pages that display posts by blog topic and lists sites by blog topic. These aren't "Pages" in the wordpress sense, but more like new templates like a categories.php template.

  3. andrea_r
    Moderator
    Posted 17 years ago #

    "I am looking at adding my own pages(forms) to the existing core."

    What kind of page content and would they be off the main blog? Just asking before you head off down the wrong brambly path when there's a shortcut just over there, past that hedge. ;)

    Forms on any page, on any blog:
    - cform 2 plugin (incredibly complex)
    - contact form 7 (simple straightforward forms)

    Also, if you have extremely specific needs, you could always make a page template with whatever code you wanted in it.

    http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

  4. buzz2050
    Member
    Posted 17 years ago #

    First of all, a gazillion thanks to both kgraeme and andrea.. I have been posting this question(and similar ones) almost everywhere (even in paid forums) with almost little or no hopes of help.

    I thought there was something wrong in my way of putting forth my query (Eng. not being my first language). I am so glad for your replies, they made me smile :) I think I should have posted here first..

    I can dabble with PHP, but this is my first time around with WPMU. I am aware of the 'Pages' and 'Page Template' concept in WP and have used it before with static content. Right now I'm looking at storing extra-data, if you will, for every registered blog on my site.

    My portal registers two kinds of blogs - 'startups' and 'members' (using premium plugin - 'blogtypes' for this). We have an extended registration process, where after the initial blog-signup the user depending on his blog-type has to fill in some additional details filling out our custom forms. Data captured from these forms will be stored in the same d/b as wpmu, but different tables of course.

    I have put up a sample form from my site here.

    Don't really know much about plugin development at this stage, although I am reading up on that. What I need to do is to capture user data (rather blog related data) and store it in the back-end mapping it to the corresponding blog-id for later use.

    Right now, I have plonked all my PHP forms in my custom theme folder and I gave direct links to them on my front-page for the user to reach them. It kinda looks ugly in the address-bar: http://www.abc.com/wp-content/themes/my-theme/sample.php
    I know I can do a url-rewrite using Apache, but am sure there is better and a neater way of managing this whole thing using WP.

    Any pointers on this please?

    Thanks,
    Sib.

  5. andrea_r
    Moderator
    Posted 17 years ago #

    "after the initial blog-signup the user depending on his blog-type has to fill in some additional details filling out our custom forms."

    AHA!

    Basically, what you really need to do is your own custom signup form. Which can be swapped out via plugins. Buddypress is a good example of a plugin that completely bypasses the regular signup page. (note: you don't need to look at anything else in BP other than the signup part. the rest is irrelevant)

    When you do your own version, you need an if statement right after the part that pick what blog types it is.

    If startup blog type is pick, do this stuff.
    If other type is picked do other stuff.
    Save data, make blog.

  6. buzz2050
    Member
    Posted 17 years ago #

    Hi Andrea,

    Thanks for that tip! I don't have any idea of BP, will download it and have a look.

    On my site, once a user signs-up for a blog, the admin reviews his registration and then approves/denies it. I am looking at this plugin and also your tutorial. By the way Andrea, did I mention what an amazing resource wpmututorials.com is!! Thank you so much for putting up such step-by-step instructions for going about things, awesome read!

    Well, in my case, after the admin approves the blog, the blog-signer gets automatically redirected to this extended-signup page depending upon his blog-type(startup-signup.php / member-signup.php) and HAS to fill in the additional details before blogging.

    Right now, my form structure is something like follows (it's in my custom-theme sub-directory):

    <?php
    
    /**
     Load the WordPress environment and template.
    */
     require('../../../wp-blog-header.php') ;	
    
    /**
    Define the d/b table constants
    */
    ....
    ....
    
    /**
    Pick up the blog-id of the user
    */
    $blog_id = blah blah
    
    if($action == 'add')
    {
      //capture the form data elements, fire the inserts, every inserted row contains '$blog_id' as the main reference key and then the other column data such as blog owner's name, profession, designation etc etc
    }
    ?>
    
    <form name=".." method=".." action=".." />
    
    .......
    .......
    .......
    
    My custom form
    
    .......
    .......
    
    </form>

    I feel, its a very raw kinda way of executing things, although it does work. I need to integrate this with the core seamlessly, maybe as a template, maybe as a plugin, just not sure how to go about it.

    Many thanks,
    Sib.

About this Topic

  • Started 17 years ago by buzz2050
  • Latest reply from buzz2050