* Extract contact id from url for deleting contact image.
*/
public static function processImage() {
-
$action = CRM_Utils_Request::retrieve('action', 'String');
$cid = CRM_Utils_Request::retrieve('cid', 'Positive');
// retrieve contact id in case of Profile context
$id = CRM_Utils_Request::retrieve('id', 'Positive');
+ $formName = $cid ? 'CRM_Contact_Form_Contact' : 'CRM_Profile_Form_Edit';
$cid = $cid ? $cid : $id;
if ($action & CRM_Core_Action::DELETE) {
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean')) {
+ $controller = new CRM_Core_Controller_Simple($formName, ts('New Contact'), NULL, TRUE, FALSE);
if (!CRM_Contact_BAO_Contact::_checkAccess('Contact', 'update', ['id' => $cid], NULL)) {
CRM_Utils_System::permissionDenied();
}
CRM_Core_Action::DELETE => [
'name' => ts('Delete Contact Image'),
'url' => 'civicrm/contact/image',
- 'qs' => 'reset=1&cid=%%id%%&action=delete',
+ 'qs' => 'reset=1&cid=%%id%%&action=delete&&qfKey=%%key%%',
'extra' => 'onclick = "' . htmlspecialchars("if (confirm($deleteExtra)) this.href+='&confirmed=1'; else return false;") . '"',
],
];
CRM_Core_Action::DELETE,
[
'id' => $this->_contactId,
+ 'key' => $this->controller->_key,
],
ts('more'),
FALSE,
CRM_Core_Action::DELETE => [
'name' => ts('Delete Contact Image'),
'url' => 'civicrm/contact/image',
- 'qs' => 'reset=1&id=%%id%%&gid=%%gid%%&action=delete',
+ 'qs' => 'reset=1&id=%%id%%&gid=%%gid%%&action=delete&qfKey=%%key%%',
'extra' => 'onclick = "' . htmlspecialchars("if (confirm($deleteExtra)) this.href+='&confirmed=1'; else return false;") . '"',
],
];
[
'id' => $form->get('id'),
'gid' => $form->get('gid'),
+ 'key' => $form->controller->_key,
],
ts('more'),
FALSE,