0

I wanted to add an action on when a user activated the blog through standard signup process, all my custom meta on the registration will be inserted on my modified wp_blogs table.

Here is my code for the custom signup meta.

add_filter( 'add_signup_meta', 'custom_add_signup_meta' );

function custom_add_signup_meta ( $blogmeta = array() ) {

        $the_country = $_POST['country-origin'];
        $d_currency = $_POST['user_currency'];
        $d_zone = $_POST['state-origin'];

        $blogmeta['countries_id'] = $the_country;
        $blogmeta['default_currency'] = $d_currency;
        $blogmeta['zone_id'] = $d_zone;

    return $blogmeta;

}

Now I want to hook the function below somewhere applicable which has arguments of $blog_id and my custom meta $blogmeta

function insert_custom_datas1($blog_id, $blogmeta) {
        global $wpdb;
        $wp_blogs = $wpdb->base_prefix . "blogs";

        $wpdb->query("UPDATE `" . $wp_blogs . "` SET `countries_id`='".$wpdb->escape($blogmeta['countries_id'])."', `default_currency`='".$wpdb->escape($blogmeta['default_currency'])."', `zone_id`='".$wpdb->escape($blogmeta['zone_id'])."' where `blog_id` = '" . (int)$blog_id . "'");

}

Please help in accomplishing this.

1 Answer 1

0

I think this is what you're looking for:

add_action('wpmu_new_blog', 'insert_custom_datas1', 10, 6);
function insert_custom_datas1($blog_id, $user_id, $domain, $path, $site_id, $blogmeta) {
    // Your code here
}

Let us know how it goes?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.