Jump to content

Sub-Account Permissions Hook


zitu4life

Recommended Posts

Hello There

How can we change this hook in way that we could choose wanted 

$permissions = $vars['allPermissions'];

to hide\remove then from the list.

<?php

/**
* Filter SubAccounts Permissions Hook
* @author brian!
*/
 
function subcontacts_permissions_filter_hook($vars)
{
	$permissions = $vars['allPermissions'];
	$disallowed = ['manageproducts','domains'];
	foreach ($permissions as $k => $item) {
		if (in_array($item,$disallowed)) {
			unset($permissions[$k]);
		}
	} 
	return array("allPermissions" => $permissions);
}
add_hook("ClientAreaPageContacts", 1, "subcontacts_permissions_filter_hook");

image.png.5595c12c2955d868337c1672a78d8ec9.png

Also, we have Sub-account Permissions on Admin, same hook can we have a modified hook to work on Admin to. This hook were made by @brian!

regardsSub

Link to comment
Share on other sites

12 hours ago, zitu4life said:

How can we change this hook in way that we could choose wanted to hide\remove then from the list.

by changing the values in the $disallowed array.

$disallowed = ['manageproducts','domains'];

the option values you can changes are listed below..

PvfXYG1.png

12 hours ago, zitu4life said:

Also, we have Sub-account Permissions on Admin, same hook can we have a modified hook to work on Admin to.

no.

Link to comment
Share on other sites

1 hour ago, zitu4life said:

It is supose to work like that but it still do not work, can you try it in your end @brian!

it works for me in v7.7.1 - with the hook disabled...

23olSYY.png

...with it enabled...

8jgPRlj.png

what you might want to try is using the old-fashioned way to declare an array and see if that helps...

$disallowed = array('manageproducts','domains');
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated