Do you have the shortcut to use the plugin? Or perhaps it

Do you have the shortcut to use the plugin? Or perhaps it can be widgetize to make it easy to put anywhere in the content. It's bit cumbersome to mess around under the hood using php code. Thanks

  • Sajid

    Hi @Adebagus,

    Hope you are doing good today

    I have come up with following code that will allows you to use those functions as a shortcode. Add this code in functions.php file of your child theme or use it as mu-plugin.

    add_shortcode( 'display_user_activity', 'wpmu_display_user_activity_shortcode' );
    function wpmu_display_user_activity_shortcode( $atts ) {
    
            $args = shortcode_atts(
                        array(
                            'minutes' => 60,
    
                        ), $atts);
    
            extract($args);
    
            ob_start(); 
    
            display_user_activity($minutes);
    
            return ob_get_clean();
    }
    
    add_shortcode( 'user_activity_output', 'wpmu_user_activity_output_shortcode' );
    function wpmu_user_activity_output_shortcode( $atts ) {
    
            $args = shortcode_atts(
                        array(
                            'minutes'		=> 5,
                            'limit' 		=> 10,
    						'global_before'	=> '',
                            'before' 		=> '',
                            'global_after'	=> '',
                            'after' 		=> '',
    						'avatars'		=> 'yes',
                            'avatar_size' 	=> 32,
    
                        ), $atts);
    
            extract($args);
    
            ob_start(); 
    
            user_activity_output($minutes, $limit, $global_before, $before, $global_after, $after, $avatars, $avatar_size);
    
            return ob_get_clean();
    }

    After that you can use following shortcodes respectively and pass the variables in shortcode.

    [display_user_activity minutes="1140"]
    [user_activity_output  minutes="1140" limit="10"]

    Hope that helps! If you still need assistance, don't hesitate to ask.

    Take care and have a nice day

    Kind Regards,
    Sajid J