I have an issue

Hi,

I have an issue where If I ave the membersips pro plugin activiated it stops anyone that is not an administrator receiving notification in the buddypanel (left hand sidebar) or titlebar that they have a message.

I have attached a screenshot of an admin user where you can clearly see the notification working for the user. I wish for this to work for every user regardless of the role and for some reason the membership pro plugin is stopping this from happening.

If you could advise I would appreciate it.

  • Sajid

    Hello edward,
    Hope you are doing good today :slight_smile:

    I am sorry to hear you are getting this issue on your site while using Membership 2 Pro plugin.

    Do you using the Additional Automated Emails add-on or its Membership 2 Pro plugin by default ?

    Since this is a paid plugin, so I am unable to test it on my own test environment. Could you please enable support staff access or send in theme plus any add-on you are using for BuddyBoss so I could take a closer look ?

    To grant access go to WPMU DEV -> Support -> Support Access -> Grant Support Access or see this manual for more details regarding how to enable support staff access.

    Take care and have a nice day :slight_smile:

    Best Regards,
    Sajid

  • Sajid

    Hello edward,
    Hope you are doing good today :slight_smile:

    Apologies for delay on this ticket. The support staff access seems to be expired now. Could you please send in direct FTP (this will help me troubleshoot this issue quickly and easily) and WordPress admin credentials via our secure/private contact form in following format.

    You can send the requested details via our secure contact form in following format.

    Subject: "Attn: Sajid Javed”
    - WordPress admin username
    - WordPress admin password
    - login url
    - FTP credentials (host/username/password)
    - link back to this thread for reference

    Please accept my sincere apologies again. I look forward towards your response!

    Best Regards,
    Sajid

  • Sajid

    Hello edward :slight_smile:

    I am sorry for delay on this ticket. I just took a look on your site, tried different combinations by disabling/enabling add-ons but that did not worked.

    I then went into the code of buddyBoss theme but I could find why exactly theme does not append that bubble while M2 Pro is enabled. I think its just being sensitive (that's all I can think of at the moment :wink: )

    So after trying hard and low. I decided to write a custom code snippet to add the unread messages bubble only for non-admin users.

    function wpmudev_insert_custom_message_count_bubble(){
    
    	// check if bp function eixists
    	// check if curent user is NOT administrator
    	if( !function_exists( 'messages_get_unread_count' ) or (current_user_can('administrator') ) ) return ;
    
    	$unread_message_count = messages_get_unread_count();
    
    	// Also check if this user actually have some unread messages.
    	if( 0 == $unread_message_count ) return;
    
    	//If above condition matches then continue.
    	?>
    
    	<script type="text/javascript">
    		jQuery('document').ready(function($){
    
    			//append count to left panel messages menu
    			$('#menu-item-738 a').append("<span class='count'><?php echo $unread_message_count; ?></span>");
    
    			//append count to title bar bell
    			$('.notification-link.fa.fa-bell').append("<span id='ab-pending-notifications' class='pending-count alert'><?php echo $unread_message_count; ?></span>");
    
    		});
    	</script>
    
    <?php }
    add_action('wp_footer', 'wpmudev_insert_custom_message_count_bubble', 999);

    Add the above code in functions.php file of your theme or use it as mu-plugin.

    If you go with mu-plugin route then download the attached zip file. Unzip it and upload to /wp-content/mu-plugins folder (edward I have done this for you - just sharing the details here, in case any one else having similar issues so they know what we did to fix).

    Hope that helps! Feel free to post a reply if you need further assistance :slight_smile:

    Best Regards,
    Sajid

  • Sajid

    Hello edward,
    Hope you are doing good today :slight_smile:

    Your theme is adding a different menu for mobile devices that's why it was not adding the bubble on mobile.

    I have updated the code in the way it work for both menus (updated the code on your dev site too).

    function wpmudev_insert_custom_message_count_bubble(){
    
    	// check if bp function eixists
    	// check if curent user is NOT administrator
    	if( !function_exists( 'messages_get_unread_count' ) or (current_user_can('administrator') ) ) return ;
    
    	$unread_message_count = messages_get_unread_count();
    
    	// Also check if this user actually have some unread messages.
    	if( 0 == $unread_message_count ) return;
    
    	//If above condition matches then continue.
    	?>
    
    	<script type="text/javascript">
    		jQuery('document').ready(function($){
    
    			//append count to left panel messages menu
    			$('.bp-messages-nav a').append("<span class='count'><?php echo $unread_message_count; ?></span>");
    
    			//append count to title bar bell
    			$('.notification-link.fa.fa-bell').append("<span id='ab-pending-notifications' class='pending-count alert'><?php echo $unread_message_count; ?></span>");
    
    		});
    	</script>
    
    <?php }
    add_action('wp_footer', 'wpmudev_insert_custom_message_count_bubble', 999);

    Take care and have a nice day :slight_smile:

    Best Regards,
    Sajid - WPMU DEV Support