-
Author
-
November 17, 2013 at 05:32 #6818adamParticipant
When users reach the homepage and are not logged in they can submit the search form or click on a Groups page, but they are restricted since they are not yet members or signed in. This is good.
However, they get redirected to the Membership Levels page. This is not good because selecting a membership level before registering (being logged in) doesn’t do anything. It’s just an empty step. They will have to select the membership level again after registering.
How do I get it to instead display the restriction message found under WP-Admin->Memberships->Advanced Settings. This one:
Message for Logged-out Users: This content is for !!levels!! members only (etc.)Do I need to edit this code in functions.php to achieve this?
COPY CODEadd_action('kleo_pmro_extra_restriction_before_my_profile','kleo_my_custom_restrict'); function kleo_my_custom_restrict() { //full current url $actual_link = kleo_full_url(); //our request uri $uri = str_replace(untrailingslashit(home_url()),"",$actual_link); //restrict messaging page if(preg_match("/^\/".bp_get_members_root_slug()."\/". bp_get_loggedin_user_username()."\/messages\/?/", $uri)) { $my_restrictions = array('message' => array( //2 - restrict certain levels. 0 -restrict none; 1 - restrict all 'type' => 2, //levels that you apply the restrictions to 'levels' => array(0,1,2,3), 'not_member' => 1, 'guest' => 1 ) ); kleo_check_access('message',$my_restrictions); } }
Note: I want to keep it so that logged-in non-members (or members with restricted memberships) get taken to Membership Levels when they click on something that requires membership since they can easily change their level from there. It’s just not-logged in users I’d like to change.
Thanks! (I’ve been trying to figure this out all night!)
November 17, 2013 at 08:26 #6821moroccanishParticipanti had this orb yoou just go to top of screen memberships/page settings/then change levels page to registration, and thats it
November 17, 2013 at 08:48 #6826adamParticipantunfortunately, that’s not a good fix. users won’t be able to view or select a membership level in that case. it takes newly activated users back to the registration page instead of selecting a membership. thanks though 🙂
November 17, 2013 at 10:26 #6829moroccanishParticipantAh I’ve made my site free till I build a membership base up so I I guess that’s why it works for me
November 19, 2013 at 01:51 #6873SQadminKeymasterYou can add a filter to set your register page with this added to sweetdate-child/functions.php:
COPY CODEadd_filter('kleo_pmpro_url_redirect', 'my_custom_redirect'); function my_custom_redirect() { if (is_user_logged_in()) { return pmpro_url("levels"); } else { return bp_signup_page(); } }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionNovember 19, 2013 at 03:51 #6882adamParticipantthanks – i have a custom registration page though (mysite.com/registration). so would this be the correct code?:
COPY CODE/*PMPro redirect*/ add_filter('kleo_pmpro_url_redirect', 'my_custom_redirect'); function my_custom_redirect() { if (is_user_logged_in()) { return pmpro_url("levels"); } else { return ('/registration'); } }
it seems to load slowly.
November 19, 2013 at 14:37 #6918SQadminKeymasterThat should be the full url http://yourdomain.com/registration
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.