FAQ: Paid Memberships or Subscriptions in Joomla!So when Joomla! first started as the no-named CMS, I started a thread asking anyone if there was any good open-source or inexpensive solutions for paid memberships within Joomla! I did not know at the time that my thread would become one of the most read threads in the forums and have as much feedback as it did.
This thread has spawned many good hacks for other components to try to fit the bill, and other developers have also started their own ‘add-ons’ to try to fill the void of a paid memberships solution for our favorite CMS. Unfortunately, there is still much to do before we have a good open-source solution. This only leaves us to turn to commercial components to help us get paid memberships on our own Web sites. If you would like to take your chance with hacking and setting up some of the open-source components that our Joomla! community has offered, then that information will be listed here too.
Contents:Section 1: Open Source Components/Add-ons and Hacks
a: Components & Add-ons
b: Hacks
Section 2: Commercial Components
So let us get started...
1. Open Source Components and HacksIt seems that since our community is so in need of paid memberships or subscriptions on their Web site, we would have already been presented with a good, stable component that would do the trick. Now I am only a web designer, not a coder, but since we do not, it has lead me to believe that messing with Joomla! ACL’s, or moving users to the correct tables in the database must be a hard thing to do. But than I began to understand from the many, many posts that no one has the same needs. There are many of us in the community that only want simple paid membership options, while others want integration with
Community Builder,
VirtueMart, other bridges, and the list goes on. Some of us would be willing to use
PayPal, others want a payment module for every company that offers a merchant account. No one wants the same thing. Some people still want to offer free memberships, while others want their Web site to have only paid memberships. The list goes on. So now I have come to the conclusion that anyone who would be brave enough to code a solution for our paid membership wishes would have to make it a full-time job, which in turn would keep many people from picking this project up and offering it back to the community for free.
What do we have now?
a. Components and Add-onsAccount Expiration Control ComponentAutomatically expires user accounts after a certain time period.
Found at:http://mamboforge.net/frs/?group_id=425 or
http://mamboforge.net/projects/accountexp/ (You can find earlier versions for hacking here.)
Also found at:http://forge.joomla.org/sf/projects/accountexp New Version 0.6 - Does not seem to work with Joomla 1.0.7. Works fine with 1.0.4. I am not sure if any hacks were ever added to this version. Does not seem to be CB RC2 compatible.
http://www.sounerd.com.br/index.php?opt ... &Itemid=46(The developer does not seem to be active at SouNerd anymore)
Pros:Has the PayPal IPN already integrated into the component. With a little knowledge of PHP, you could probably customize this into any paid-membership solution that you need as long as you want to use PayPal. However I don’t have PHP knowledge. The developer has also released a newer version than what will be discussed in this FAQ, showing that it is not a dead project.
Cons:Works well for a members-only site. There have been a couple hacks made to allow for a two-day trial period, but for the most part, without customization, you cannot have free memberships and paid memberships. In fact, there have been a lot of hacks posted, of which a few will be included in this FAQ, to get this component working for our basic needs. You also have to still do a lot of manual moving of users to different tables. For a fully automated solution, this is not it. For a well monitored Web site, this may work well with simple subscriptions.
JBridgeThis is one of the Joomla! add-ons created because of the communities high demand for a paid membership solution. However, it is not a component yet and integrates other components as well, such as
VirtueMart,
Community Builder 1.0 RC2,
JACLPlus,
Docman, and for some reason,
User Home Pages.
Found at:http://www.joomlapalooza.com/Pros:A new project dedicated to making paid memberships possible. It integrates VirtueMart and Community Builder, which many users have requested. The documentation at this point is better written than most other components out there (most do not even have documentation). The developer also seems very knowledgeable about PHP and knows what he is doing.
Cons:You must have VirtueMart installed. I believe all the other components are optional, but ViruteMart is a must. If you didn’t want to use a shop for your Web site, this could be a problem. The Jbridge ‘package’ is for manual installation; that means it is not distributed as a component and cannot be installed using the Joomla! installer. Also, the developer seems to be very busy, so if you have support questions that need an answer and if you are waiting for new releases, then you will need patience. Of course, like all other developers that create free components for Joomla!, he has a day job! But he seems to be unavailable most of the time.
That’s it? Yep, sorry to tell you, that is all we have regarding free add-ons specifically for paid subscriptions.
b. HacksHere are some account expiration hacks that have come to my attention. Other members of the community created these hacks. Some of these hacks are old, and many components have been updated since then. The Account Expiration Control Component has been updated to version 0.6. I am unsure of whether any of these hacks were added. Also, for those trying to integrate Community Builder, these hacks are for CB RC1. As far as I know, they will not work with CB RC2. Try at your own risk.
Account Expiration Control Component v0.3 HacksCommunity Builder IntegrationThe hack can be found here:
http://www.mambojoe.com/index.php?optio ... =2&id=6719Exclusion List IssueThe Acct Exp Component has had issues with putting users in an exclusion list keeping users blocked even after payment. This fixes that issue. This was mentioned to be fixed in the 0.6 version.
This is for the acctexp.php file found by going to components/com_acctexp/acctexp.php
Find the following information:
Code:
}
$row->checking();
$name = $row->name;
$email = $row->email;
$username = $row->username;
$userid = $row->id;
$registerDate = $row->registerDate; // For use on expiration date
and add:
Code:
// funkymunky hack**************************************
$database->setQuery( "INSERT INTO #__acctexp SET userid=$userid, expiration=DATE_ADD('$registerDate', INTERVAL $cfg->initialexp DAY)" );
$database->query();
//end of funkymunky hack ************************************************
Renew Linkfunkymunky wrote:
Your gona need to change 3 files
login.validate.php can be found in the administrator/components/com_acctexp/includes
acctexp.php can be found in /components/com_acctexp
acctexp.html.php can be found in /components/com_acctexp
in
login.validate.phpreplace the mosredirect line with
Code:
mosRedirect( "index.php?option=com_acctexp&item_number=".$usr->id."&user=" . $username . "&expiration=" . strftime(_ACCT_DATE_FORMAT, $expstamp));
this is adding a user id to the link so it can be used within the paypal payment function
in
acctexp.html.phpadd $userid to the function
Code:
function expired($option, $user, $expiration,$userid)
under the following table row
Code:
<tr>
<td align="center">
<?php echo _EXPIRED . $expiration; ?>
</td>
</tr>
add this row
Code:
<tr>
<td align="center">
<a href="index.php?option=com_acctexp&user=<?php echo $user;?>&item_number=<?php echo $userid;?>&task=updatesub">Renew Subscription</a>
</td>
</tr>
The userid is required in the function in order for it be placed into the link in the table row
The above hack creates the renew subscription link.
The link contains a
item number which is the
user id and Ive added to the task variable a
updatesub value.
This task variable will tell the next page to display the payment function.
Also i have added the
user name. this will be required in the paypal function
in
acctexp.phpbelow the following line
Code:
$expiration = trim( mosGetParam( $_REQUEST, 'expiration', '' ) );
add this
Code:
$idfromlogin = trim( mosGetParam( $_REQUEST, 'item_number', '' ) );
if (empty($idfromlogin ))
{
global $my;
$userid = ($my->id);
}
else
{
$userid =$idfromlogin;
$name=$user;
}
bit further on down is a case statement add this any where in it
Code:
case "updatesub":
payForm( $option,$userid, $username, $name);
break;
just before the case statement finishes
replace the default
Code:
default:
expired($option, $user, $expiration);
break;
with
Code:
default:
expired($option, $user, $expiration,$userid);
break;
just under the case statement is function called expired
Code:
function expired($option, $user, $expiration) {
HTML_frontEnd::expired($option, $user, $expiration);
}
replace this with
Code:
function expired($option, $user, $expiration,$userid) {
HTML_frontEnd::expired($option, $user, $expiration,$userid);
}
You are just adding in the userid
Upgrade OptionTo allow users to upgrade, Scubaguy posted this hack:
scubaguy wrote:
To give my users the upgrade option I modified the "function expired" in acctexp.html.php and included the payForm function. I also added membership status messages based on the user's Group ID (gid) and for those members that have been excluded. Everyone else will have their current expiration date displayed or the Expired message. I then linked to the the page using "index.php?option=com_acctexp&Itemid=167"
Code:
function expired($option, $user, $expiration) {
global $database, $my;
$query2 = "SELECT expiration FROM #__acctexp WHERE userid=$my->id";
$expiration2 = null;
$database->setQuery( $query2 );
$expiration2 = $database->loadResult();
$query3 = "SELECT gid FROM #__users WHERE id=$my->id";
$expiration3 = null;
$database->setQuery( $query3 );
$gid = $database->loadResult();
?>
<table width="590" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><br><br>
</td>
</tr>
<tr>
<td align="center">
<strong>
<?php if ($expiration2=='' && $gid >= 20) {
echo _EXPIRED_TITLE2;
}
if ($expiration) {
echo _EXPIRED_TITLE;
} ?>
</strong>
</td>
</tr>
<tr>
<td><br><br>
</td>
</tr>
<tr>
<td align="center">
<?php if ($expiration2=='' && $gid >= 20) {
echo _DEAR . $my->username . ",";
}
if ($expiration) {
echo _DEAR . $user . ",";
} ?>
</td>
</tr>
<tr>
<td align="center">
<?php if ($expiration2=='' && $gid >= 20) {
echo _EXPIRED2 . _EXCLUDED;
}
if ($expiration) {
echo _EXPIRED . $expiration;
} ?>
</td>
</tr>
<tr><td>
<?php payForm($option, $userid, $username, $name); ?>
</td></tr>
</table>
<?php
}
There is also some random code posted here by Scubaguy to try to get Free Memberships to work. There were some issues here with it not automatically setting the expiration date for the users. I am posting this for some technically endowed individuals to take a look at to see if they can fix it for whatever use they may need.
http://forum.joomla.org/index.php/topic ... l#msg30700And this list of instructions was posted by Ty2u.com, with the files to download at the bottom of this FAQ.
Ty2u.com wrote:
What to do to get a basic free Joomla paypal subscriptions goingThis should be right but if I have made any errors please let me know.
Download the files attached and then perform the following steps:
1. You should be able to install the com_acctexp.zip as a Joomla component and disregard the hacks it tells you to do.
2. Install the mod_acctexp.zip as a module and publish it instead of your other login module.
3. Backup your joomla.php in your includes dir and rename joomla-acctexp.php.txt to joomla.php and overwrite your old joomla.php.
4. Go to your components menu and into the account expiration -> settings and make sure to enable it and set your options.
I successfully tested this in the paypal sandbox but I have not yet had an expired account until tomorrow so I can see how it works and if it actually disables it. But it worked when signing up, didnt enable the user until it came back from paypal and they clicked their activation link in their email. Thats enough to make money

