Support » Plugin: WP ULike » [major bug] ulike breaking most buddypress notificaitons

  • Resolved godsdead

    (@godsdead)



    This has been driving me crazy FOREVER. when someone replys to my forum threads, I have been getting notifications with blank titles, so I have no idea what the notification is, I just went through and disabled all my plugins 1 by 1 to find out its ulike breaking titles in the notifications page.

    This is a major bug that is affecting all our existing website stopping notifications being displayed.

    With ulike activated:
    https://i.imgur.com/iDLench.png

    With ulike disabled:
    https://i.imgur.com/8HzXtsP.png

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Alimir

    (@alimir)

    Hi @godsdead
    I’m really sorry for the problem. Unfortunately, there is no such problem in our testing system. Is it possible to have access to your site and review the code snippet?

    Plugin Author Alimir

    (@alimir)

    Or go to the”wp-ulike > inc > general-hooks.php” and make the following changes on “wp_ulike_format_buddypress_notifications” function:

    
    	/**
    	 * Add custom format for 'wp_ulike' notifications.
    	 *
    	 * @author       	Alimir
    	 * @since           2.5
    	 * @return          String
    	 */
    	if( ! function_exists( 'wp_ulike_format_buddypress_notifications' ) ){
    		function wp_ulike_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
    			global $wp_filter,$wp_version;
    			// Return value
    			$return = $action;
    
    			if ( strpos( $action, 'wp_ulike_' ) !== false ) {
    				$custom_link	= '';
    				//Extracting ulike type from the action value.
    				preg_match('/wp_ulike_(.*?)_action/', $action, $type);
    				//Get user info
    				$user_info 		= get_userdata( $secondary_item_id );
    				$custom_text 	= sprintf( __('You have a new like %s', WP_ULIKE_SLUG ), is_object( $user_info ) ? __( 'From' , WP_ULIKE_SLUG ) . ' ' . $user_info->display_name : '' );
    
    				//checking the ulike types
    				if($type[1] == 'liked'){
    					$custom_link  	= get_permalink($item_id);
    				}
    				else if($type[1] == 'topicliked'){
    					$custom_link  	= get_permalink($item_id);
    				}
    				else if($type[1] == 'commentliked'){
    					$custom_link  	= get_comment_link( $item_id );
    				}
    				else if($type[1] == 'activityliked'){
    					$custom_link  	= bp_activity_get_permalink( $item_id );
    				}
    				// WordPress Toolbar
    				if ( 'string' === $format ) {
    					$return = apply_filters( 'wp_ulike_bp_notifications_template', '<a href="' . esc_url( $custom_link ) . '" title="' . esc_attr( $custom_text ) . '">' . esc_html( $custom_text ) . '</a>', $custom_text, $custom_link );
    				// Deprecated BuddyBar
    				} else {
    					$return = apply_filters( 'wp_ulike_bp_notifications_template', array(
    						'text' => $custom_text,
    						'link' => $custom_link
    					), $custom_link, (int) $total_items, $custom_text, $custom_text );
    				}
    				// global wp_filter to call bbPress wrapper function
    				if( isset( $wp_filter['bp_notifications_get_notifications_for_user'][10]['bbp_format_buddypress_notifications'] ) ) {
    					if( version_compare( $wp_version, '4.7', '>=' ) ) {
    						// https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/
    						$wp_filter['bp_notifications_get_notifications_for_user']->callbacks[10]['bbp_format_buddypress_notifications']['function'] = 'wp_ulike_bbp_format_buddypress_notifications';
    					} else {
    						$wp_filter['bp_notifications_get_notifications_for_user'][10]['bbp_format_buddypress_notifications']['function'] = 'wp_ulike_bbp_format_buddypress_notifications';
    					}
    				}
    			}
    
    			return $return;
    		}
    		add_filter( 'bp_notifications_get_notifications_for_user', 'wp_ulike_format_buddypress_notifications', 5, 5 );
    	}
    Plugin Author Alimir

    (@alimir)

    Fixed on V3.5.1

    I’m sorry to inform you, Alimir @alimir, that I’m seeing this problem *again* on my live site. I’m currently using v3.5.2

    My users keep reporting blank titles to their notifications and it’s driving me crazy. WP ULike is the *best* WP like plugin we have. Please fix this and keep us all quiet! 🙂

    As I reported in a separate thread, I’m experiencing notification issues as well. My issue is that like notifications are impossible to clear permanently. It looks like they’re all gone, but refreshed they return. So now some users have 300+ notifications they can’t get rid of.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.