Get Plan name in other component

  • Filipe
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 8 months ago #66969 by Filipe
Get Plan name in other component was created by Filipe
Hi there,

How can I get the Subscription Plan Name to show in Easy Profile page of each user?


Thanks!

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #66973 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Get Plan name in other component
You will need to write code to get that data as we don't have any API for that task. Also, what will you show if subscriber sign up for more than one plans ?

Tuan

Please Log in or Create an account to join the conversation.

  • Filipe
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 8 months ago #66979 by Filipe
Replied by Filipe on topic Get Plan name in other component
That's something that I don´t want. Each user only can assign to one plan. How to make it possible?

But even that way, it could diplay the array of plans names.

How can I write that code, that's what help I need...

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #67005 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Get Plan name in other component
Will you just show the title of the plan if the subscription for that plan still active?

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #67006 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Get Plan name in other component
You can try this code:
Code:
require_once JPATH_ROOT.'components/com_osmembership/helper/helper.php'; $userId = JFactory::getUser()->get('id'); // $planIds = OSMembershipHelper::getActiveMembershipPlans(getActiveMembershipPlans); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select(''title') ->from('#__osmembership_plans') ->where('id IN ('.implode(',', $planIds).')') ->order('title'); echo implode(',', $db->loadColumn());

The above code should get active plan titles of the current logged in user. I am not sure if it meets your need. You might have to change $userId to id of the "Easy Profile" being viewed. The code above can be used as a concept how to get plans of a user

Tuan

Please Log in or Create an account to join the conversation.

  • Filipe
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 8 months ago #67054 by Filipe
Replied by Filipe on topic Get Plan name in other component
Hi Tuan,

I get an error with this code...

Can you help me please?

Thanks!

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #67067 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Get Plan name in other component
You can submit a support ticket sending us super admin account of your site. I will check the code and make it works directly on your site for you

Regards,

Tuan

Please Log in or Create an account to join the conversation.