WordPress.org

Forums

Loco Translate
[resolved] Enable Loco Plugin for Editors (or other user roles) (5 posts)

  1. jun9e
    Member
    Posted 1 year ago #

    Hello,
    normally i don´t want to copy&paste the translations into the plugin, if my editors can do it on the fly.

    I would like to know how i can change the admin capability to the 'edit pages' capability. I can see at your @todo

    if( current_user_can(Loco::CAPABILITY) ){
                    // @todo font end functionality

    that you thought about this already.

    I´m glad for any help :)

    https://wordpress.org/plugins/loco-translate/

  2. timwhitlock
    Member
    Plugin Author

    Posted 1 year ago #

    As you can probably see, the manage_options capability is required because altering files on disk within themes and plugins is a privileged operation that I thought should be reserved for admins.

    I'll have to add a filter for you to override this to use a lower privilege like edit_posts. I can put this on my todo list, but can't guarantee a timeline for implementing.

    In the mean time I think your only option is top hack the plugin code. The line is here:
    https://github.com/loco/wp-loco/blob/master/lib/loco-boot.php#L12

  3. jun9e
    Member
    Posted 1 year ago #

    thank you.
    works fine temporarly.

  4. wube
    Member
    Posted 2 months ago #

    There's no need to modify the core files. Just use filter:

    Add the following code to your functions.php

    function mytheme_change_loco_admin_capability()
    {
        return 'edit_posts';
    }
    add_filter('loco_admin_capability', 'mytheme_change_loco_admin_capability');
  5. timwhitlock
    Member
    Plugin Author

    Posted 2 months ago #

    Yes, filter was added recently.
    Ref: https://wordpress.org/support/topic/capability-filter

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Loco Translate
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags