Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try casting the #num variable to float. To do that go to line 241 of mdocs-show-file-info-templates.php file and change $the_rating[‘average’] to (float)$the_rating[‘average’]
    Or you can use floatval($the_rating[‘average’])
    Hope this helps.

    • This reply was modified 5 years, 2 months ago by imarkelis.
    • This reply was modified 5 years, 2 months ago by imarkelis.
    Thread Starter imarkelis

    (@imarkelis)

    I had to disable Hide All Files: (Non Members) from the File Options on Configuration Settings. Now works like a charm. I control file access with the Ultimate Member plugin (just in case someone wants to find a solution to the file access problem). Memphis Document Library is a great plugin. Thank you!

    • This reply was modified 5 years, 10 months ago by imarkelis.
    • This reply was modified 5 years, 10 months ago by imarkelis.
    Thread Starter imarkelis

    (@imarkelis)

    Ok. I got it. The only thing I had to do was use the object itself by refering to it ($this). So I changed the code and voila. No need for a static function.

    public function couponsgen_add_dashboard_widget() {
                //$cg_widget = new Couponsgen_Admin();
                //$cg_widget->couponsgen_create_dashboard_widget();
                wp_add_dashboard_widget(
                    'couponsgen_dashboard_widget',
                    'Coupons Generator Dashboard Widget',
                    array($this, 'couponsgen_create_dashboard_widget')
                );
            }
    Thread Starter imarkelis

    (@imarkelis)

    I was wondering if there is a way to do it without using static… I’m creating a new instanse of the class Coupogen_Admin but i think it’s a lot more work to do.

    Thread Starter imarkelis

    (@imarkelis)

    Thank you very much for the quick response!

    I also had to turn my function to static cause I got the message

    Strict standards: call_user_func() expects parameter 1 to be a valid callback, non-static method

    The final code for adding the widget is

    public function couponsgen_add_dashboard_widget() {
                wp_add_dashboard_widget(
                    'couponsgen_dashboard_widget',
                    'Coupons Generator Dashboard Widget',
                    array(__CLASS__,'couponsgen_create_dashboard_widget')
                );
            }

    and for putting content inside the widget is

    public static function couponsgen_create_dashboard_widget() {
               echo "<p>Hello World! This is my couponsgen Dashboard Widget</p>";
            }

    Thank you very much for your help!

Viewing 5 replies - 1 through 5 (of 5 total)