CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • civicrm_membership_contact_get params
Pages: [1]

Author Topic: civicrm_membership_contact_get params  (Read 1111 times)

mhenning

  • Guest
civicrm_membership_contact_get params
April 29, 2010, 03:21:02 pm
Hi,

I am using 3.0.3 and I don't get why I can't pass a membership_type_id in as a param to the civicrm_membership_contact_get() function (in api/v2/MembershipContact.php).  Looks like it only is looking at contact_id and active_only. 

On line 149 if you replace this:
    $membership       = array('contact_id' => $contactID);
with
    $membership       = $params;

then it will take the membership_type_id that is passed in as a param.

Is this a bug?

And should this function be on the API Documentation page? http://wiki.civicrm.org/confluence/display/CRMDOC/Membership+APIs

Looks like civicrm_contact_memberships_get has been deprecated.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: civicrm_membership_contact_get params
April 29, 2010, 07:34:16 pm

1. yes it is a bug and should be fixed. can you please file an issue and link to this forum topic. we will fix for 3.2

2. would be great if you can also update the API docs for this

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: civicrm_membership_contact_get params
May 04, 2010, 10:51:45 pm
filed issue is here : http://issues.civicrm.org/jira/browse/CRM-6197

kiran
You Are Designed To Choose... Defined By Choice.

mhenning

  • Guest
Re: civicrm_membership_contact_get params
May 04, 2010, 11:45:40 pm
Thanks Kiran,

One suggestion would be to change the v2/Membership.php from

function civicrm_contact_memberships_get(&$contactID)
{
    return civicrm_membership_contact_get($contactID);
}

to

function civicrm_contact_memberships_get(&$contactID)
{
    return civicrm_membership_contact_get(array("contact_id" => $contactID));
}

and then you wouldn't have to handle this special case in the civicrm_membership_contact_get() function.

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: civicrm_membership_contact_get params
May 05, 2010, 12:15:03 am
Ya, it is good to have less conditions in function.
But at this stage I don't think we change params format for civicrm_membership_contact_get();

since there might be some cases where third party code expecting it as single contact id as parameter
and in some other cases it may be an array, so to be on safe side we should carry both formats for now.

We'll going to consider in next version or so.

thanks

kiran
You Are Designed To Choose... Defined By Choice.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • civicrm_membership_contact_get params

This forum was archived on 2017-11-26.