alzaran (@ajoyce2016)

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • @ajoyce2016

    Participant

    @ajoyce2016

    Participant

    I’ve found a function that enables autocomplete on any element of my choice. I’m reproducing it below:

    function buddydev_enable_mention_autosuggestions_on_compose( $load, $mentions_enabled ) {
    	if ( ! $mentions_enabled ) {
    		return $load; //activity mention is  not enabled, so no need to bother
    	}
    	//modify this condition to suit yours
    	if( is_user_logged_in() ) {
    		$load = true;
    	}
     
    	return $load;
    }
    add_filter( 'bp_activity_maybe_load_mentions_scripts', 'buddydev_enable_mention_autosuggestions_on_compose', 10, 2 );

    However, this only works with a textarea or input, I believe. TinyMCE, on the other hand, is an iframe with HTML elements generated on the fly. As such, when I try to initialize the function using the below:

    if ( jQuery( '#bbp_reply_content_ifr').get( 0 ) ) {
    		console.log('success');
    		jQuery('#bbp_reply_content_ifr').bp_mentions( bp.mentions.users );
    	}

    Nothing happens. What am I doing wrong? Buddypress supports the @mentions on TinyMCE instances (see here: https://buddypress.trac.wordpress.org/ticket/6972) and bbpress supports it in the plaintext editor. How can I enable it for the TinyMCE editor?

    @ajoyce2016

    Participant

    Fantastic! I attempted to do the same thing but neglected to remove_action, so this is exactly what I needed. Thanks for your help, it’s baffling to me that BBPress doesn’t make this an option out of the box.

    @ajoyce2016

    Participant

    I followed through that link as well, and though I don’t like modifying core, I did go through with it to get the ideal notification behavior. Any progress on a solid fix on that? Would it be possible to add that sort of thing as an option in bbpress-core? Just ridiculous that the default behavior doesn’t do it.

    @ajoyce2016

    Participant

    I’ll third it. I’m fine with hacking it, but need a more permanent solution. Perhaps a bp-custom solution using the right filters/actions (which are quite poorly documented, gotta say)

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