GPL contributers wanted for premium users project


I would like to work with the community to achieve a plugin that seems to be needed for a big part of the community and where no good up to date and efficient alternatives are available for at the moment.

We have 2 very good frameworks atm to make our work very easy.
First we have Arck's Roles framework.
Secondly we have Mark Hardings Payment framework.

It should be fairly easy to develop a premium user plugin that let's users subscribe and pay via the Elgg Pay plugin and let their role to be set by the Roles framework.

What do we need?


  • Give admins the option to configure plans, a price per time (ex. 20$ a moth, or 100$ a year) and make the plans they want.
  • Give admin the option to couple this plan to a specific role (configured by the Roles framework)
  • Upon subscription a relation would have to be set-up with the metadata set to the time their subscription would expire, so we can check the 'time_created' and 'time_expire'.
  • Crons would have to be runned on a admin configured interval to see which users are expiring soon.
  • Notifications would have to be sent (ex. 1 week before the end of the subscription).
  • When payment is succesfuly done, the new role have to be set
  • When the relation expires the role have to be unset back to the default role.
  • Admins would have to be able to run this in sandbox mode
  • Paypal used as gateway (to start with) because of it's easy API.


  • A user should have to ability to select a plan and just pay, their role will be set automaticly upon succesful payment nothing more should be done by the user.
  • They would have to get a welcome notification and/or mail * system message that they are a premium user now.
  • They need to have a "payment history" page with a link to their invoice (preferably in PDF).

About the plugin

I would like to donate this plugin to the community when it's ready with a requirement for the roles plugin, as an addon, we could maybe inplement the payment plugin and use it as the base for this plugin, so the only requirements would be Elgg 1.8/1.9 and the Roles Framework.

I am willing to spend a big amount of my sparetime on this.
Although I'm not the greatest coder yet, I learn fast and I am starting to have a good understandig of Elgg.
I'm a profesional Graphic Designer, so I could definately help with the UI of this plugin.
I will code and bugix as much as I can.

I've forked Mark Hardings Elgg Pay plugin on Github, who is with me?
If nobody helps me, I will do it on myself, but it's gonna take a while and some "help needed" topics ;-)

Thanks, Dries

  • add other payments gateway i.e.......payza......not all countrys is supported by paypal

    i am in

  • Ok, this went better then expected, I have a full working payment system which charges the user.

    After payment there is an object with the subtype 'pay' with all the metadata I want (expirationdate,if the payment is complete or pending,what the amount was, what the plan was he/she bought,...)

    Now my question is how I use the most efficient way of checking wheter the user can have the pro_role or not.

    Is it ok if I just put a little snippit of code in the startfile doing this:
    if the user is not a pro_role (so default_role), then check if there is an object with the subtype pay, the owner_guid = logged_in_user_guid and has metadata: 'status=payment_completed', if there is, set it's role to 'pro_user', else, (this means the role is already pro_user, check if the object with subtype 'pay' is there with the right metadata, if it isn't, set role back to default, if it is, do nothing.

    Later I want to let a cron check once a day if there are any expirationdates expired, and let it remove the object if it is. So next time the user load a page on my site my script above will check if he is a pro_user, seems like he is so I check the desired object, but that doesn't seem to be there anymore, so it makes the user back to default.

    I am pretty new at this, so I'd like to hear from somebody who knows better if this is the right and most efficient approach. I appreciate any thoughts

    @moneya: Later, I want to make it work with paypal first before I start adding gateways. But since you're in, you could maybe check out the pay plugin code and see if you can take care of extra gateways.


  • It's probably more effective if I just check if the object is there, where the owner_guid is the same as the logged in user guid, if it is, then check the users role, and set it to pro when it's default, else, do nothing! much simpler :-)

  • please whats the github link i could add other payment gate way i.e mobile and payza etc

  • i think this is the real deal , where the owner_guid is the same as the logged in user guid, if it is, then check the users role, and set it to pro when it's default

  • Well, change of method...

    I got a fully working system now working with both the Elgg pay plugin and the roles framework.
    The method is:

    • Whenever a user buy's a 'pro membersip' with the pay plugin I added a piece of code to the callback then when it's payment is complete, it changes it's role into 'PRO'.
    • The second thing I did was to add an expiration-metadata field to the pay object (this object is made with the user as owner and has some metadata about his purchase)
      The expirationdate metadata is a timestamp (+12 months in this case).
    • One of the other metadatafields of the pay object is 'status' where the value is now 'complete' (before the payment is done, it's 'awaiting payment' and it changes to complete when the paypal callback is triggered.
    • I have a working rolechanging purchasing system now, but I needed to set the users back to the default role when their expirationdate is expired, so I wrote a piece of code that needs to be ran as a cron every day at midnight.
    • This code gets all the pay objects and checks their expirationdate, if it is lower then the current time, it set's the 'status' metadata of the object from 'complete' to 'expired' and it takes the owners entity and changes their role back to 'default'. Below the code that needs to be executed every night to set expired users back to default:

    	$now = time();
    	$entities = elgg_get_entities(array(
    	foreach ($entities as $entity) {
    			if (($entity->expirationdate < $now) && ($entity->status != 'Expired'))   {
    				$entity->status = 'Expired';
    				$owners = $entity->owner_guid;
    				$expiredentities = get_entity($owners);
    				$role = roles_get_role_by_name('default');
    • Next thing to add to this cron is to send a notification or a mail to each user who just got turned back to the default rule with a link to the page where they can subscribe for a year again.
    • Another thing to do is to write a small piece to run as a cron as well that just checks if the current time is a week before the expirationdate and send the users a mail that they will expire in a week and should pay if they still want their pro account.


    So, thats what I've done so far.

    It's far from ready, but I'll post what I have as soon as possible on github.
    It's not yet userfriendly as a plugin, I'm still reading and learning elgg's in and outs, so it's gonna take some time before I can make this into a very userfriendly plugin, but I will do it eventually.

    For now I will incorporate the modified pay plugin to work only for this purpose, and nothing else, and rewrite/rename and remove all functions that need to.
    It will depend on the roles framework of course.

    Anyone who has advice, or sees something I shouldnt really do, please shout.

  • That code will cause out of memory issues when you get enough entities.  You should use ElggBatch

  • Allright, thank a lot for mentioning. 

    Ill look into it. Elgg is one great adventure ;-)