If you are using the subscription module then you know this tutorial is for you. It will show you how to use the paid() function to hide parts of your page from non subscribers. You can also use it to hide links, images just about anything.
The first thing is to understand how the function works. The following is a full view of the codes.
Code:if(paid()) {//Show the link, image or other content to subscribers
echo "You are a subscribers";
}else{//Non subscribers will see the following
echo "You are not a subscriber";
}
|
Basically what you are doing is checking to see if the member is a subscriber, they get the "goodies", if not then they get nothing. Let's put this to better use. In the example below we have a link we want hidden from non subscribers. We first check if the member is a subscriber using the paid() function already defined in the mainfile.php
If the member is a subscriber we want them to see the link so we show it in following codes.
Code:if(paid()){ //Check if the member is a subscriber
echo '<a>BestBuildPC</a>'; //Link is shown to subscriber.
}// close the "if" statement
|
Done! You may ask, why didn't I use the else{ part as in the first example. Well you only need the else{ if you want to show something to non subscibers like in the following codes
Code:if(paid()){ //Check if the member is a subscriber
echo '<a>BB</a>'; //Link is shown to subscriber.
}// close the "if" statement
else{ //show something to non subscribers
echo 'You cannot see this because you are a non subscriber'; //This shown to non subscribers
}// Close the "else" statement
|
This should give you a better idea of how to use this important function. You can use it to protect anything on your website.