Support

Home Forums Event Espresso Premium Show Payment Methods to Specific Usergroup

Show Payment Methods to Specific Usergroup

Posted: September 10, 2019 at 10:52 pm


jdbell1994

September 10, 2019 at 10:52 pm

Hello,

I have a specific usergroup I would like to show Both the invoice and stripe payment method. Another usergroup I only want to show the stripe payment method. The usergroups have the same abilities, I would like a way to hide payment methods by usergroup that the user is assigned to.

Any help would be greatly appreciated. I have been trying to use the methods talked about on this post linked here but I keep getting a fatal error and the site goes down.


Tony

  • Support Staff

September 11, 2019 at 4:26 am

Hi there,

The thread you linked to provides all the details you need to get this working so I’m not sure what else we can add here.

If you’d like to upload the code you are using to Pastebin and put the link here I’ll take a look over it and see if anything stands out.

We generally don’t review custom code and advise you contact a developer to build it out for you as we don’t support customizations but I’ll take a quick look.


jdbell1994

September 11, 2019 at 11:09 am

Thank you Tony for the help. It is extremely helpful and extremely appreciated. This is the last function we need to have the site doing all we need. Here is the code using pastebin. I’m not sure what I am doing wrong. I have put it in a custom plugin with all other functions.


Tony

  • Support Staff

September 11, 2019 at 3:17 pm

On line 20, there is a missing )

This } elseif ( current_user_can( 'individuals' ) {

Should be: } elseif ( current_user_can( 'individuals' ) ) {

That will be why you’re getting a fatal error.


jdbell1994

September 11, 2019 at 4:10 pm

Thank you so much! It is filtering, the only hiccup is when I switch between accounts of different user groups to see the filtering in action I have to refresh the payment page and then it removes the invoice payment method for members of the individual usergroup and doesn’t show up again when I try to register for other events. I’m sure this has to do with the fact that I’m switching accounts in the same session and that for users who only login as there usergroup it would filter normally?

Thank you for looking at the code, amazing that one ) will break everything.


jdbell1994

September 11, 2019 at 5:35 pm

On further investigation no matter what I do in terms of the device or session the invoice payment method still loads as an option when you select “proceed to payment” during registration. If you refresh the payment page then it is removed but if the page is not refreshed it is still a viable payment method and processes the registration if selected. Any suggestions?


Tony

  • Support Staff

September 12, 2019 at 2:58 am

When you switch accounts are your starting a new registration with each account?

Test a registration with User type A, then visit the /registration-cancelled/ page.

Now switch user accounts and test another registration.

Or test one account type in a normal Chrome window and another in an incognito window, on the incognito window log in as the other user account, not as admin and switching over.

The support post ‘Show Payment Methods to Specific Usergroup’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso