Hi,
before I reply to previous post
Do you have any experience with membership pro for this kind of functionality?
Yes, we use payplan but you can try with akeeba subscriptions (it's free, but not supported)
It's not a problem for me to some little coding myself. Easy Profile have hidden (for now,we have to write docs) API to implement plugins.
I will explain with an example for your usecase:
-
Download our skeleton plugin (at
https://www.easy-profile.com/docs/44-triggers.html) from our docs and
install it
-
Remove these functions triggerFieldAvatarUpdate, triggerProfileUpdate
- Add this code
public function renderPlugin()
{
if(JRequest::getVar('view',false)=='beforepay')
{
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php'); // Load Helper
$user=JsnHelper::getUser(); // retrieve easyprofile user object - might be useful
// ADD THE CODE - BEFORE PAY (FROM YOUR PAYMENT METHOD API)
// YOU CAN STORE THE PAYMENT DATA IN SESSION,DB or FILE
// SET REDIRECT FOR YOUR PAYMENT TO index.php?option=com_jsn&view=afterpay
$app=JFactory::getApplication();
$app->redirect('your api link'); // Redirect to payment gateway or some confirmation page
return;
}
if(JRequest::getVar('view',false)=='afterpay')
{
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php'); // Load Helper
$user=JsnHelper::getUser(); // retrieve easyprofile user object - might be useful
// ADD THE CODE - BEFORE PAY
// CHECK PAYMENT - SEND EMAILS TO ADMIN AND CUSTOMER
// SET VARIABLE $payment_ok
if($payment_ok){
JUserHelper::addUserToGroup($user->id,usergroup_id); // add to group - replace usergroup_id with valid id
$app=JFactory::getApplication();
$app->redirect('your api link'); // Redirect to thankyou page
return;
}
else{
$app=JFactory::getApplication();
$app->redirect('your api link'); // Redirect to error page
return;
}
}
}
renderPlugin function replace Easy Profile data with what you want!
In your page add a link to Payment - link is index.php?option=com_jsn&view=beforepay
We have not tested this code, is only for example!!
Second Question
You can add some other control (where clause) on query to render categories based on usergroup or accesslevel.
You can create various accesslevel and set in categories. You can check if user can see with this function
$user=JFactory::getUser();
$userAccess=$user->getAuthorisedViewLevels();
in where clause you can add
'WHERE access IN ('.implode(',',$userAccess).')'