latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Auto Login Code Question

Home Forums Community Forum Auto Login Code Question

Tagged: 

This topic contains 5 replies, has 3 voices. Last updated by  Jason (Lead Developer) 4 years, 1 month ago.

Topic Author Topic
Posted: Friday Nov 9th, 2012 at 7:10 pm #31181

Greetings.

I tried using the code to auto login after a successful payment listed here:

http://www.s2member.com/forums/topic/auto-login-after-successful-payment/

and it was working great, except for the fact that the site stopped sending the Signup Confirmation email, which I use as a receipt.

Is there an easy way to change the code so that the receipt is still sent?

Thanks!

List Of Topic Replies

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Monday Nov 12th, 2012 at 6:53 am #31277

That’s odd. The signup confirmation email would happen on payment, the auto-login happens right after registration, which comes later. Are you using the pro-forms?

Could you let me see your log entries for the transaction with that problem, please? (x’ing out any private info) [hilite path]Dashboard -› s2Member® -› PayPal® Options -› Account Details -› Logging[/hilite]

Thanks.

Posted: Monday Nov 12th, 2012 at 10:10 am #31313

Cristián,

Unfortunately, I did not have logging enabled when this occurred, but when I deleted the s2hacks.php file, the receipts began to send out again.

Yes, I am using Paypal Pro Forms. Every transaction that occurred when the s2hacks file was on the server did not send a receipt and every transaction since I removed it has.

If it helps, I have another mu-plugins file, which is a contextual translation to remove the “for X months” from coupon code entries, which was confusing my users.

That code follows.

<?php
add_filter('ngettext_with_context', 's2_n_contextual_translation', 10, 5);
function s2_n_contextual_translation($translated = NULL, $original_single = NULL, $original_plural = NULL, $number = NULL, $context = NULL)
    {
        if($context === 's2member-front' && $original_single === 'for %1$s %2$s')
            /* Ex: `good for 1 month`. Using `%1$s` and `%2$s`. */
            $translated = '';
        /**/
        else if($context === 's2member-front' && $original_plural === 'for %1$s %3$s')
            /* Ex: `good for 2 months`. Using `%1$s` and `%3$s`. */
            $translated = '';
        /**/
        return $translated;
        
    }
?>
Posted: Monday Nov 12th, 2012 at 6:30 pm #31376

Got it.

Could you show me the hack that was causing you the problem? I’d like to make sure it’s the latest one. It had to be fixed a couple or more times before.

Posted: Monday Nov 12th, 2012 at 6:38 pm #31379
<?php
add_action('ws_plugin__s2member_during_configure_user_registration', 's2_auto_login_after_registration');
function s2_auto_login_after_registration($vars = array()) {
	if (!is_admin() && $vars['processed'] === 'yes') {
		wp_new_user_notification($vars['user_id'], $vars['pass']);
		wp_set_auth_cookie($vars['user_id'], false, is_ssl());
		c_ws_plugin__s2member_login_redirects::login_redirect($vars['login']);
	}
}

Also, I use Gmail SMTP, which is how I can verify that the receipts went out or not. Might that be a potential cause?

Posted: Monday Nov 12th, 2012 at 7:47 pm #31390
Staff Member

Thanks for the heads up on this thread.

I’m not seeing anything wrong with the hack that you posted. However, that hack was originally posted some months ago, and was intended to be integrated with a PayPal Standard Button integration. I don’t believe it was ever tested against a PayPal Pro Form integration, which is what you’re using.

The fact that no Signup Confirmation Email is being sent, would indicate to me that your redirection code in this hack file, is interrupting s2Member’s post-processing of the transaction. In other words, it’s bypassing s2Member’s routine that actually sends the Signup Confirmation Email for Pro Forms.

If you’d like to accomplish auto-login after registration with a Pro Form, I recommend the success="" attribute for your Pro Form Shortcode. With that attribute, you can create a custom thank-you page, which might include code from your hack file above; and you may choose to automatically log them in and redirect them to a page of your choosing. Please see: Dashboard -› s2Member® -› PayPal® Pro Forms -› Custom Return URLs Upon Success

Viewing 5 replies - 1 through 5 (of 5 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.