Forum Replies Created
-
AuthorPosts
-
November 17, 2012 at 9:33 am in reply to: Automatically Log into Affiliate Account not working for WP Role Subscriber #51355dirkkirchnerMember
Here is what I did.
Code:
Code: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[‘user_id’]= $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);
}
}This code goes into a file named s2-hacks.php in the folder wp-content/mu-plugins (this ist a WordPress folder for ‘must use’ plugins. If you dont have such a folder, just create one).
After the log in routine is completed by the s2member plugin there ist a hook called ws_plugin__s2member_before_login_redirect. I added an action / function called login_to_wp_affiliate_platform to this hook.
Works fine and I hope this is helpful for other users.
November 16, 2012 at 2:46 pm in reply to: Automatically Log into Affiliate Account not working for WP Role Subscriber #51353dirkkirchnerMemberOk. I found a solution.
s2member has a hook called ws_plugin__s2member_before_login_redirect.
I use this to run a similar function as your handle_wp_user_login and it works very well.
If you want I can post the complete code here.
Thank you very much.
November 16, 2012 at 8:40 am in reply to: Automatically Log into Affiliate Account not working for WP Role Subscriber #51352dirkkirchnerMemberThank you. It is definitely the s2member-plugin. I’ll have a look if they have a hook in or after their login routines and if I can use that.
November 14, 2012 at 9:16 am in reply to: Automatically Log into Affiliate Account not working for WP Role Subscriber #51350dirkkirchnerMemberThe two lines are not getting printed when I log in with a subscriber user role.
I’m using the standard WordPress log in but I think it is contlolled by s2member.
-
AuthorPosts