Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add custom hook to setupFrontend method #44

Closed
khosroblog opened this issue Aug 9, 2016 · 4 comments
Closed

Please add custom hook to setupFrontend method #44

khosroblog opened this issue Aug 9, 2016 · 4 comments

Comments

@khosroblog
Copy link

Hi, and thank you for this helpful plugin. :)
I use Enlighter plugin for comments and I need for access wp_editor buttons to all users include subscribers. so please add a custom hook to setupFrontend method of Enlighter Class.

 public function setupFrontend(){
        // load frontend css+js resources
        $this->_resourceLoader->frontendEnlighter();

        // check frontend user privileges
        $canEdit = is_user_logged_in() && (current_user_can('edit_posts') || current_user_can('edit_pages'));

      ########## I need to this hook ########################
      $canEdit = apply_filters("enlighter_can_edit", $canEdit );
      #######################################################

        if ( $canEdit ){
            $this->_resourceLoader->frontendEditor();
        }
    }
@AndiDittrich
Copy link
Member

Dear khosroblog ,

no problem, i will add this filter hook asap (but renaming it) ;)

best regards, Andi

@khosroblog
Copy link
Author

Thank you andi 👍

AndiDittrich added a commit that referenced this issue Aug 9, 2016
@AndiDittrich
Copy link
Member

FILTER::enlighter_frontend_editing

Description: Forced enabling/disabling of the frontend editing functions. The default value is created by the condition USER_LOGGED_IN AND (CAN_EDIT_POSTS OR CAN_EDIT_PAGES). Useful to bind editing capabilities to special users/groups

Example 1 - Limit editing functions to admin users

function mm_ejs_frontend_editing($allowed){
      return ($allowed && current_user_can('manage_options'));
}

// add filter
add_filter('enlighter_frontend_editing', 'mm_ejs_frontend_editing');

@khosroblog
Copy link
Author

Perfect ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants