• Resolved 8bit7

    (@8bit7)


    The error message for the transfer addon isn’t displaying on the page properly. Instead it’s just echoing right after the body tag. This is really bad for my site and I’ve been trying to move it and even tried making a custom plugin to do so, but I’ve discovered it’s simply being echoed in /wp-content/plugins/mycred/addons/transfer/includes/mycred-transfer-object.php instead of returned.

    I can comment out the echo, but then obviously there is no error being shown even though there should be (the test user has no points, so he gets the error-minimum “You do not have enough points to make a transfer.” error.)

    How do you suggest I fix this? I would be fine showing the message after the page header, but it sure would be great to show it where the shortcode is being used on the page instead.

    screenshot: https://i.imgur.com/OacmuZi.jpg

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter 8bit7

    (@8bit7)

    To clarify the issue is in?/wp-content/plugins/mycred/addons/transfer/includes/mycred-transfer-object.php on line 1358. changing it to return $content and not echo $content fixes the problem.

    1. is this good to do and 2. How can I change this without modifying the core mycred files?

    	/**
    		 * Get Error Message
    		 * @since 1.8
    		 * @version 1.0
    		 */
    		public function get_error_message( $return = false ) {
    
    			$content = '';
    			if ( ! empty( $this->errors ) ) {
    				foreach ( $this->errors as $error_code => $message ) {
    
    					$content = '<div class="alert alert-warning error-' . $error_code . '"><p>' . $message . '</p></div>';
    
    				}
    			}
    
    			$content = apply_filters( 'mycred_transfer_form_errors', $content, $this );
    
    			if ( $return )
    				return $content;
    
    			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    			return $content; // MY EDIT -#- WAS ECHO, NOW IS RETURN. 
    
    		}
    

    Hello @8bit7 ,

    Thanks for contacting us.

    Hope you are doing well, Instead of making changes in the content/plugins/mycred/addons/transfer/includes/mycred-transfer-object.php file, We recommend you to make changes in content/plugins/mycred/addons/transfer/includes/mycred-transfer-shortcodes file on line number 74.

    Modify the code as follows:

    $output = do_shortcode( $transfer->get_error_message(true) );

    It is the proper fix for the issue. This change will also be included in our upcoming release myCred 2.5.1

    Let me know if you have any question.

    Thanks & Regards,

    WP Experts Support Team

    Thread Starter 8bit7

    (@8bit7)

    Awesome. Glad to hear it’s being fixed ??
    I did as you said and can confirm it is still working perfectly. Thanks so much!

    Thanks for the update. We are glad your issue is fixed.

    Let me know if you have any question. We will help you out.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Transfer Addon Error Message Not Returning’ is closed to new replies.