• Resolved jim-de-groot

    (@jim-de-groot)


    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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • thelastknight

    (@thelastknight)

    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>
    Thread Starter jim-de-groot

    (@jim-de-groot)

    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.

    thelastknight

    (@thelastknight)

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Is it possible to register new users from inside a post?’ is closed to new replies.