Support » Plugin: Media File Renamer - Auto & Manual Rename » Can’t override roles

  • Resolved teresasumisu

    (@teresasumisu)


    Hi!
    You released an update to override roles and documented it.
    But it isn’t working.
    I wrote a topic here before but you marked it as resolved, which it isn’t.

    So this is the code I pasted to my functions:

    
    add_filter( 'mfrh_allow_usage', 'mfrhAllowUsage');
    function mfrhAllowUsage( $allow ) {
      return current_user_can( 'editor' ) || $allow;
    }
    
    add_filter( 'mfrh_allow_setup', 'mfrhAllowSetup');
    function mfrhAllowSetup( $allow ) {
      return current_user_can( 'editor' ) || $allow;
    }

    But it does not change a thing.
    Is it correct?
    Your help is really appreciated πŸ™‚

    Thanks a lot!
    Best regards,
    Teresa

    • This topic was modified 3 months, 1 week ago by teresasumisu.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hi @teresasumisu,

    Yes, that code works perfectly. I also tried it in my install, with an editor account. I simply copy/pasted your code here.

    Are you sure the code above is actually ran?
    Are you sure the user has the editor role?

    I am personally using Code Snippets to add code in my WordPress installs.

    Thread Starter teresasumisu

    (@teresasumisu)

    Hi Jordy!
    Thank you!
    I really have the suspicion that there’s a missunderstanding πŸ˜€
    Otherwise I can’t explain it.
    I installed a fresh WP Installation with only a plain 2021 childtheme an no plugins. I pasted the above code in the functions.
    http://renamer.sumisuweb.at/wp-admin
    You can login with the following creds:
    editor
    development

    tschmidt
    development
    (which is the admin)

    I can’t rename with the editor role. The column for renaming simply isn’t there, also the: https://ibb.co/9ZnmNP1
    Can you?
    Maybe I’m just overseeing something or it’s a missunderstanding.
    Please bare with me with this one πŸ™‚ I would really appreciate it!
    Thanks!
    Teresa

    • This reply was modified 2 months, 2 weeks ago by teresasumisu.
    Plugin Author Jordy Meow

    (@tigroumeow)

    Thread Starter teresasumisu

    (@teresasumisu)

    Hi!
    I just saw it. Too funny that it works in a Code snippet from a Plugin but not in the functions.php of the active theme! My code is still there – and if I deactivate the code snippets, it’s not working.
    Do you have any idea, why?

    Plugin Author Jordy Meow

    (@tigroumeow)

    Yes, I think it’s because the functions.php is being ran while the filters are set up yet, or maybe fired before the functions php is ran πŸ™‚

    You could try to go around this but be honest I much prefer to go through Code Snippets, it’s simpler, cleaner and it’s there obvious, in the admin.

    Thread Starter teresasumisu

    (@teresasumisu)

    Hi!
    Thanks, I am going to experiment a bit and keep you posted if I find a solution which works and you could also recommend on your website. Because – honestly – your solution from here https://wordpress.org/plugins/seo-automatic-links/ is just not working πŸ™‚ And you do recommend the functions.php and code snippets there, maybe you should change that, since only one of those 2 works – which is a bug in your plugin in my eyes.

    I don’t really am a big fan of unnecessary plugins, especially not plugins which give the possibility to add code via the backend. It’s a security issue, as the theme editor is (which I normally deactivate)

    Best regards,
    Teresa

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.