Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #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.

    #1049430

    Hey 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,
    Ismael

    #1049625

    I 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.
    #1049832

    Hi,

    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,
    Rikard

    #1050085

    I 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?

    #1050868

    Hi,

    I adjusted the code a bit and it worked properly on my end. Please try it again.

    Best regards,
    Ismael

    #1050898

    What is the adjusted code?

    #1050922

    Hi,

    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,
    Ismael

    #1052454

    Hi
    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

    #1053106

    Hi 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,
    Victoria

    #1054296

    My bad – thank you – it worked great!

    #1054346

    Hi amester55,

    Glad you got it working for you! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #1054597

    This thread can be closed – thank you

    #1054619

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Need to remove portfolio link at left for restricted blogger access’ is closed to new replies.