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.

Set Post Author to Registered User Upon Front-End Submission

  1. Hi there,

    I have a front-end form that:
    1) Registers a user (name, email address)
    2) Creates a post
    3) Sets the Post Author to the user's name

    Works great. However, once the user has become registered, s/he cannot submit new posts because "This username is already registered.".

    Is there a way to validate the submitter ("yes, s/he is in fact a registered user"); create a post; AND set the Post Author to this registered user's name without anyone logging into wp-admin? It seems I should be able to do this without the User Reg Add-on, but the Post Author always defaults to "anonymous" (or whomever the default author is set to).

    Any ideas?

    Thanks!

    Tommy

    Posted 7 years ago on Thursday September 13, 2012 | Permalink
  2. Because you combined registration with the form which creates the post, it's always going to try to register the user, since that's how you designed it. You can change the work flow such that the registration form is separate from the form which creates the post. You can make the form which creates the post, visible to logged in users only. And in the alternate message to show, you can display your registration form. The confirmation for the registration form can redirect to the form which creates the post.

    Would that change work for you?

    Posted 7 years ago on Thursday September 13, 2012 | Permalink
  3. Hi Chris, thanks for responding so quickly. When I last created a separate form for the post submission process (prior to using the Reg User Add-on), everything worked nicely, except, the Post Author was assigned the default name (rather than the submitter's name)... UNLESS this user was actually logged in to wp-admin when the form was submitted... which seems odd to me. Am I misunderstanding the meaning of a logged in user? I really don't want to give users access to wp-admin.

    Posted 7 years ago on Thursday September 13, 2012 | Permalink
  4. I think the following page answers my last question. I guess I can remove access to wp-admin via the "Members" plugin (and of course, use 2 separate forms-- one for registration and one for logging in registered users... which then allows me to set the Post Author to the logged-in (and registered) users' names when they post via the form.

    http://www.gravityhelp.com/documentation/page/Role_Management

    Thanks again Chris!

    Posted 7 years ago on Thursday September 13, 2012 | Permalink
  5. You're welcome. There are also plugins which prevent access to the wp-admin completely. Here is one such plugin (never used it, but it claims to do what you need): http://wordpress.org/extend/plugins/lockdown-wp-admin/

    Posted 7 years ago on Thursday September 13, 2012 | Permalink