OSMembershipHelper::getActiveMembershipPlans() returning array (0, 1)

  • Robert Gaunt
  • Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 2 months ago #155933 by Robert Gaunt
When calling getActiveMembershipPlans, the returns the following: Array
(
[0] => 0
[1] => 1
)plan_id 0 doesn't exist,
plan_id 1 is valid for this user

Any particular reason for this?

Thanks,
Rob

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

More
1 year 2 months ago #155935 by Tuan Pham Ngoc
Hi Robert

Honestly, that was from long time ago, so I don't remember exactly the reason I have it programmed like that

The first element of the array is always 0, to make sure the returned array always contains at least one element. That is to prevent SQL error when we use that data in SQL command

Regards,

Tuan

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

  • Robert Gaunt
  • Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 2 months ago #155945 by Robert Gaunt
Thanks for the prompt answer Tuan - as always.

I have come across similar things in Joomla - preventing a SQL error sounds about right.

getPlan plan_id=0 just returns $planId=0 anyway (or unset does it for me)

Thanks,
Rob

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