Support » Plugins » Hacks » Auto generate template sub-page with username as title

  • Avi

    (@avikaylat)


    Hi,
    How do I automatically generate a sub page for every user that registers to my site?
    I want the title of the automatically generated page to be equal to the username of the user and be placed with a certain page template.
    Any help out there?

    here is my website:
    http://www.StarShowsStudios.com

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator bcworkz

    (@bcworkz)

    Hook into the action ‘user_register’ and use wp_insert_post(). Even though you are creating a page, the insert post function works, you supply ‘page’ as the post_type argument. Once you have the page/post ID you specify the template by adding the template filename to postmeta under the key ‘_wp_page_template’.

    tell me more about how you get the above to work.
    same thing i want to create pages for my users with their name for the page to be saved as site name their name.
    would also like to use a responsive theme that i edited or page copy of one i already edited.

    Moderator bcworkz

    (@bcworkz)

    The method works with any theme and any page template you care to use. See Plugin Hooks for how to hook actions like ‘user_register’. See wp_insert_post() for how to use the function itself. Set the template postmeta with update_post_meta().

    You don’t even really need a page for each user, a single template could display any user’s data by virtue of them being logged in. The main difference is all users access their page with the same permalink instead of a unique permalink, but they all still each see their own content. This is how the standard back end profile page works.

    oshi

    (@thugzanime)

    Hi BCworkz am looking into the same thing and i was wondering if there’s a plugin for this…

    Moderator bcworkz

    (@bcworkz)

    Hi oshi, I’m sorry, I’m not the best person to ask. For the most part I try to custom code everything, so I’m not aware of very many plugins. I realize many people cannot code their own solutions for various reasons, so plugin availability is important to them.

    There very well may be a plugin, I just don’t know. I suspect you can search as well as I, if not better, so I’ll leave you to it. Good luck!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Auto generate template sub-page with username as title’ is closed to new replies.