Greetings Elizabeth,
Offering an unsubscribe button for your members is a good practise, and many members may choose to leave your membership services, and won’t have any hard feelings if you’ve made the process simple and easy to do!
That said, your current system will show the unsubscribe button to everyone, and that isn’t the ideal thing to do. People who are not subscribed may click the button, and be presented with a whole load of errors, or taken to a series of pages that are not relevant to them at all!
This’ll make the user feel as if the site is unreliable and isn’t fit for purpose, which is obviously off putting. The best thing to do is to protect content, and ensure it is displayed to the correct people, and you can do this easily with PHP Else If Conditionals.
Here is a sample code.
<?php if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL >= 1){ ?>
[Place Unsubscribe Button Here]
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 0){ ?>
Some content for Free Subscribers.
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === -1){ ?>
Some public content.
<?php } ?>
Allow me to explain what each part does;
<?php if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL >= 1){ ?>
[Place Unsubscribe Button Here]
This will check with your database, the s2Member Installation and other necessary services to see if the user is able to access s2Member Level 1 or higher (Greater then). If they can, it’ll show certain content.
In this case, you’ll place your button here, so that anyone who is Membership Level 1 (or higher) will see the unsubscribe button.
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 0){ ?>
Some content for Free Subscribers.
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === -1){ ?>
Some public content.
<?php } ?>
Exactly the same as above, it’ll check the systems you have in place, and if the person matches the information, it’ll show the content they’re designed to see.
You could add a WP_Redirect into the Public Content Section so that they’re redirected away from the Welcome Page, or you could have some marketing blurb about joining your membership club.
With the Free Subscribers section, you could do some marketing about why they should join your membership club, along with a button to do so.
Using this system, you’ll be able to target content specifically to people based on their level, along with many other factors, when coded correctly.
I hope this has helped!