• I need to:

    Force users to register or login before viewing content
    Upon registration, I need the information entered on the form to also be submitted to Constant Contact

    Ideally, the user will see an excerpt and then a “to continue, please login or register” link. On click, the registration (hopefully contact form 7) or login form will come up. Once the form is filled out, the user will be automatically logged in, the information entered into the form will go to Constant Contact, the popup will close, and the user will be directed back to the content he was trying to view in the first place.

    Is there some way I can do this?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Most likely. There might even be a plugin, have you looked? I’m not knowledgeable about plugins available, I custom code just about everything.

    Changing the “read more…” text is well documented, conditional logic can check if the user is logged in, thus display “read more…”, or not, thus display “please login or register…”.

    The single post template is where it’s important to never allow output of content unless the user is logged in, is_user_logged_in() will handle that.

    It’d be simplest if the “please login or register…” link went to wp-login.php, the single post permalink that would normally be at the end of an excerpt can be the redirect argument. You could also build a login modal much like the one now seen in the back end. Some javascript will handle that.

    You can use CF7 instead if you like. The only tricky part is placing the correct security nonce in a hidden field so the registration can safely proceed. I don’t know exactly how to accomplish that, I do know CF7 provides many hooks, so there is probably a way. Since WP emails the admin about new registrations anyway (and is customizable), I don’t think CF7 provides much benefit.

    The other part I’m unsure of is placing the data in Constant Contact. If they have an API to handle this sort of thing, then this too is possible. If not, it will likely be a problem. Assuming there’s an API, hook the “register_post” action. Despite the name, this fires during new user registration. You must check the $errors argument to be sure the registration did not fail. The WP user has not been created at this point, but the form data still should be in $_POST.

    If I missed something, or you still have questions, just ask!

Viewing 1 replies (of 1 total)
  • The topic ‘Force registration, use CF7, have data sent to CC’ is closed to new replies.