Forum
Getting menu into admin header for editors
I am having some trouble with editing my own app using the API. I have it getting items into the admin menu under apps. But then it wasn't appearing for editors, so wonder where to start. I have a permission in the system which I can check under roles, but how do I link this directly to the navigation? Also, it appears I accidentally changed the text for 'Apps' to my custom apps title, so if you know the obvious place I may have done this before I go through my git diff, that would be great.
You would use Settings https://docs.grabaperch.com/api/app-settings/
To help further we would need to see your code.
Which part of my app code would help? Ultimately I just want to add a menu item so editors can see, so would have thought there a single line I add in somewhere which sites within the ->priv() if statement.
In my addon I have this line, which is creating the priviledge I would like to use: $UserPrivileges->create_privilege('fareshare_supermarkets.manage', 'Manage supermarkets');
It is there, and I can check it accordingly. So I would like, when checked for editor, for 'Supermarkets' to appear next to 'Pages' for users with that role
Maybe the best way for what I want is to enable the dashboard and just create a widget that links to the page(s) they need to get to instead
Can you show us your
admin.php
file?This is about it right now, I imagine I would add in the if statement once I get the item in the menu.
FYI the widget approach also appears to be working nicely, and using the if statement with permissions set
So it's this that registers the app and adds it to the Apps menu:
If you want to check a priv first, just wrap it:
Sure I get that part. But at the moment, even without the if statement, nothing appears in the admin menu for my editor role. Should it automatically appear then for them? Or is there an over-arching permission they need which gives them access to all apps?
Note that my admin role does see supermarkets appear under the app menu
No, if you're not restricting access then everyone should have access.