Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Andreas W. 12 months ago.

Assisted by: Andreas W..

Author Posts
October 3, 2023 at 11:48 am #14504099

christopheV-4

Hello

I'm trying to add all wpml capabilities for a custom created 'Superadmin' role in wordpress.

I tried to do it with the 'user_role_editor' plugin. (attachement '1_user_role_editor.png')

And also tried do do it manually with following code:

function base_add_superadmin_role() {
add_role( 'super_admin', __( 'Superadmin' ), get_role( 'administrator' )->capabilities );
$role = get_role( 'super_admin' );
$role->add_cap( 'wpml_manage_translation_management' );
$role->add_cap( 'wpml_manage_languages' );
$role->add_cap( 'wpml_manage_theme_and_plugin_localization' );
$role->add_cap( 'wpml_manage_support' );
$role->add_cap( 'wpml_manage_woocommerce_multilingual' );
$role->add_cap( 'wpml_operate_woocommerce_multilingual' );
$role->add_cap( 'wpml_manage_media_translation' );
$role->add_cap( 'wpml_manage_navigation' );
$role->add_cap( 'wpml_manage_sticky_links' );
$role->add_cap( 'wpml_manage_string_translation' );
$role->add_cap( 'wpml_manage_translation_analytics' );
$role->add_cap( 'wpml_manage_wp_menus_sync' );
$role->add_cap( 'wpml_manage_taxonomy_translation' );
$role->add_cap( 'wpml_manage_troubleshooting' );
$role->add_cap( 'wpml_manage_translation_options' );
}
}
add_action( 'admin_init', 'base_add_superadmin_role');

Problem: the changes above doesn't seem to take affect:
For an 'administrator' I can see the tabs: dashboard, translators, tools, jobs. (see attachment '2_administrator.pg')

But for the 'superadmin' user I only get the tab 'tools'. (see attachement '3_superadmin.png')

Can someone point me in the right direction?

Thanks in advance.

3_superadmin.png
2_administrator.png
1_user_role_editor.png
October 3, 2023 at 1:03 pm #14504919

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Apart from the WPML capabilities the use should have the admin capabilities "manage_options" as well as the ability to edit, publish, and delete posts, pages, and custom post types, including their drafts.

If this will not solve the issue, please let me know.

Best regards
Andreas

October 9, 2023 at 3:30 pm #14541263

christopheV-4

Thanks Andreas, this resolved the issue!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.