Advertisement
Guest User

member_fb_post.php

a guest
Sep 13th, 2010
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: User Feedback Page
  4. Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
  5. Description: Creates a post for each user on registration to which other members may add comments to. The new post is titled with the user's login name for easy linking from user profiles. Check out the plugin CMS Press for creating your custom post type. Idea by justbishop, code HEAVILY guided by templaedhel (thanks again!)
  6. Version: 0.0.1
  7. Author: templaedhel, justbishop
  8. Author URI: http://thingscosmomakes.com/, http://www.clothunderground.com
  9. License: GPL2
  10. */
  11.  
  12. add_action ( 'user_register', 'create_feedback_page' );
  13.  
  14. function create_feedback_page($user_id){
  15.  
  16. $user_info = get_userdata($user_id);
  17.  
  18. $new_post = array(
  19. 'comment_status' => 'open', /* important, probably shouldn't change */
  20. 'post_title' => $user_info->user_login, /* titles the post */
  21. 'post_content' => '', /* add any content you'd like in the post (empty by default) */
  22. 'post_status' => 'publish', /* go ahead and publish, right? */
  23. 'post_date' => date('Y-m-d H:i:s'), /* Just the timestamp */
  24. 'post_author' => '1', /* ID of author. Set to admin to prevent users from editing the feedback comments on themselves */
  25. 'post_type' => 'feedback', /* name of custom post type (must be created first) */
  26. );
  27. $post_id = wp_insert_post($new_post);
  28. }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement