-
AuthorPosts
-
January 2, 2019 at 3:01 pm #1049272
I need to supply user access to a person who will only be blogging. I created the blog page as a separate link in the navigation menu – it works fine. I created a user account with the role as author – for this person who will be blogging – I do not want them to have access to anything in the site besides blogging. The problem is that the the portfolio link is still present for the author role – and he can add new portfolio items. I installed user role editor to try to remove the portfolio link, but when I unchecked the box for the portfolio – it unchecked other boxes for blogging. Not sure what to do.
January 3, 2019 at 4:11 am #1049430Hey amester55,
Thank you for using Enfold.
You can disable the portfolio link for all users except for administrators with this filter:
add_filter('avf_portfolio_cpt_args', 'avf_portfolio_cpt_args_mod'); function avf_portfolio_cpt_args_mod($args) { if( ! current_user_can('activate_plugins') ) { $args['show_ui'] = false; $args['show_in_menu'] = false; } return $args; }
Best regards,
IsmaelJanuary 3, 2019 at 3:55 pm #1049625I added the code to the functions.php and the functions-enfold.php file but i get this error message:
Your PHP code changes were rolled back due to an error on line 2251 of file wp-content/themes/enfold/functions-enfold.php. Please fix and try saving again.syntax error, unexpected ‘&’
The error is referring to the first line of code. I have PHP version 7 running. I tried to remove the “&” one at a time and then all of them on that line but nothing worked. I am not familiar with coding. Also, where do I add the code? Can you help?
- This reply was modified 5 years, 10 months ago by amester55.
January 4, 2019 at 6:42 am #1049832Hi,
Thanks for the update, did you add it to both files? If so then please try to remove it from functions-enfold.php and just leave it in functions.php.
Best regards,
RikardJanuary 4, 2019 at 6:47 pm #1050085I added the code to functions.php and it was successful. (The code is not added to functions-enfold.php) However, the portfolio link is still visible at left (the black menu at left) for all users. Any further help?
January 7, 2019 at 1:31 pm #1050868Hi,
I adjusted the code a bit and it worked properly on my end. Please try it again.
Best regards,
IsmaelJanuary 7, 2019 at 3:01 pm #1050898What is the adjusted code?
January 7, 2019 at 3:34 pm #1050922Hi,
This is the modified code:
add_filter('avf_portfolio_cpt_args', 'avf_portfolio_cpt_args_mod'); function avf_portfolio_cpt_args_mod($args) { if( ! current_user_can('activate_plugins') ) { $args['show_ui'] = false; $args['show_in_menu'] = false; } return $args; }
Best regards,
IsmaelJanuary 10, 2019 at 7:38 pm #1052454Hi
Not having any luck adding the above code to the functions.php file. I get this error message:“Your PHP code changes were rolled back due to an error on line 739 of file wp-content/themes/enfold/functions.php. Please fix and try saving again. Cannot redeclare avf_portfolio_cpt_args_mod() (previously declared in wp-content/themes/enfold/functions.php:653)”
Line 739 is: the last } of your code and line 653 reads: function avf_portfolio_cpt_args_mod($args) {
Any help is greatly appreciated
January 12, 2019 at 2:58 pm #1053106Hi amester55,
You need to delete the previous version of the function and use the latest one that Ismael gave you.
Please, let us know if that worked.
Best regards,
VictoriaJanuary 15, 2019 at 7:30 pm #1054296My bad – thank you – it worked great!
January 15, 2019 at 8:56 pm #1054346Hi amester55,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
VictoriaJanuary 16, 2019 at 4:55 pm #1054597This thread can be closed – thank you
January 16, 2019 at 6:08 pm #1054619Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Need to remove portfolio link at left for restricted blogger access’ is closed to new replies.