bookmark_bordergform_site_created

Description

Fires after the site has been created. Only applicable to Network installs with the “Create Site” option enabled.

Usage

Applies to all forms

add_action( 'gform_site_created', 'your_function_name', 10, 5 );

Parameters

  • $site_id integer

    The ID of the created site.

  • $user_id string

    The ID of the registered user.

  • $entry Entry Object

    The entry object from which the site was created.

  • $feed Feed Object

    The Feed which is currently being processed.

  • $password string

    The password associated with the user; either submitted by the user or automatically generated.

Examples

Here is an example where we use this hook to create a new welcome post on the newly created site.

add_action( 'gform_site_created', 'create_welcome_post', 10, 5 );
function create_welcome_post( $site_id, $user_id, $entry, $feed, $password ) {

    $user = get_userdata( $user_id );

    $post = array();
    $post['post_title'] = 'Welcome to your new site!';
    $post['post_content'] = "Hi {$user->first_name}, nWe just wanted to personally welcome you to your new site!";

    switch_to_blog( $site_id );
    wp_insert_post( $post );
    restore_current_blog();

}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

do_action( 'gform_site_created', $blog_id, $user_id, $entry, $feed, $password );

This filter is located in GF_User_Registration::create_site() in class-gf-user-registration.php