Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a pretty good question here. I would like to create a hidden page on my wordpress blog for each user as they are registered. I already have most of the code of what needs to be put on the page with a simple shortcode. All I need is something to actually make the page. Here is some of my code.

<?php
function added($user_id)
{
global $wpdb;

// Create a page for the user with certain settings
// WHAT DO I PUT HERE!?
}
add_action( 'user_register', 'added' );

function author_page($atts, $content = null)
{
    // Some code here on what to output on the page...
}
add_shortcode( 'author', 'author_page');
?>

Well, that's pretty much what I've got with about 350 lines of code in the author_page function and some other stuff that the plugin will do. All I need to do, is in the // WHAT DO I PUT HERE!? bit, I need some code that will allow me to create a page, under the subheading authors, make it not seen on the dropdown of that menu page, and then put the shortcode [author id="1 or whatever it is"]Some description of the Author, or could be left out...[/author] on the page.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted
  • Create a custom post type named userinfo.
  • On 'user_register' call wp_insert_post() in your filter, and create a new post for the user. Add the user ID as post meta field.
  • When the new page is called on the front-end, display the user data.
share|improve this answer
    
Thank you so much. I actually found this but had to leave and couldn't post my findings. Thanks! –  Ethan Brouwer Oct 30 '12 at 11:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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