From 697255fcb41ecfe866ab29f52e5fd614f8a5607d Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 17 Nov 2014 14:36:53 -0500 Subject: [PATCH] Don't call member button API if settings aren't configured. * memberdashboard.php (memberdashboard_civicrm_post): Make sure API url, user, and password are not empty before making RPC. --- memberdashboard.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/memberdashboard.php b/memberdashboard.php index f84f76f..e650b1b 100644 --- a/memberdashboard.php +++ b/memberdashboard.php @@ -150,11 +150,14 @@ function memberdashboard_civicrm_post($op, $objectName, $objectId, &$objectRef) 'contact_id' => $contactId, 'date' => $joinDate )); - $curl = curl_init(); - curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); - curl_setopt($curl, CURLOPT_USERPWD, "$user:$password"); - curl_setopt($curl, CURLOPT_URL, "$apiUrl?$params"); - curl_exec($curl); + + if(!empty($apiUrl) && !empty($user) && !empty($password)) { + $curl = curl_init(); + curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); + curl_setopt($curl, CURLOPT_USERPWD, "$user:$password"); + curl_setopt($curl, CURLOPT_URL, "$apiUrl?$params"); + curl_exec($curl); + } } $dao->free(); -- 2.25.1