if !$user->has_cap ("author")
Statistics: Posted by arwyl — October 27th, 2010, 8:30 am
<?php
/*
Create this function before s2Member loads it's default version.
goes here: /wp-content/mu-plugins/s2-login-redirection.php
*/
function ws_plugin__s2member_login_redirect ($username = FALSE)
{
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action ("ws_plugin__s2member_before_login_redirect", get_defined_vars ());
unset ($__refs, $__v); /* Unset defined __refs, __v. */
/**/
$username = (!$username && is_object ($current_user = wp_get_current_user ())) ? $current_user->user_login : $username;
/* This additional check was added in case wp_signon() fires this event with empty $_POST credentials.
In this rare case, we can check to see if WordPress® is remembering a previously logged in User. */
/**/
if (!is_object ($user = new WP_User ($username)) || ! ($user_id = $user->ID) || !$user->has_cap ("edit_posts") || $user->has_cap ("author"))
{
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action ("ws_plugin__s2member_during_login_redirect", get_defined_vars ());
unset ($__refs, $__v); /* Unset defined __refs, __v. */
/**/
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] && function_exists ("ws_plugin__s2member_generate_password"))
{
delete_user_setting ("default_password_nag"); /* setcookie() */
update_user_option ($user_id, "default_password_nag", false, true);
}
/**/
if (strtolower ($username) === "demo" || ws_plugin__s2member_ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], strtolower ($username)))
{
if ($special_redirection_url = ws_plugin__s2member_login_redirection_url ($user))
wp_redirect ($special_redirection_url);
/**/
else
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
}
/**/
exit ();
}
/**/
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action ("ws_plugin__s2member_after_login_redirect", get_defined_vars ());
unset ($__refs, $__v); /* Unset defined __refs, __v. */
/**/
return;
}
?>
Statistics: Posted by Jason Caldwell — October 27th, 2010, 3:41 am
Statistics: Posted by arwyl — October 26th, 2010, 6:24 pm