Home >Backend Development >PHP Tutorial >Detailed explanation of how to add new functions and permission settings in the Ecshop backend
How to add new functions and permission settings in the Ecshop backend? This article mainly introduces the addition of new function columns and management permission settings in the Ecshop backend. Friends in need can refer to it. I hope to be helpful.
1. Add menu items
Open the /admin/includes/inc_menu.php
file (backend frame left menu ), add a line at the end as follows:
$modules['17_other_menu']['sns_list'] = 'sns_list.php?act=list';
There are 16 first-level menu items in ecshop by default, so the example here starts from 17. Of course, this key can be chosen at will. The index.php file uses ksort to sort the menu. "17_other_menu" represents the first-level menu, and "sns_list" represents the second-level menu. The value after the equal sign indicates the page link opened by the menu column.
2. Configure the menu language
Open the /languages/zh_cn/admin/common.php file and add the language
$_LANG['17_other_menu'] = '其它设置'; $_LANG['sns_list'] = 'SNS管理';
At this time, log in to the backend as an administrator (admin user) and you will see the newly added menu items. Because the admin permission is "all". If there are multiple administrators in the backend, such as the suppliers of the ecshop mall, or other managers (other accounts created by the admin that can log in to the backend), if you want them to also have the right to view the newly added menu, you must They assign administrative rights to the column.
3. Add the new menu to the permission list
Open the /languages/zh_cn/admin/priv_action.php file and go to "Permission Management" Add the following code below the "First-level Grouping" comment line
$_LANG['other_manager'] = '其它设置';
The "other_manager" here is the permission name of the first-level column. It is consistent with the column name "17_other_menu", or you can choose a name casually. To show the difference here, it is not the same as the menu name.
Then, add the permission name of the secondary column "sns_list". Just add it at the end of this file
//其它管理 $_LANG['sns_list'] = 'SNS管理';
The permission name here is the same as the secondary menu name. Where are these two items now? As shown below
4. Associate the permissions of the first-level menu and the second-level menu
Ecshop: Add a new column in the background. Open the database, see the {pre}_admin_action table, and add two rows of data. As shown in the screenshot below
, the first column of data in the screenshot is action_id, which is the auto-incrementing primary key of the table. The data in column 2 is parent_id, which comes from the superior action_id. The data in column 3 is the permission name (key) defined in step 3. In this case, the two permissions are linked. At this point, open the "Administrator List" in the background, click the "Assign Permissions" icon, and you can see the permissions shown in step 3. Use a background user to check Submit, and the user will be able to see the new menu items after logging in. \
mysql statement:
INSERT INTO .`admin_action` ( `action_id` , `parent_id` , `action_code` , `relevance` ) VALUES ( NULL , '6', 'shipment_view', '' );
Related recommendations:
Deprecated: preg_replace() error in ECSHOP Solution
How to solve the problem that the verification code image does not appear in ecshop
ecshop Detailed explanation of return value of infinite classification recursive function
The above is the detailed content of Detailed explanation of how to add new functions and permission settings in the Ecshop backend. For more information, please follow other related articles on the PHP Chinese website!