WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Is it possible to register new users from inside a post? (4 posts)

  1. Jim de Groot
    Member
    Posted 5 years ago #

    Hi,

    I was wondering if it is possible to register / add a new user from inside a post.

    My idea is to modify the Quizzin plugin in such a way that when a person comes to my blog and completes the quiz, that person can fill in his name and emailaddress so that his score is saved and that his name and emailaddress are used to add him as a new user to wp.

    The new users are later used to send them emails about updates etc.

    Anyone ideas or suggestions? Thanks!

  2. thelastknight
    Member
    Posted 5 years ago #

    If you go to the standard register page and view the source and then copy and paste that into your quiz, you might have to use a page template to do this.

    It should be something like this.

    <form name="registerform" id="registerform" action="http://www.example.co.uk/wp-login.php?action=register" method="post">
    	<p>
    		<label>Username<br />
    		<input type="text" name="user_login" id="user_login" class="input" value="" size="20" tabindex="10" /></label>
    	</p>
    	<p>
    		<label>E-mail<br />
    		<input type="text" name="user_email" id="user_email" class="input" value="" size="25" tabindex="20" /></label>
    
    	</p>
    	<p id="reg_passmail">A password will be e-mailed to you.</p>
    	<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="Register" tabindex="100" /></p>
    </form>
  3. Jim de Groot
    Member
    Posted 5 years ago #

    Thanks LASTKNIGHT, I'll try to use it.

    At the moment I have modified the Quizzin plugin in such a way that the result get saved in a new database table with the users name and emailadress. Now the results are only saved if the player is a logged-in user, otherwise the results are not saved.
    Ideal would be if after the last question of the quiz, not logged-in users would have to give name and emailadress and that if they are new users, submitting would register them to the wp database and the name and emailadress would also be used for saving the result of the quiz.

    I hope it is clear what I'm trying to do. Further questions or suggestions are always welcome.

  4. thelastknight
    Member
    Posted 5 years ago #

    You could use http://codex.wordpress.org/Function_Reference/is_user_logged_in to see if the user was logged in and echo the register form if they weren't logged in so they could register, as well as the login form so if they are registered they could log in.

    Hope this helps.

Topic Closed

This topic has been closed to new replies.

About this Topic