Ultimate Member Online Users Shortcode

Below, you’ll find a detailed guide on how to add the Ultimate Member – Online Users Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Ultimate Member – Online Users Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Ultimate Member – Online Users Plugin and the shortcodes it provides:

Plugin Icon
Ultimate Member – Online Users

"Ultimate Member – Online Users is a powerful WordPress plugin that lets you monitor and interact with your site's active users. This tool is perfect for building a dynamic and engaging online community."

★★★★✩ (2) Active Installs: 5000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [ultimatemember_online]

Ultimate Member Online Users [ultimatemember_online] Shortcode

The UltimateMember Online shortcode is a dynamic tool that displays online users on your WordPress site. It enqueues necessary scripts and allows customization of the user roles and maximum number displayed. The PHP function for the shortcode fetches online users, sets a template based on their count, and returns the template. With ‘max’ and ‘roles’ parameters, you can control the output.

Shortcode: [ultimatemember_online]


Here is a list of all possible ultimatemember_online shortcode parameters and attributes:

  • max – defines the maximum number of online users to display
  • roles – allows to filter online users by their user roles

Examples and Usage

Basic example – Displaying online users without any constraints.


Advanced examples

Displaying a maximum of 5 online users with no role restrictions.

[ultimatemember_online max=5]

Displaying online users with a specific role. In this example, only online users with the ‘subscriber’ role will be shown.

[ultimatemember_online roles='subscriber']

Combining both the ‘max’ and ‘roles’ parameters. This will display a maximum of 3 online users who have the ‘author’ role.

[ultimatemember_online max=3 roles='author']

These examples demonstrate the flexibility of the ‘ultimatemember_online’ shortcode. By adjusting the ‘max’ and ‘roles’ parameters, you can customize the display of online users to suit your specific needs.

PHP Function Code

In case you have difficulties debugging what causing issues with [ultimatemember_online] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'ultimatemember_online', array( &$this, 'ultimatemember_online' ) );

Shortcode PHP function:

function ultimatemember_online( $args = array() ) {

		$args = shortcode_atts(
				'max'   => 11,
				'roles' => 'all',

		$args['online'] = UM()->Online()->get_users();
		$template       = ( $args['online'] && count( $args['online'] ) > 0 ) ? 'online' : 'nobody';

		return UM()->get_template( "{$template}.php", um_online_plugin, $args );

Code file location:



Now that you’ve learned how to embed the Ultimate Member – Online Users Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.


Leave a Reply

Your email address will not be published. Required fields are marked *