Add new post automatically when new author registers? Possible? (1 post)

  1. jeeplaw
    Posted 9 years ago #

    I need the functionality of having new authors to sign up and then having WP create an automatic 'Hello World' first post for that author. Assume there's only one category too, so that's not a problem.

    The basic premise is that the new author signs up, successfully registers and then has a new post, published and waiting to welcome him.

    I found this in the WP install file, would this be applicable to loop into the new author process? If so, how can I increment the new post so that older posts aren't overwritten?

    $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, comment_count, to_ping, pinged, post_content_filtered) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '1', '', '', '')");

    $wpdb->query( "INSERT INTO $wpdb->post2cat (rel_id, post_id, category_id) VALUES (1, 1, 1)" );

    Is this possible, or could someone show me the way? Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic