Home › Forums › WoodMart support forum › Allow access to Woodmart Header Builder to Non-admins
Allow access to Woodmart Header Builder to Non-admins
- This topic has 17 replies, 4 voices, and was last updated 4 years, 3 months ago by Artem Temos.
-
AuthorPosts
-
July 29, 2020 at 4:17 pm #215182
theo_gkParticipantHello, I want to give access to a custom role to change the header. This is only possible through your “Woodmart” menu item and then clicking “Header Builder”.
Unfortunately, I can’t give access to them because you request that the user is administrator only, which is kind of problematic. In your file /woodmart/inc/admin/dashboard/dashboard.php line 38 (version 4.6) in the start of the menu_page function, you check if the user is an administrator
if ( ! current_user_can( 'administrator' ) ) { return; }
Could you change the ‘administrator’ to ‘manage_options’ so that we can assign that capability to a custom role?
Is this possible? Can you give me an answer if you are going to change this or not?
Thank you very much
July 29, 2020 at 9:27 pm #215233
Elise NoromitMemberHello,
Thank you very much for choosing our theme and for contacting us.
Have you tried to add this code it to the functions.php of the child theme?
Best Regards
July 30, 2020 at 6:14 am #215293
theo_gkParticipantI don’t understand. What code to add in my functions.php ???
This code is just 3 lines from a class method, inside a core woodmart file. I can’t override this file and you don’t provide any filter. Am I wrong? How can I override this using my child theme?
Thanks
July 30, 2020 at 11:34 am #215375
Elise NoromitMemberHello,
We do not plan to implement this option in the theme. We add new features when it is very often requested. This feature is not most frequently requested. You can change the theme code as per your needs on your own.
Best Regards
July 30, 2020 at 12:07 pm #215396
theo_gkParticipantHi it’s not a feature request. It’s a problem in my opinion. Why allow only an administrator to change something simple as the header? This is problematic. Thanks for understanding
Secondly, can you help me how to change this using my child theme? You probably didn’t see my previous response.
Thanks
July 30, 2020 at 12:37 pm #215406
Elise NoromitMemberHello,
I saw your previous post. Usually, one can change or customize the functionality adding the changed code to the functions.php of the child theme. I have checked with the developers, in this case, unfortunately, it would not work.
I would suggest trying a role management plugin, perhaps you would solve the problem. Alternatively, you can try to change the ‘administrator’ to ‘manage_options’
Best Regards
July 30, 2020 at 5:06 pm #215489
theo_gkParticipantAnyone who knows a little bit about wp development knows that adding this code to my child theme would not work.
Your first suggestion will not solve my problem (admin is a role, not a capability to add it) and the second is just a waste of time as updating the theme will erase my changes.
Could you please ask someone who can really answer my question? How can I allow a user who is not admin to edit the site header?
July 31, 2020 at 6:09 am #215567
Artem TemosKeymasterHello,
Unfortunately, the PHP class can’t be overridden in the child theme. That is why it possible to customize it in the parent theme only, unfortunately.
Kind Regards
July 31, 2020 at 6:23 am #215579
theo_gkParticipantI got this. Is there any other way to allow a non-admin (editor, shop manager or whatever) to edit the site header?
Thanks for your time, I really appreciate it. Sorry for insisting but I really have a problem with this.
July 31, 2020 at 6:28 am #215580
Artem TemosKeymasterUnfortunately, there is no other way to do this as you can see from the code. It has a condition to show theme settings and all our pages to administrators users.
July 31, 2020 at 6:36 am #215583
theo_gkParticipantThis is unfortunate indeed. I hope this changes in the future. Allowing a shop manager edit the header (an html text with shipping info for example) is not much to ask from a theme.
Thank you for your time and your assistance
July 31, 2020 at 6:40 am #215586
Artem TemosKeymasterWe will add WordPress filter to it in our next theme update allowing to override this in the child theme.
July 31, 2020 at 10:22 am #215660
theo_gkParticipantI’m really grateful about this. Thank you very much, you’re the best
July 31, 2020 at 11:03 am #215670
Artem TemosKeymasterThank you for your feedback.
August 20, 2020 at 1:10 pm #220059
csyParticipantLatest Build
August 20, 2020 at 1:15 pm #220062
Artem TemosKeymasterHi,
Yes, you can use the following example and put it into the functions.php file in your child theme
add_filter( 'woodmart_dashboard_theme_links_access', function() { return 'shop_manager'; } );
Regards
August 20, 2020 at 1:43 pm #220076
csyParticipantPerfect.. thank you
August 20, 2020 at 1:45 pm #220078
Artem TemosKeymasterYou are welcome!
-
AuthorPosts
Tagged: header permissions
The topic ‘Allow access to Woodmart Header Builder to Non-admins’ is closed to new replies.
- You must be logged in to create new topics. Login / Register