Horje
Modify wp-signup.php - Wordpress Solution
*** UPDATE *** I think that wp-signup.php can handle what I need to do. I have managed to get this "Add New Site" registration working (with only 3 super-simple mods to the code) so it allows non-users (any visitor to the website) to register a new site (without user registration) and have the site is active immediately. And it was much simpler than I expected. I'm pretty sure all the code needed is already in wp-signup.php (and/or site-new.php). I now need someone to ..... - rewrite some of the conditional calls (which are I've needed to change to get this working) - - modify the preg_replace to allow _underscores in sitename * I am not modifying the core code. I have copied the wp-signup.php code into the theme as a page template. I need an "Add a New Site" method on the frontend/homepage that allows non-users to add a site to the network. - Allows any frontend visitors to "add a new site" to the network - Visitors will not be users and will not be logged in - It DOES NOT add any new users to the network (it only adds the site) - New site needs to be active immediately - A single form field would be ideal - Must be a secure solution - Must not be a core file hack Basically I need a frontend version of the backend method "Add New Site" ["wp-admin > Network > Sites >Add New"] where new blogs are active immediately and without creating a new user (when email address already exists in DB, no user is created). This network is a "read-only" environment (with no user publishing/editing/anything). There will only ever be 1 user (me, as Super Admin). Once the new site is added to the network (from the frontend) the theme will do some content generation. I just need to get the new blog added. My Ideas - I'm open to any idea that solves the problem - wp-signup.php could be modified (as a page template) - site-new.php basically does what I need, but conditional to logged-in users + sufficient privileges - I have a Gravity Forms developers licence, and the User Registration add-on, but I don't know that this will help Considerations - I want to keep things as simple as possible - User registration will disabled - Security is important

Solution - 1

hi, here is a modified code from http://www.scribd.com/doc/76015425/279/Creating-a-New-Site I changed this into a shortcode so you can embed this into any page on your frontend:

[create_site]
The following assumes you are using multisite with subdirectories and the owner of the new sites is user_id=1:


add_shortcode( 'create_site', 'custom_multisite_create_site' );

function custom_multisite_create_site($atts) {
        //check if multisite is enabled
        if ( is_multisite() ) {

                //if the form was submitted lets process it
                if ( isset( $_POST['create_site'] ) ) {

                        //populate the variables based on form values
                        $domain = esc_html( $_POST['domain'] );
                        $path = esc_html( $_POST['path'] );
                        $title = esc_html( $_POST['title'] );

                        $path=str_replace("/","",$path);
                        $path="/".$path;
                        //verify the required values are set
                        if ( $domain && $path && $title ) {

                                //create the new site in WordPress
                                $new_site = wpmu_create_blog( $domain, $path, $title, 1 );

                                //if successfully display a message
                                if ( $new_site ) {
                                        echo '<div class="updated">New site ' .$new_site. ' created successfully!</div>';
                                }

                        //if required values are not set display an error
                        } else {
                                echo '<div class="error">New site could not be created.  Required fields are missing</div>';
                        }
                }
        ?>

        <div class="wrap">
                <h2>Create New Site</h2>
        <form method="post">
            <TABLE class="w3-table w3-striped w3-bordered w3-border w3-white" class="form-table">
            <tr valign="top">
                <th scope="row"><label for="fname">Domain</label></th>
                <td><input maxlength="45" size="25" name="domain" value="<?php echo DOMAIN_CURRENT_SITE; ?>" /></td>
            </tr>
            <tr valign="top">
                <th scope="row"><label for="fname">Path</label></th>
                <td><input maxlength="45" size="10" name="path" /></td>
            </tr>
            <tr valign="top">
                <th scope="row"><label for="fname">Title</label></th>
                <td><input maxlength="45" size="25" name="title" /></td>
            </tr>
            <tr valign="top">
                <td>
                <input type="submit" name="create_site" value="Create Site" class="button-primary" />
                </td>
            </tr>
            </table>
        </form>
        </div>
                <?php
        } else {
                echo '<p>Multisite is not enabled</p>';
        }
}


Solution - 2

you said thea "site-new.php " does what you want , so can we modified it?


Solution - 3

I've been working on similar projects and always keeping my eyes open for new methods. I seem to recall a plugin on wpmudev that did this fairly well and I can't seem to find it now.. I'm looking forward to seeing what answers others will have..


Solution - 4

Gravity forms should be able to handle what you are looking for. It already has the site creation part built in to the forms, so I believe you should be able to create a from that will go through the process like normal, and then you can customize it to 'not register' the user with the hooks (http://www.gravityhelp.com/documentation/page/User_Registration_Add-on_Developer_Docs). My thought though, for an even easier solution, is that you do a gravity form for new site creation, and for the required fields for the user registration part (name, username, email, password... ) you simply put those fields as 'hidden' and put in your own information as the default values. <- I'd be happy to help if you want that put in.


Solution - 5

Hi, Where one can find your changed wp-signup.php code? Regards, Gabriel





Wordpress

Related
deactivate links to single post view  - Wordpress Solution deactivate links to single post view - Wordpress Solution
Finding colour tones... - Wordpress Solution Finding colour tones... - Wordpress Solution
Custom headers and custom image sizes - Wordpress Solution Custom headers and custom image sizes - Wordpress Solution
How do I set SITE_URL to override the database url info?  - Wordpress Solution How do I set SITE_URL to override the database url info? - Wordpress Solution
How do I make custom post types not appear as blog posts? - Wordpress Solution How do I make custom post types not appear as blog posts? - Wordpress Solution

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8