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.

Redirect only certain userroles away from adm

Home Forums Community Forum Redirect only certain userroles away from adm

This topic contains 4 replies, has 2 voices. Last updated by  Cristián Lávaque 3 years, 7 months ago.

Topic Author Topic
Posted: Friday May 24th, 2013 at 11:00 am #50557

Hi! Great Plugin! Sure the best membership ever.

I need to restrict the access to the default wp-admin section and redirect it to a profile page only for certain user roles (not all except admin).
In Member Profile Modifications I set “Redirect Members away from the Default Profile Panel?” to YES, but this forbit to accesso to all wp-admin/… all user roles except the administrator.
If I would forbid all s2members except level 8, how can I do that?

Cheers!

List Of Topic Replies

Viewing 4 replies - 1 through 4 (of 4 total)
Author Replies
Author Replies
Posted: Friday May 24th, 2013 at 10:40 pm #50598

Thanks for the kudos, Marco. :)

About your question, I don’t know how to only redirect some roles. The setting is all or none. I’ll ask Jason if there’s a hook you could use to customize it.

Posted: Sunday May 26th, 2013 at 11:46 pm #50694

This is what Jason replied:

Here is an example hack file. Knowledge Base » Hacking s2Member® Via Hooks/Filters

[hilite pre_code]
has_cap('edit_posts'))
$redirect = FALSE;

else if(defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE)
$redirect = FALSE; // The user's own profile page in the Dashboard.

return $redirect; // MUST return a boolean value here.
}
[/hilite]

Posted: Monday May 27th, 2013 at 12:06 pm #50713

Hi Christian. Great!! This solve my problem. Excellence support for excellent plugin.

I managed to do what I needed, following your suggestion and modyfing the code as follows (if could help somebody in future):

<?php
add_filter('ws_plugin__s2member_admin_lockout', 'my_redirect_filter', 10, 2);
function my_redirect_filter($redirect = TRUE, $vars = array())
    {
        $user = wp_get_current_user();
        if (current_user_can('access_s2member_level3'))
            $redirect = FALSE;
        else if (defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE)
            $redirect = FALSE; // The user's own profile page in the Dashboard.
        return $redirect; // MUST return a boolean value here.
    }
?>

Cheers!
Marco

Posted: Wednesday May 29th, 2013 at 3:16 am #50793

Great! Thanks for the update and the kudos. :)

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

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

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.