Open bash88 opened 5 years ago
Maybe try UserOnline_Template::compact_list( 'page', 'list', $page_url )
Code is https://github.com/lesterchan/wp-useronline/blob/master/template-tags.php#L111
Thank you very much for your quick response!
I went with:
count( UserOnline_Template::compact_list( 'page', 'list', '' ) )
Only now it's not updating real-time, right? Is there any way to fix that?
Nope. It is totally different. This just basically counts the user at the point in time. If you want real time, you need to write your own AJAX calls to an endpoint that calls that line.
Well, the real-time update does happen but it switches the output back to html..
<span id="useronline-browsing-page"><strong>2 Bezoekers</strong> Bezoeken deze pagina.<br>Gebruikers: <strong>2 Gasten</strong></span>
Just replace this line? https://github.com/lesterchan/wp-useronline/blob/master/core.php#L172
Awesome, that works. But I'd rather not have custom code in the plugin of course. Do you think you can include this in the plugin? Something like:
users_browsing_page($page_url, $number_only);
Or maybe a global setting to bypass templates and just return numbers?
Hi,
I don't see any way to just return a number from get_users_browsing_page, so I brute forced myself a way to do it. Probably all wrong.
Is this something you could maybe include in the plugin?