atmojones (@atmojones)

Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)

  • atmojones
    Participant

    @atmojones

    Hmmm @slomeli79 it’s been awhile since I worked on this. I see this code in my functions.php file but I hesitate to think the solution was this simple. Try it out, and if it doesn’t work I’ll check the rest of my code.

    
    function custom_bbpress_maybe_load_mentions_scripts( $retval = false ) {
    
    	return true;
    }
    add_filter( 'bp_activity_maybe_load_mentions_scripts', 'custom_bbpress_maybe_load_mentions_scripts' );
    

    atmojones
    Participant

    @atmojones

    I discovered why this is happening but I don’t know why the why is happening. Every 2nd space in the post is being replaced with a n-b-s-p-; thereby causing the character directly before the “@” to be a “;” whenever an even number of spaces is put in the post.

    @robkk @elhardoum thanks for your help thus far, I will post another update when I know why spaces are being converted to nbsp.

    I am using tinyMCE for forum posting. Perhaps it is part of the problem.


    atmojones
    Participant

    @atmojones

    @Robkk any thoughts?

    So I made a clean install of WordPress and bbPress (and then after a few test posts I installed buddypress which didn’t change anything) and made 2 users. When I @mention a user in the forum it links correctly regardless of how many spaces I enter. HOWEVER, it does always strip the leading spaces down to 1 in the presentation of the post. If I click Edit on the post the original number of spaces can be seen. Is this intended behavior?

    I’m going to make the changes to functions.php to enable the visual editor and to enable buddypress @mention suggestions in bbPress visual editor (like my production site) and see if the error reproduces.


    atmojones
    Participant

    @atmojones

    So I made a clean install of WordPress and bbPress (and then after a few test posts I installed buddypress which didn’t change anything) and made 2 users. When I @mention a user in the forum it links correctly regardless of how many spaces I enter. HOWEVER, it does always strip the leading spaces down to 1 in the presentation of the post. If I click Edit on the post the original number of spaces can be seen. Is this intended behavior?

    I’m going to make the changes to functions.php to enable the visual editor and to enable buddypress @mention suggestions in bbPress visual editor (like my production site) and see if the error reproduces.


    atmojones
    Participant

    @atmojones

    @robkk

    Can you point me to the function that converts @mentions to links. I feel like I can figure this out but I can’t find where it’s being converted.


    atmojones
    Participant

    @atmojones

    Yeah its definitely the right username. Like I said, the @mention autosuggest works when writing the post and in the users activity feed the username is a working link. It’s just in the forum post that it doesn’t become a link. It’s very odd. I went in to the database and edited the post, just adding one space at a time, and whenever there was an even number of spaces the username doesn’t link in the forum.


    atmojones
    Participant

    @atmojones

    So mentions.min.js has this code

    bp.mentions.tinyMCEinit = function() {
    		if ( typeof window.tinyMCE === 'undefined' || window.tinyMCE.activeEditor === null || typeof window.tinyMCE.activeEditor === 'undefined' ) {
    			return;
    		} else {
    			$( window.tinyMCE.activeEditor.contentDocument.activeElement )
    				.atwho( 'setIframe', $( '.wp-editor-wrap iframe' )[0] )
    				.bp_mentions( bp.mentions.users );
    		}
    	};

    I think you’ll find that if you put an alert in a js file on forum page load that the if statement returns true. I guess it loads too early and tinyMCE isn’t initialized yet. Try loading in your functions.php a js file with this code:

    jQuery(document).ready(function($) {
    	
    	/* necessary to get @ mentions working in the tinyMCE on the forums */
    	window.onload = function() { 
    	      my_timing = setInterval(function(){myTimer();},1000);
    	      function myTimer() {
    	        if (typeof window.tinyMCE !== 'undefined' && window.tinyMCE.activeEditor !== null && typeof window.tinyMCE.activeEditor !== 'undefined') {  
    		        $( window.tinyMCE.activeEditor.contentDocument.activeElement )
    					.atwho( 'setIframe', $( '.wp-editor-wrap iframe' )[0] )
    					.bp_mentions( bp.mentions.users );
    				 window.clearInterval(my_timing);
    		    }
    	      }
    	      myTimer();
    	};
    })

    I don’t remember where I found this code, but it’s not mine, it just took a long time to find. I think just adding this will work but if it doesn’t get back to me and we’ll work this out

Viewing 7 replies - 1 through 7 (of 7 total)