So it is a basic setup that should work. I dont think it gives you the ability to change them to authors or anything like that.
Thanks for all your wonderful work everyone!!!!!
VirtueMart HacksThese hacks were submitted by users, mainly ChuckTrukk, to allow for membership integration to work with VirtueMart. I have not tested these hacks and I am not sure if they are completed in their entirety. You will have to PM ChuckTrukk if you have any questions.
ChuckTrukk wrote:
How I modified VirtueMart to update a user to "Author" upon payment completion1. A user signs up through Community Builder (regular membership)
2. They are redirected to VirtueMart and see a button that says "Upgrade"
3. I did some the VirtueMart registration read the Community Builder fields - user pays
4. Upon completion, I put this code in home\administrator\com_virtuemart\html\
checkout.thankyou.php:
( somewhere after
_PHPSHOP_THANKYOU_SUCCESS?> )
Code:
// GET USER INFORMATION
$q1 = "UPDATE #__users SET usertype='Author', gid='19' WHERE id='$my->id' ";
$database->setQuery($q1);
$database->query();
//GET ARO ID
$q2 = "SELECT aro_id FROM #__core_acl_aro WHERE value='$my->id' ";
$database->setQuery($q2);
$database->query();
$aro = $database->loadResult();
//$aro = $db->p("aro_id");
//echo "<p>The aro id: -> ";
//echo $aro;
//echo " <-</p>";
//UPDATE ARO ID
$q3 = "UPDATE #__core_acl_groups_aro_map SET group_id='19' WHERE group_id='18' AND aro_id='$aro' ";
$database->setQuery($q3);
$database->query();
//echo "<p>The aro id: -> ";
//echo $aro;
//echo " <-</p>";
//UPDATE USERTYPE IN SESSION
$q4 = "UPDATE #__session SET usertype='Author' WHERE username='$my->username' ";
$database->setQuery($q4);
$database->query();
If you are using Paypal, I believe you can put this in home\administrator\com_virtuemart\
notify.php ( around line 585?) This code below.
Code:
if (eregi ( "VERIFIED", $res)) {
//----------------------------------------------------------------------
// If the payment_status is Completed... Get the password for the product
// from the DB and email it to the customer.
//----------------------------------------------------------------------
if (eregi ("Completed", $payment_status) || eregi ("Pending", $payment_status)) {
Again, my code is probably horrible! I am not a coder, just trying to make due with what our Devs have given us. If there are any coders who can clean this up, please do. This is how I upgraded users to 'Author' (then I used mosif=Member -> show intro. mosif=Author -> show all).
I hope this helps,
Chuck
And last, but not lease, a code to make sure the information added to VirtueMart is created in Community Builder RC1
ChuckTrukk wrote:
This is the code I created to pull info into CB. I expect the coding / implementation to be bad. So if anyone has any code-clean up, please let us know. I have not ported this to VirtueMart yet- so it may need tweaking.
Code:
<!-- This is going to pull the users "first_name" from CB into VirtueMart's "first_name" field-->
<div style="float:left;width:60%;padding-left:10px;">
<input type="text" id="first_name" name="first_name" size="40"
value="<?php
// Query the CB database and assign variable to $firstname
$q = "SELECT * FROM #__comprofiler WHERE id='$my->id' ";
$db->query($q);
$firstname = $db->p("firstname");
// Echo "cb_firstname"
echo $firstname;
?>" class="inputbox" />
</div>