Redirect membership pop up button, skip membership pop up

Hello everyone,

I want to make a couple of adjustments and I don’t know how to do it, I would really appreciate if someone can help me.

I want to make a site with only a membership plan for users, where by paying for the membership plan you will be able to contact the providers by messages. This is basically it.

The problems I face:

1- I want users who want to buy the membership not to have to register with the login pop-up, but when they click send message or reveal some attribute, they go directly to the membership plan page and buy it from there , without going through the pop up. Or it would also work for me to be able to redirect them from the pop up to the checkout of the product associated with the membership. I think either way would work.

That is, I want when I click send message or reply to the listing to send me directly to the page of my membership plan. or the other way is to be able to edit the membership pop up and be able to redirect that button to the associated product directly.

2- Is it possible that when purchasing a membership I will be redirected to the list where I clicked to contact?

3- I wanted providers to be able to reply to messages but obviously not be able to send them to any other provider without paying membership, this is extremely important for my site, however I think I have a workaround for this, hide the Send Messages button for the site’s only one. contributor role using CSS and small PHP snippet, I think this will help in the meantime, although it is a very rustic and limited solution. If you have anything in mind to improve this, I would appreciate your help.

4- How to insert a shortcode in the messages tab of the user account?

I will respond to this post with the temporary solution that I implemented for this third point. Please help me resolve the first 2 points.

Thank you very much for the help, please keep in mind that I know almost nothing about coding.

I will be very attentive!

Here I leave my solution so that providers cannot send messages but only receive them and obviously answer them. It is a very, very rustic and poorly designed solution but maybe it can help someone, of course if the administrators have a better solution I will delete this post.

The filter to be able to hide elements by roles:

function add_role_class_to_body($classes) {
    $user_roles = wp_get_current_user()->roles;
    foreach ($user_roles as $role) {
        $classes[] = $role;
    return $classes;
add_filter('body_class', 'add_role_class_to_body');

and the css to hide the send message button for suppliers and also the message icon:

body.contributor .hp-listing__action 
body.contributor .fa-comment
body.contributor .hp-vendor__action


Thank you for publishing the solution. Unfortunately, there is no simple solution for the other two questions, it would require detailed testing and custom implementation, as it changes the logic of this extension completely.