Funky Custom Capabilities issue

I have a user with these custom capabilities defined:

groucho,201910,202001

I’m trying to send the user to a welcome page based on custom capabilities:

https://comedytradeschool.com/%%current_user_ccaps%%-login

So he should end up on this page:

https://comedytradeschool.com/202001-login/

But when I login I get sent to:

https://comedytradeschool.com/groucho-201910-202001-login

I tried configuring the user’s custom capabilities with spaces after the commas but they get replaced with underscores:

groucho,_201910,_202001

I tried delimiting the ccaps with hyphens but any non alphanumeric character gets replaced with an underscore. This only happens in the Custom Capabilities field on the edit user page.

I’m really puzzled by this. Thanks.

Hi Rob.

That replacement code gives all the user’s ccaps, not just one. “%%current_user_ccaps%% = The current User’s Custom Capabilities.”

And the underscores are used because it goes in a URL.

I think you’ll have an easier time, and better control, if instead you use a single Login Welcome Page, and change the content in it using conditionals. https://s2member.com/kb-article/s2if-simple-shortcode-conditionals/

Would that work for you? :slight_smile:

I need to have a specific ccap land on a specific welcome page. The page is too complicated to use content shortcodes to show to each group in the ccap. I’ll have to come up with a different solution. Thanks.

You could use a condition for the redirection on the page. Instead of showing different content blocks, you can create a custom redirection. E.g. (not tested)

[s2If current_user_can(access_s2member_ccap_groucho)]
<script>window.location.replace("https://comedytradeschool.com/groucho-login/");</script>
[/s2If]

:slight_smile: