pfaffman
(Jay Pfaffman)
October 3, 2022, 7:55pm
1
I have a client that’s using s2member and wants users who are not at a specific membership level to be redirected to an info page rather than being logged in to Discourse. (Don’t want to have them log in as a member of a cannot-read-a-thing group, they want them not to be logged in at all.)
Looks like the s2member stuff I need is here: Package s2Member\API_Functions ( Functions ) | s2Member Codex
I’m sure that there is a hook in wp-discourse that I can call that does this, but I don’t know where to look to figure out what it is.
Presumably I can find the s2member docs to check whether they are paying, but I’d accept hints on that too!
pfaffman
(Jay Pfaffman)
October 18, 2022, 4:28pm
2
Found it.
add_action( 'wpdc_sso_provider_before_sso_redirect', 'wpdc_custom_check_user_membership', 10, 2 );
function wpdc_custom_check_user_membership( $user_id, $user ) {
$s2member_access_level = get_user_field('s2member_access_level'); # An s2Member Membership Access Level number.
if ( $s2member_access_level < 1 ) {
wp_safe_redirect( 'https://myfishingcapecod.com/members-only-content/' );
exit;
}
}
1 Like
pfaffman
(Jay Pfaffman)
Closed
November 17, 2022, 4:29pm
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.