Forum Replies Created
-
AuthorPosts
-
VladimirKeymaster
Thanks. I got plugin copy. I will look what is going wrong.
VladimirKeymasterHi,
Send me the link to plugin (with ajax related features) from wordpress.org/plugins in order I can test this issue.
VladimirKeymasterThis 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.
VladimirKeymasterYou 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.
VladimirKeymasterYou 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.VladimirKeymasterI will prepare a piece of code to redirect not logged-in visitor from the custom URL (1-2 days).
VladimirKeymasterDid 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.
VladimirKeymasterThank 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.
VladimirKeymasterIs 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.VladimirKeymasterThanks. I logged-in successfully. Send the link of the page which we test.
VladimirKeymasterHi,
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
VladimirKeymasterIt’s not possible with User Role Editor Pro.
VladimirKeymasterHi,
Resolved.
Both addons use custom user capabilities, which all were granted to administrator by Gravity Forms plugin automatically, but not exist/created by default.
I added to new capabilities:
– gravityforms_mailchimp;
– gravityforms_event_tracking.
I granted them to the sdol-admin role. This role sees now both links “Mailchimp” and “Submission Tracking”.VladimirKeymasterIf you setup the code for custom filter ure_restrict_edit_post_type (I gave the link above) to exclude events from the edit restrictions, user will have access to all events without restrictions. It does not depend from post ID list in the edit restrictions form.
You just need:
1) replace ‘editor’ with your own role ID, let it be ‘role_a’;
2) replace ‘post’ with valid custom post type for events, let it be for this example: ‘event’.
So instead ofif ( in_array( 'editor', $user->roles ) ) { if ( $post_type==='post' ) { $restrict_it = false; } }
your code will have
if ( in_array( 'role_a', $user->roles ) ) { if ( $post_type==='event' ) { $restrict_it = false; } }
In assumption that you made all correctly, you can input post ID list after that and check that all events are still available for the role.
VladimirKeymasterYou don’t need a code for this. Open ‘Users->User Role Editor’, select role, click ‘Posts Edit’ insert the list of posts ID into the ‘with post ID (comma separated)’ field.
Or, you can make it individually for selected users via user profile. -
AuthorPosts