Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • Robin W
    Participant

    @robin-w

    🙂


    Robin W
    Participant

    @robin-w


    Robin W
    Participant

    @robin-w

    @imath I’m not sure you are getting informed of my question in

    https://bbpress.trac.wordpress.org/ticket/3576


    Robin W
    Participant

    @robin-w

    Great 🙂


    Robin W
    Participant

    @robin-w

    After kicking this around, I found that

    add_filter( ‘tiny_mce_before_init’, ‘cac_enable_mentions_in_group_forum_tinymce’, 10, 2 );

    is never fired, presume this is an order thing.

    After some further research, I created a small plugin that has some much of the above, but also some js that executes for the visual version.

    available at

    bbp Mentions Suggest


    Robin W
    Participant

    @robin-w

    @r-a-y

    I know this is an old thread, but I can’t get your excellent code working for tinymce on topic/reply front end.

    Works fine in tinymce on backend, Works fine for textarea on front end, but not timymce on front end. I need it working on frontend in forums.

    Is there a more up to date version that works with current bp and bbp, or do you have any ideas how to get it working.

    the code I am using is

    /**
     * Enable at-mention autocomplete on BuddyPress group forum textareas.
     */
    function my_enable_mentions_in_group_forum_textareas( $retval ) {
    	$bbpress = false;
    
    	// Group forum reply.
    	if ( bp_is_group() && 'topic' === bp_action_variable() && bp_action_variable( 1 ) ) {
    		$bbpress = true;
    	}
    
    	// Group forum topic.
    	if ( bp_is_group() && bp_is_current_action( 'forum' ) ) {
    		$bbpress = true;
    	}
    
    	// Do stuff when on a group forum page.
    	if ( true === $bbpress ) {
    		$retval = true;
    		
    		// Ensure at-mentions autocomplete works with TinyMCE for bbPress.
    		add_filter( 'tiny_mce_before_init', 'cac_enable_mentions_in_group_forum_tinymce', 10, 2 );
    	}
    
    	return $retval;
    }
    add_filter( 'bp_activity_maybe_load_mentions_scripts', 'my_enable_mentions_in_group_forum_textareas' );
    
    /**
     * Ensure at-mentions autocomplete works with TinyMCE for bbPress.
     *
     * @param array  $settings   An array with TinyMCE config.
     * @param string $editor_id Unique editor identifier, e.g. 'content'.
     * @return array  $mceInit   An array with TinyMCE config.
     */
    function cac_enable_mentions_in_group_forum_tinymce( $settings, $editor_id ) {
    	// Add bbPress' editor IDs to enable BP mention autocomplete.
    	if ( 'bbp_topic_content' === $editor_id || 'bbp_reply_content' === $editor_id ) {
    		$settings['init_instance_callback'] = 'window.bp.mentions.tinyMCEinit';
    	}
    
    	return $settings;
    }
Viewing 6 replies - 1 through 6 (of 6 total)
Skip to toolbar