Skip to content
Snippets Groups Projects
Commit 19a6c523 authored by Tim Otten's avatar Tim Otten
Browse files

Merge pull request #1148 from davecivicrm/CRM-12499b

CRM-12499 Modify cms to WordPress translatePermission to make cms:admini...
parents fff90e6e 88da51c2
No related branches found
No related tags found
No related merge requests found
......@@ -345,6 +345,7 @@ class CRM_Contact_Page_View extends CRM_Core_Page {
$config = CRM_Core_Config::singleton();
$session = CRM_Core_Session::singleton();
$uid = CRM_Core_BAO_UFMatch::getUFId($cid);
$userRecordUrl = NULL;
if ($uid) {
if ($config->userSystem->is_drupal == '1' &&
($session->get('userID') == $cid || CRM_Core_Permission::checkAnyPerm(array('cms:administer users', 'cms:view user account')))
......@@ -361,8 +362,11 @@ class CRM_Contact_Page_View extends CRM_Core_Page {
$userRecordUrl = $config->userFrameworkBaseURL . "index.php?option=com_admin&view=profile&layout=edit&id=" . $uid;
}
}
else {
$userRecordUrl = NULL;
// For WordPress, provide link to user profile is contact belongs to logged in user OR user has administrator role
elseif ($config->userFramework == 'WordPress' &&
($session->get('userID') == $cid || CRM_Core_Permission::checkAnyPerm(array('cms:administer users')))
) {
$userRecordUrl = $config->userFrameworkBaseURL . "wp-admin/user-edit.php?user_id=" . $uid;
}
$obj->assign('userRecordUrl', $userRecordUrl);
$obj->assign('userRecordId', $uid);
......
......@@ -46,8 +46,9 @@ class CRM_Core_Permission_WordPress extends CRM_Core_Permission_Base {
* @access public
*/
function check($str) {
// Generic cms 'administer users' role tranlates to 'administrator' WordPress role
$str = $this->translatePermission($str, 'WordPress', array(
'view user account' => 'administrator',
'administer users' => 'administrator',
));
if ($str == CRM_Core_Permission::ALWAYS_DENY_PERMISSION) {
return FALSE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment