$status_id = 2; $statuses = CRM_Core_PseudoConstant::get('CRM_Contact_BAO_Contact', 'contact_status'); $status_label = CRM_Core_PseudoConstant::getKey($statuses, $status_id); echo $status_label;
$member_type_id = 4; $member_types = CRM_Core_PseudoConstant::get('CRM_Member_BAO_MembershipType', 'member_type'); $member_type_name = CRM_Core_PseudoConstant::getKey($member_types, $member_type_id); echo $member_type_name;This code will retrieve the name of a membership type with the ID of 4. It uses the CRM_Core_PseudoConstant get function to retrieve a list of membership types, and then uses the getKey function to get the name of the membership type with an ID of 4. Package library: CiviCRM