From 1a447f39209c5179fc9e287c091091335522ccca Mon Sep 17 00:00:00 2001 From: JKingsnorth Date: Fri, 3 Jul 2015 11:26:01 +0100 Subject: [PATCH] CRM-16784: Can't 'edit' a Profile with no ID set --- CRM/Profile/Form/Edit.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CRM/Profile/Form/Edit.php b/CRM/Profile/Form/Edit.php index ee114d93d2..2749a0c327 100644 --- a/CRM/Profile/Form/Edit.php +++ b/CRM/Profile/Form/Edit.php @@ -88,6 +88,8 @@ class CRM_Profile_Form_Edit extends CRM_Profile_Form { // make sure we have right permission to edit this user $session = CRM_Core_Session::singleton(); $userID = $session->get('userID'); + + // Set the ID from the query string, otherwise default to the current user $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, $userID); if ($id) { @@ -106,6 +108,12 @@ class CRM_Profile_Form_Edit extends CRM_Profile_Form { $this->_isPermissionedChecksum = TRUE; } } + + // CRM-16784: If there is no ID then this can't be an 'edit' + else { + CRM_Core_Error::fatal(ts('No user/contact ID was specified, so the Profile cannot be used in edit mode.')); + } + } parent::preProcess(); -- 2.25.1