Tips and Tricks HQ Support Portal › Forums › WP Affiliate Platform › WP Affiliate General Questions › Getting one time registrations to work with S2member proforms
Tagged: s2member registration
- This topic has 10 replies, 2 voices, and was last updated 10 years, 4 months ago by admin.
-
AuthorPosts
-
July 21, 2014 at 8:25 am #11213georgefMember
Hi, I am trying to get the automatic registration to work when users sign up on my site. Problem is that I am using S2Members proforms to register, so not the traditional way of registering on the site.
Hw can I still get the automatic registration to work when members register through S2member proforms? Also want to have a single sign on scenario (I assume the above would fix that)
July 21, 2014 at 11:13 pm #64497adminKeymasterDo they use the standard WordPress registration hooks after a user registers?
July 23, 2014 at 8:34 am #64498georgefMemberThis is the shortcode the Paypal Pro forms generate:
[s2Member-Pro-PayPal-Form level=”1″ ccaps=”” desc=”14 Days free / then $27 USD / Monthly (recurring charge, for ongoing access)” ps=”paypal” lc=”” cc=”USD” dg=”0″ ns=”1″ custom=”dev.thatmlmbeat.com” ta=”0″ tp=”14″ tt=”D” ra=”27″ rp=”1″ rt=”M” rr=”1″ rrt=”” rra=”2″ accept=”paypal,visa,mastercard,amex,discover,maestro,solo” accept_via_paypal=”paypal” coupon=”” accept_coupons=”0″ default_country_code=”” captcha=”0″ /]
July 23, 2014 at 11:10 pm #64499adminKeymasterI am not sure about what that shortcode does. This is a question you will need to ask the s2member support I think. Ask them the following question:
Do you use the standard WordPress registration hook after a user registers? If not, what hook do you fire? Is there any documentation on it?
July 24, 2014 at 10:31 pm #64500georgefMemberOK, I had someone reply to me that apparently had the same problem, but must admit I’m not too clear what to do. Here is his answer:
I’ve also had problems with this one. The devs tell me that the ‘user_register’ hook should always be fired. However, during my testing I couldn’t for the life of me get it to fire during a pro-form registration.
My solution (as I needed a custom redirect anyway) was to attach a filter to ‘ws_plugin__s2member_login_redirect’ that calls the WP-Affiliate functions accordingly. I won’t list my code here as it does a lot more and is probably overly complex. However for reference the functions you will need to call are:
handle_wp_user_login – For logging the user into the affiliate platform (assuming the id’s match)
wp_aff_handle_wp_user_registration – for registering the user as an affiliate.
Not saying this is the best way, but it works.
Hope it helps!
July 24, 2014 at 11:31 pm #64501adminKeymasterI think the tweak in the following post should do it:
July 25, 2014 at 8:39 am #64502georgefMemberThanks, no luck though
I just created a test account with Sandbox, account registered fine but doesn’t create the affiliate registration.
Anything else I could be missing?
This is my s2-hacks.php file:
<?php
add_action(“ws_plugin__s2member_before_login_redirect”, “login_to_wp_affiliate_platform”);
function login_to_wp_affiliate_platform($vars = array())
{
$username = $vars [username];
wp_affiliate_log_debug(“WP User Integration – attempting to log this user into the affiliate account. Username: “.$username,true);
if(wp_aff_check_if_account_exists_by_affiliate_id($username)){
$_SESSION= $username;
setcookie(“user_id”, $username, time()+60*60*6, “/”,COOKIE_DOMAIN); //set cookie for 6 hours
wp_affiliate_log_debug(“Found a corresponding affiliate account for this WP User! Logging the user into affiliate account.”,true);
}else{
wp_affiliate_log_debug(“No corresponding affiliate ID exists for this WP User (“.$username.”) so can’t log this user in!”,true);
}
}
?>
July 25, 2014 at 3:15 pm #64503georgefMemberJust looking at the title of the post you sent for the s2hacks, Automatically Log into Affiliate Account not working for WP Role Subscriber…
My roles aren’t Subscriber, they are different levels that I have created with S2member.
Does that make a difference?
July 25, 2014 at 11:49 pm #64504adminKeymasterI am not very familiar with s2member plugin code so sorry for not being able to give you an accurate answer.
The hack I shared is only for the user login action I think (it doesn’t account for the account creation).
We really need to know what action hook the s2member pro-form will trigger when a user is registered. Then I can give you a good answer. At the moment, it is definitely not triggering the standard WordPress’s registration hook. So please ask them that question.
July 29, 2014 at 6:02 am #64505georgefMemberOK, here is the response from support:
“The user_register hook in WordPress is always fired during a Pro Form submission when there is a new customer. s2Member calls upon wp_create_user() which calls upon wp_insert_user(), which fires user_register. s2Member does in fact handle the registration of a customer via the user_register hook.”
July 30, 2014 at 4:53 am #64506adminKeymasterThank you for that. I am going to try a little tweak. I have sent you an update via email. Please let me know if that helps.
-
AuthorPosts
- You must be logged in to reply to this topic.