Forum Replies Created
-
AuthorPosts
-
Vladimir
KeymasterHi,
It’s possible. Code below redefines gTranslate menu with ‘manage_options’ capability:
add_action('plugins_loaded', 'redefine_gtranslate_menu'); function redefine_gtranslate_menu() { remove_action('admin_menu', array('GTranslate', 'admin_menu'), 10 ); add_action('admin_menu', 'replace_gtranslate_menu' ); } function replace_gtranslate_menu() { add_options_page(__('GTranslate Options', 'gtranslate'), 'GTranslate', 'manage_options', 'gtranslate_options', array('GTranslate', 'options') ); }
Vladimir
KeymasterHi Wolfgang,
You can try this version:
add_filter( 'allowed_block_types', 'misha_allowed_block_types', 10, 2 ); function misha_allowed_block_types( $allowed_blocks, $post ) { $user = wp_get_current_user(); if ( in_array('administrator', $user->roles ) ) { // Do not change the list of default blocks for user with administrator role return $allowed_blocks; } if ( in_array('author', $user->roles ) ) { // Customize the list of allowed blockes for user with role author $allowed_blocks = array( 'core/image', 'core/paragraph', 'core/heading', 'core/list' ); return $allowed_blocks; } return $allowed_blocks; }
Vladimir
KeymasterHi,
Try beta version 4.58.3.b1. It’s available from the Download page after login and contains related fix:
Fix: Content View Restrictions add-on: Posts with “Show 404 HTTP error” option were available via AJAX requests.
The single .php file was changed:
pro/includes/classes/content-view-restrictions-posts-list.php
.Vladimir
KeymasterThanks. I got plugin copy. I will look what is going wrong.
Vladimir
KeymasterHi,
Send me the link to plugin (with ajax related features) from wordpress.org/plugins in order I can test this issue.
Vladimir
KeymasterThis script placed into functions.php file of the active theme of added as a Must Use plugin will redirect not logged-in user to the wp-login.php page:
// Block URLs from the list for not logged-in users add_action('wp_head', 'your_prefix_protect_urls', 110); function your_prefix_protect_urls() { if ( is_user_logged_in() ) { return; } $blocked_paths = array( '/wp-test2/category/post-category-1/' ); $redirect = false; $path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); foreach( $blocked_paths as $blocked_path ) { if ( $blocked_path==$path ) { $redirect = true; break; } } if ( !$redirect ) { return; } // URL where do you wish redirect not logged-in user $redirect_to = '/wp-test2/wp-login.php'; if (headers_sent()) { ?> <script> document.location.href = '<?php echo $redirect_to; ?>'; </script> <?php } else { wp_redirect( $redirect_to ); } die; }
Just replace blocked path from ‘/wp-test2/category/post-category-1/’ to yours, like ‘/cat/tutoriels/’, and $redirect_to value to from ‘/wp-test2/wp-login.php’ to the path/URL of your login page.
Vladimir
KeymasterYou should not input this code anywhere. I took it from Amelia plugin source code, just to show why “Amelia” menu is not available for the user with custom role.
Solution, grant to a user with shop_manager role the 2nd role – wpamelia-manager. Such user will get access to ‘Amelia’ menu after that.
Vladimir
KeymasterYou have to take into account that Amelia plugin create its admin menu “Amelia” with submenu items only for user who has at least one of Amelia’s user roles or who is a superadmin:
$ameliaRole = UserRoles::getUserAmeliaRole(wp_get_current_user()); // Init menu if user is logged in with amelia role if (in_array($ameliaRole, ['admin', 'manager', 'provider', 'customer'])) { if ($ameliaRole === 'admin') { ErrorService::setNotices(); } $menuItems = new Menu($settingsService);
where:
– ‘admin’=’administrator’ WordPress role;
– ‘manager’=’wpamelia-manager’;
– ‘provider’=’wpamelia-provider’;
– ‘customer’=’wpamelia-customer’.
So you can use your own custom user role but grant it to a user together with one of Amelia own user roles from the list above.Vladimir
KeymasterI will prepare a piece of code to redirect not logged-in visitor from the custom URL (1-2 days).
Vladimir
KeymasterDid you try to use existing role from Amelia plugin as a starting point? You can add new role as a copy of selected role, then modify it.
To say more I need access to Amelia plugin. You can share its zip with support[at-sign]role-editor.com via DropBox or similar service.
Vladimir
KeymasterThank you for clarification.
Somehow I missed taxonomy listing pages, like /category/some_cat, or similar. It’s not possible currently to manage view access to such pages itself, only to their content, via view access settings for the posts and/or categories.It’s a subject for further development/enhancement.
Vladimir
KeymasterIs it possible to get administrator access to your site? If Yes, send credentials to support [at-sign] role-editor.com
We will can proceed then checking part by part if it’s possible to make it work.Vladimir
KeymasterThanks. I logged-in successfully. Send the link of the page which we test.
Vladimir
KeymasterHi,
Is it possible to look at your site with administrator privileges? If Yes, send credentials and noted page link to support [at-sign] role-editor.com
Vladimir
KeymasterIt’s not possible with User Role Editor Pro.
-
AuthorPosts