Notification Bubbles for GravityFlow

Hi
How can I show the number of pending inbox entries (Gravity Flow) in wordpress notifications of admin panel’s bar?

Hello,

If you want to show the pending inbox count on the admin panel bar, there is a setting under Workflow > Settings > Advanced to enable it.

If you want to display that same value for a specific user in a notification, a code solution would involve the Gravity_Flow_API::get_inbox_entries_count function.

Example:
//Replace 1 with whatever user ID your notification wants to send data for
Gravity_Flow_API::get_inbox_entries_count( array( ‘user_id’ => ‘1’ ) );

Here is a snippet that would let you provide this as a merge tag within the notification instead of only through a filter like gform_notification.

add_filter( 'gform_replace_merge_tags', 'mergetag_inbox_count', 10, 7 );
function mergetag_inbox_count( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format ) {
 
	$matches = array();

	preg_match_all( '/{inbox_count(:(.*?))?}/', $text, $matches, PREG_SET_ORDER );

	if ( ! empty( $matches ) ) {

		foreach ( $matches as $match ) {
			$full_tag       = $match[0];
			$options_string = isset( $match[2] ) ? $match[2] : false;
		}

		$attributes = shortcode_parse_atts( $options_string );
		if ( ! empty( $attributes ) ) {
			$replace = '';
			if ( $attributes['format'] == 'email' && isset( $attributes['user_id'] ) ) {
				$count = 0;
				$count = Gravity_Flow_API::get_inbox_entries_count( array( 'user_id' => $attributes['user_id'] ) );
				$replace = 'Current Inbox Count: ' . $count;
			}
			$text = str_replace( $full_tag, $replace, $text );
		}
	}

	return $text;
}

To use it, you would add something akin to
{inbox_count: format=“email” user_id=“{created_by:ID}”} for User: {created_by:display_name}

Thank you for your reply
I have seen the settings you mentioned.

The fact is that I also use the Buddyboss theme on my site, and if you know it, one of it’s features is the notification section, which shows the number of incoming messages or mentions or… to each user (not just the admin).

I want to be notified in this section when someone has pending entery.

Here are more details about the Notifications section in Buddy Bass:

Ahhh, in that case, you’d want to use the Step Framework to create a custom step. So you could trigger the BuddyBoss message, mention, notification, etc. at the desired point in the workflow. Or possibly extend the email driven notification to also fire the BuddyBoss notification.

Reach out to our Gravity Flow support if you need more assistance and I’m sure we can help you get exactly what you’re looking to achieve.

Regards,
Jamie

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.