SkyRanger Posted June 28, 2019 Share Posted June 28, 2019 Trying to block access to a page unless they logged in user has the proper capability ie: kudos global $userdata; wp_get_current_user(); if ( current_user_can('kudos') ) { echo "kudo add form here"; } else { echo "You can not be here"; } Quote Link to comment https://forums.phpfreaks.com/topic/308904-access-based-on-cap/ Share on other sites More sharing options...
requinix Posted June 28, 2019 Share Posted June 28, 2019 Okay? Quote Link to comment https://forums.phpfreaks.com/topic/308904-access-based-on-cap/#findComment-1567984 Share on other sites More sharing options...
SkyRanger Posted June 28, 2019 Author Share Posted June 28, 2019 Sorry requinix. Forgot to add the result of that. I get "You can not be here" for all roles. Quote Link to comment https://forums.phpfreaks.com/topic/308904-access-based-on-cap/#findComment-1567985 Share on other sites More sharing options...
SkyRanger Posted June 29, 2019 Author Share Posted June 29, 2019 Found the issue. Might have helped if I actually enabled the capability on the role for it to work. Quote Link to comment https://forums.phpfreaks.com/topic/308904-access-based-on-cap/#findComment-1568019 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.