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.

About: Viruthagiri Thirumavalavan

Sorry, I've not written a description yet. I'll get to it soon!


My Latest Replies (From Various Topics)

Viewing 11 replies - 1 through 11 (of 11 total)
Author Replies
Author Replies
Posted: Wednesday Apr 4th, 2012 at 2:43 pm #10055

Ok thankyou

Posted: Wednesday Mar 28th, 2012 at 5:19 pm #9379

Ok then.. Thanks for confirming it

Posted: Wednesday Mar 28th, 2012 at 5:02 pm #9376

You might get errors when you completely uninstall s2member by erasing s2member database data

Posted: Wednesday Mar 28th, 2012 at 4:26 pm #9371

Hello Riaan, By default i’m hiding all my post. S2member creates 5 levels. Level 0 will be free subscriber. Level 1 will be my paid subscriber. current_user_can checks the level. If it is level 1 it will display the page without hiding it.

And yes i tried Api/scripting page. But i couldn’t find any api to check whether s2member plugin enabled or not.
The problem is when i uninstall s2member plugin, my page will throw error. Thats why i wanted to check whether s2member plugin enabled or not before using that function

Posted: Wednesday Mar 28th, 2012 at 3:31 pm #9361

Thanks Cristián,

I’ll go with your method

Posted: Wednesday Mar 28th, 2012 at 3:28 pm #9360
Did you figure out how to check if the s2member plugin is installed?

No I still didn’t

Posted: Tuesday Mar 27th, 2012 at 6:57 pm #9304

Hello Raam, I tried other support forums. I couldn’t get support in stackoverflow, wordpress stackexchange. Thats why i opened this thread. I finished the whole site. The only problem i have is login redirection problem.When i disable s2member redirection working correctly. Last two days i’m browsing all s2member file to find and remove the hook. And to be honest its really frustrating to spend more than 48 hours for one line code.

All i’m just asking you guys, just to tell me how to remove your s2member redirect hook and make login_redirect hook work.

Here is my simple code

function log_in_user($username, $password) {
	$user = parse_user($username);
    ...................
    ...................
    wp_redirect(apply_filters('login_redirect', get_bloginfo('url') . '/my-account/','',$user)));
    exit;	
}
function redirect_passwort_login_redirect($redirect_to, $url_redirect_to = '', $user = null) {
    ...................
    ...................
}
add_filter('login_redirect', 'redirect_passwort_login_redirect',10,3);

I also modified the Jason’s code as per my needs. The only thing i have problem is in this line.

wp_redirect(apply_filters('login_redirect', get_bloginfo('url') . '/my-account/','',$user)));

Can you tell me what is the filter name i should apply in wp_redirect. ?
Ps: I really love s2member plugin. I’m not asking any custom coding here. I’m just asking the filter name.
Thanks

Posted: Tuesday Mar 27th, 2012 at 11:24 am #9234

Hello Jason,
Thank you very much.

But i still don’t understand. this is the code i’m using. Please correct me if i’m wrong.

This is my s2-hacks.php code

add_filter("ws_plugin__s2member_login_redirect", "redirect_password_login_redirect", 10, 2);
function redirect_password_login_redirect($redirect, $vars = array('user' => null)) {

    if( isset($user->ID) ) {
        $changed_password = get_metadata("user", $user->ID, "changed_password",true);
        if( $changed_password != true ) {
            return get_bloginfo('url') . "/change-password/";
        } else {
            return $redirect;
        }
    }
}

In functions.php i have function like this

// Log In User
function log_in_user($username, $password) {
	
	// Get the user based on the username from the POST
	$user = parse_user($username);

	// Remove html tags from the title and content fields
	$username_stripped = strip_tags($username);
	$password_stripped = strip_tags($password);
	
	// Validate the Form Data
	if(isEmptyString($username_stripped)) return new WP_Error('forgot_username', 'You forgot to enter your Username');
	if(isEmptyString($password_stripped)) return new WP_Error('incorrect_password', "You forgot to enter your Password.");
	if(!wp_check_password( $password_stripped, $user->user_pass ) ) return new WP_Error('incorrect_password', "You seem to have entered a wrong password.");
	
	wp_set_auth_cookie($user->ID, $remember);
	wp_login($username_stripped, $password_stripped);
	wp_redirect(apply_filters('ws_plugin__s2member_login_redirect', get_bloginfo('url') . '/my-account/', $user));
    exit;
	
}

Its supposed to redirect me to change-password page. Instead it still redirect me to my-account page.

Am i applying filter incorrectly? Thanks

Posted: Friday Mar 9th, 2012 at 4:57 pm #7779

Ok i solved it by myself by using code like this

if (current_user_can("access_s2member_level1")){ 
           echo $content; 
            }
         else {
        echo apply_filters('hide_content',$content);
         }

Now can anyone tell me what is the function to check s2member installed?

I mean i don’t want my page throw errors

So i want code like this

if (s2member available) {
use this code
} else {
use this code
}

Thanks

Posted: Friday Feb 17th, 2012 at 5:21 pm #5530

Ok thanks

Posted: Sunday Feb 12th, 2012 at 5:44 pm #4913

I got it. Thanks david :)

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

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.