• H from Germany,

    i am using your plugin in every new WP installation of mine and still find it absolutely indispensable. Of course it works like a charm with the new WP 4.5.1 Besides the l18n feature I asked for about one year ago, I came up with another Idea: Could you probably wrap some sort of a display filter around the dashboard metabox output? I am thinking of a simple true/false condition, that one could use to show/hide the metabox.

    Rough example (considering $show is a bool that’s true):

    function show_error_log_metabox($show){
    $show = current_user_can('manage_options');
    return $show;
    }
    add_filter('yourfilterhook', 'show_error_log_metabox');

    Could come in handy when streamline the WP dashboard for a customer.

    https://www.ads-software.com/plugins/error-log-monitor/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Janis Elsts

    (@whiteshadow)

    All right, that sounds easy enough. I’ve implemented your idea in the development version. The filter name is elm_show_dashboard_widget. It works exactly as you suggested. Just make a callback that returns true to show the widget and false to hide it.

    Thread Starter sixtyseven

    (@sixtyseven)

    Thank you for considering my suggestion. If you don’t mind, may I ask about the localization again? As stated before, I think your plugin is a very good enhancement for all of my WP installations. Should make its way into the core someday ??

    Thread Starter sixtyseven

    (@sixtyseven)

    … works like a charm, BTW ??

    Thread Starter sixtyseven

    (@sixtyseven)

    Thank you for the new version of this nice little gem. However, when trying to create a translation with poedit, the software dies with an error regarding not specifying the folder for the translations. After digging into this, I came up with an easy fix.

    Step one: Create a directory ‘languages’ in your plugin root.

    Step two: Enhance the Plugin header of plugin.php with a Domain Path like this

    Text Domain: error-log-monitor
    Domain Path: /languages

    Step three: Enhance the method loadTextDomain of the class ELM_Plugin like this

    public function loadTextDomain() {
      load_plugin_textdomain('error-log-monitor', false, basename(dirname($this->pluginFile)) . '/languages/');
    }

    After that, Poedit no longer mourns and translates as expected and the translations load smoothly into WP.

    If you are interested, I gladly chip in my translation files for de_DE and de_DE_formal. Just drop me a line where to send these, maybe you could include them in your next release.

    Thanks again for putting such an ammount of effort into this plugin. Really appreciated.

    Thread Starter sixtyseven

    (@sixtyseven)

    Found another little issue regarding the translation: The Header of the meta box is not translatable because an improper syntax of _x(

    In the method registerWidget of the class Elm_DashboardWidget you are using the text domain as the description, this makes this line untranslatable.

    This is what you are using (Translation does not work):

    public function registerWidget() {
    		if ( $this->userCanSeeWidget() ) {
    			wp_add_dashboard_widget(
    				$this->widgetId,
    				/* translators: Dashboard widget name */
    				_x('PHP Error Log', 'error-log-monitor'),
    				array($this, 'displayWidgetContents'),
    				array($this, 'handleSettingsForm')
    			);
    		}
    	}

    This is how you can use it:

    public function registerWidget() {
    		if ( $this->userCanSeeWidget() ) {
    			wp_add_dashboard_widget(
    				$this->widgetId,
    				/* translators: Dashboard widget name */
    				__('PHP Error Log', 'error-log-monitor'),
    				array($this, 'displayWidgetContents'),
    				array($this, 'handleSettingsForm')
    			);
    		}
    	}

    Or even better:

    public function registerWidget() {
    		if ( $this->userCanSeeWidget() ) {
    			wp_add_dashboard_widget(
    				$this->widgetId,
    				_x('PHP Error Log', 'Dashboard widget name', 'error-log-monitor'),
    				array($this, 'displayWidgetContents'),
    				array($this, 'handleSettingsForm')
    			);
    		}
    	}

    Sorry to bother you with all this stuff, but as stated before: I absolutely like this plugin. And probably my help could make it even better.

    Plugin Author Janis Elsts

    (@whiteshadow)

    Found another little issue regarding the translation: The Header of the meta box is not translatable because an improper syntax of _x(

    Oops, my mistake. I originally had “Dashboard widget name” as the context, then I decided to make it a comment instead but forgot to change _x() to __(). Fixed in the development version.

    As for creating a directory for translations, I believe that is not necessary. The plan is to use language packs instead. Translations should be submitted via translate.www.ads-software.com. There’s a “Translate Error Log Monitor” button in the right sidebar on the plugin homepage.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display filter for the error log metabox’ is closed to new replies.