1. davidunwin
  2. Support
  3. Saturday, January 30 2021, 03:33 PM
We use Membership Pro
https://joomdonation.com/joomla-extensions/membership-pro-joomla-membership-subscription.html
When a user register for Membership Pro, their profile is added to Easy Profile.
Each Membership Pro is allocated a Plan Name and id (see attachment). I want to add that Plan Name or id to a custom field in Easy Profile. I can't see any obvious way to do this. Is there any way to put some code in Easy Profile somewhere to do this(ie an SQL query against the Membership Pro tables)?
Thanks in advance for any help.
Attachments (1)
Accepted Answer
admin Accepted Answer
Admin
Hi,
sorry this is a bit complex. The easiest way is to set manually the plan name, You need to insert this PHP code for each subscription plan so it can be different for each plan
$user->field_alias= 'Premium';
// or
$user->field_alias= 'Basic';
  1. more than a month ago
  2. Support
  3. # Permalink
admin Accepted Answer
Admin
Hi,
I does not know if there is a Membership Pro plugin that update Easy Profile's fields. Anyway I'm sure that after a sbscription is created then Membership Pro allow you to launch a SQL query, so you should be able to update Easy Profile's fields of a specific user.
  1. more than a month ago
  2. Support
  3. # 1
davidunwin Accepted Answer
Content Protected
  1. more than a month ago
  2. Support
  3. # 2
admin Accepted Answer
Admin
Hi,
then you can try to launch a PHP script to update EasyProfile informations.

DOCS:
Membership Pro PHP plugin: https://membershipprodoc.joomservices.com/plugins/script-plugin
Easy Profile UserObject: http://docs.easy-profile.com/index.php/article/jsnuser-object


require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
$user=JsnHelper::getUser($row->user_id); // I assume that the ID of the user is stored into a variable called "user_id" but I'm not sure
$user->field_alias= 'Plan Name'; // Replace "field_alias" with the alias of the Easy Profile's field where you need to store the plan name
$user->save();
  1. more than a month ago
  2. Support
  3. # 3
davidunwin Accepted Answer
Thank you for that.
I will try testing it
  1. more than a month ago
  2. Support
  3. # 4
davidunwin Accepted Answer
Ok I have looked at this solution and I can see how it would work. The user_id field is in the Membership Pro records, no problem. The Membership plan is there also but only the id field is stored in the subscriber table (see screen shot) . We would like to store the Membership Plan Title.

The Membership Plan Title is stored in another table (see second screen shot). We would like to store that in Easy Profile. That means doing a lookup of the membership plan table. I'm afraid that is beyond my very limited PHP coding skills. Is there any chance you could provide some sample coding to do the look up and store the Plan Title in the Easy Profile field?
Thanks in advance.
  1. more than a month ago
  2. Support
  3. # 5
davidunwin Accepted Answer
I can understand it being complex, so thank you for supplying a workaround....much appreciated
  1. more than a month ago
  2. Support
  3. # 6
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.