PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

User Registration = New Author for post?

  1. craig.c
    Member

    I have read one of Carl's forum replies reinforces this ... "When you use a form to create a post you have the option of either 1) Selecting which author the posts should be attributed to OR 2) If the user filling out the form is logged in to your site the post is attributed to their username."

    I assumed the User Registration Add-On would be able to attribute the new user as the author (in a form that also has Post content population). Is there some work-around for this?

    Posted 14 years ago on Thursday December 16, 2010 | Permalink
  2. No, there is not a work around for this right now.

    The feature with the Post Fields allows you to assign the logged in user as the author of the post.

    The problem with the User Registration Add-On is it creates a user, it doesn't log them in. So if you have Post Fields on the same form as User Registration then the author won't get set as the new user that is created because the user isn't logged in yet.

    The user has to be logged into the site in order for them to be set automatically as the post author.

    The User Registration Add-On is still early in development so we do plan enhancements to it and Gravity Forms to further extend it's functionality. The ability to register a user and create a post with that users id is planned, but it's not currently possible with the User Registration Add-On as it is now.

    Posted 14 years ago on Thursday December 16, 2010 | Permalink
  3. I can't believe I paid for a plugin and am dumb enough to give assistance for free...

    Anyway, you can use the WP registration actions to adjust things after a user registers.

    In your functions.php simply add:

    //create a redirection after registration
    add_action(‘init’, ‘redirect_registered’);
    function redirect_registered (){
    if(isset($_GET['checkemail'])){
    $redirect_location = ‘index.php’;
    wp_redirect( $redirect_location );
    }
    }

    Keep in mind that a redirect can send data ie:

    $redirect_location = ‘index.php?user_happiness=very’;

    What this means is it allows you to do things regardless of a user being logged in or not. You can enter form data into the database easily this way.

    Keep in mind how the WP login/registration works. It does store data in the users table, as it needs something to check the password against when a user does finally log in. So the data is already there.

    Additionally, you can also set the user to 'validated' regardless of them checking their email by simple SQL query which, in turn, allows yuo to do even more.

    It all starts with an action after registration.

    By the way...

    if(isset($_GET['checkemail']))

    That is the default variable that is sent in the head when a user registers. All you are doing is taking advantage of that.

    Posted 14 years ago on Friday December 17, 2010 | Permalink
  4. @urmedia We do plan on adding options to the User Registration so that it works on the same form as a Post Creation form and assigns the post author to the newly created user.

    We are also adding an option for using it with Multi-Site to automatically create a Site in Multi-Site for the new user that is created. Those are 2 features in development.

    Posted 14 years ago on Friday December 17, 2010 | Permalink
  5. has this function been added yet?

    ie: if the form registers a user at the same time as creating a post (same form), will it automatically assign the created user account to the post?

    Posted 13 years ago on Tuesday July 5, 2011 | Permalink
  6. Yes, if the form is both registering a user and creating a new post it can set that new user as the post author. HOWEVER you must configure your form so that the Post Author is the user submitting the post, which is an option on the Post Title and Post Body fields, so it will set the new user as the Author.

    Posted 13 years ago on Tuesday July 5, 2011 | Permalink

This topic has been resolved and has been closed to new replies.