Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 40 total)
  • @bigkahunaburger

    Participant

    Please? 🙂

    @bigkahunaburger

    Participant

    Anyone?

    @bigkahunaburger

    Participant

    I should add we are NOT using Activity, Groups or Forums. So it is just profile/user data we are concerned with.

    @bigkahunaburger

    Participant

    @bigkahunaburger

    Participant

    THANKS @danbp & @shanebp

    I used @shanebp’s solution, but they both worked.

    @bigkahunaburger

    Participant

    Anyone know how to do this?

    Thanks

    @bigkahunaburger

    Participant

    @djpaul Any ideas on how to get this working?

    @bigkahunaburger

    Participant

    @jbboro3 @danbp

    I went back to BP version 2.3.5 and the visual editor still didn’t work. I wonder if changes to WP are the cause.

    @bigkahunaburger

    Participant

    @jbboro3 Just to save some time can we refer to the “rich text editor” as the “visual tab” and tinymce as “text tab”? Just so people don’t get confused. 🙂

    If you have a solution for the “What’s new” post form and the comments that allows you to use the “visual tab” I can test it out and see if I can figure out anything for nested replies.

    @bigkahunaburger

    Participant

    @jbboro3 Oh wait that is the code just for the tinymce. I’m trying to remember if I ever had the rich text editor working for comments.

    Here is the code I was using for what’s new (its modified slightly for the plugin I posted above):

    
    function bpfr_whats_new_tiny_editor() {
    		$dwqa_tinymce_css = apply_filters( 'dwqa_editor_style', DWQA_URI . 'templates/assets/css/editor-style.css' );
    		$toolbar1 = apply_filters( 'dwqa_tinymce_toolbar1', 'bold,italic,underline,|,' . 'bullist,numlist,blockquote,|,' . 'link,unlink,|,' . 'image,code,|,'. 'spellchecker,fullscreen,dwqaCodeEmbed,|,' );
    wp_editor(
    	isset( $_GET['r'] ) ? '@' . esc_attr( $_GET['r'] ) : '',
    	'whats-new',
    	
    	array(
    		'textarea_name' => 'whats-new',
    		'editor_class'  => 'whats-new-mce',
    		'editor_height' => 200,
    		'media_buttons' => false, 
    		'quicktags' => false,
    		'tinymce' => array(
    						'toolbar1' => $toolbar1,
    						'toolbar2'   => '',
    						'content_css' => $dwqa_tinymce_css
    				)
    
    	)
    );
    }
    add_action( 'whats_new_textarea', 'bpfr_whats_new_tiny_editor' );

    I need to do some digging too see if I have something for the rich editor in comments. I tired so many different things trying to get it working I forgot where I left off.

    @bigkahunaburger

    Participant

    Hi @jbboro3

    I had replies working before, but now has the same issues as the main activity editor:

    https://buddypress.org/support/topic/add-tinymce-to-activity-post-reply-form/

    @bigkahunaburger

    Participant

    Thanks @danbp

    That’s kind of like the BuddyBoss Media plugin we almost used.

    BuddyBoss Media

    It still has the problem of storing images on your server.

    I wish I knew what they changed to make the old trick stop working. Maybe then I could reverse engineer it.

    @bigkahunaburger

    Participant

    @danbp

    Did you have any tips on editing that js file?

    I know this is one of those “don’t try this at home kids” type of things, however I think I’m a trained professional, just not at js. I’ve spent I long time removing the media buttons and other problematic buttons. I used your old trick and had everything working. However I really needed images so I put everything aside I went with a BP gallery plugin. It was safe (or as safe as you can get), but it still saved photos on our sever.

    I was going to scrap Activity altogether and go back to good old bbPress, but then I found this:

    https://codecanyon.net/item/dw-tinymce-imgur-upload-wordpress-plugin/16386641

    It instantly uploads user images to imgur seamlessly. All my dreams where answered. No more bloated hard drives with user images and no need to leave the site to upload to a image host.

    Sadly (as you know), when I put the editor code back in place the trick no longer worked.

    Sorry for the long story. The great thing about WP & BP (most of the time) is you can expand beyond what was intended. Making thing “idiot proof” is not going to stop idiots, just innovation.

    Anyway if you have some tips that would be great. And you may want to check out that plugin (I have nothing to do with it).

    Best,
    Big Kahuna Burger 😛

    @bigkahunaburger

    Participant

    You may want to look at creating member types. Then you could add the meta as a div class and style them via css:

    Member Types

    https://gist.github.com/imath/3a5c5ade44eae997fdfd

    If you don’t have the ability to code or hire someone that does you may want to try some of the member type plugins out there:

    BuddyPress Member Types

    https://wordpress.org/plugins/bp-member-type-generator/

    @bigkahunaburger

    Participant

    @danbp So any guesses or dirty jokes?

    @bigkahunaburger

    Participant

    I know there have been some changes recently in the way the js mentions work, but after digging though the Trac I wasn’t able to find a solution or cause.

    @bigkahunaburger

    Participant

    Here is my code:

    function bpfr_whats_new_tiny_editor() {
    wp_editor(
    	isset( $_GET['r'] ) ? '@' . esc_attr( $_GET['r'] ) : '',
    	'whats-new',
    	array(
    		'textarea_name' => 'whats-new',
    		'editor_class'  => 'whats-new-mce',
    		'editor_height' => 200,
    		'media_buttons' => false, 
    		'quicktags' => false,
    		'tinymce' => array(
    			'toolbar1' => 'bold,italic,underline,|,blockquote,|,bullist,numlist,|,link,unlink,|,spellchecker,|,undo,redo',
    			'toolbar2' => ''
    		)
    	)
    );
    }
    add_action( 'whats_new_textarea', 'bpfr_whats_new_tiny_editor' );
    <div id="whats-new-textarea">		
       <?php do_action( 'whats_new_textarea' ); ?>				
    </div>

    @bigkahunaburger

    Participant

    The standard Activity form appears below the visual editor instead of being replaced by it.

    @bigkahunaburger

    Participant

    @danbp Thanks for you quick reply.

    I don’t believe so.

    I want to set:

    'quicktags' => false

    Then set user_can_richedit to true:

    add_filter ( 'user_can_richedit' , create_function ( '$a' , 'return true;' ) , 50 );

    So now only the “visual editor” tab will show and the “quicktags tab” will not. However I can not get the visual editor to work. It shows up fine, but the content is not getting submitted. I just get that no content alert (“Please enter some content to post.”) when hitting submit.

    @bigkahunaburger

    Participant

    Try this. It may be the dash in the function name (I edited it in a hurry):

    
    function new_sfwd_courses_include_post_type_title( $action, $activity ) {
    	if ( empty( $activity->id ) ) {
    		return $action;
    	}
    
    	if ( 'new_sfwd-courses' != $activity->type ) {
    		return $action;
    	}
    
    	preg_match_all( '/<a.*?>([^>]*)<\/a>/', $action, $matches );
    
    	if ( empty( $matches[1][1] ) || '[Course]' != $matches[1][1] ) {
    		return $action;
    	}
    
    	$post_type_title = bp_activity_get_meta( $activity->id, 'post_title' );
    
    	if ( empty( $post_type_title ) ) {
    
    		switch_to_blog( $activity->item_id );
    
    		$post_type_title = get_post_field( 'post_title', $activity->secondary_item_id );
    
    		// We have a title save it in activity meta to avoid switching blogs too much
    		if ( ! empty( $post_type_title ) ) {
    			bp_activity_update_meta( $activity->id, 'post_title', $post_type_title );
    		}
    
    		restore_current_blog();
    	}
    
    	return str_replace( $matches[1][1], esc_html( $post_type_title ), $action );
    }
    add_filter( 'bp_activity_custom_post_type_post_action', 'new_sfwd_courses_include_post_type_title', 10, 2 );

    @bigkahunaburger

    Participant

    Anyone have any ideas on this? I have been trying to figure out the same thing.

    Thanks

    @bigkahunaburger

    Participant

    @henrywright

    Thanks for your reply. Can you help me out with a few more details? This is what I’m using to get the title of the new post in the activity feed. It works fine for the new posts but doesn’t seem to work for comments:

    function dailies_comments_include_post_type_title( $action, $activity ) {
    	if ( empty( $activity->id ) ) {
    		return $action;
    	}
    
    	if ( 'new_dailies_comment' != $activity->type ) {
    		return $action;
    	}
    
    	preg_match_all( '/<a.*?>([^>]*)<\/a>/', $action, $matches );
    
    	if ( empty( $matches[1][1] ) || '[Title]' != $matches[1][1] ) {
    		return $action;
    	}
    
    	$post_type_title = bp_activity_get_meta( $activity->id, 'post_title' );
    
    	if ( empty( $post_type_title ) ) {
    
    		switch_to_blog( $activity->item_id );
    
    		$post_type_title = get_post_field( 'post_title', $activity->secondary_item_id );
    
    		// We have a title save it in activity meta to avoid switching blogs too much
    		if ( ! empty( $post_type_title ) ) {
    			bp_activity_update_meta( $activity->id, 'post_title', $post_type_title );
    		}
    
    		restore_current_blog();
    	}
    
    	return str_replace( $matches[1][1], esc_html( $post_type_title ), $action );
    }
    add_filter( 'bp_activity_custom_post_type_post_action', 'dailies_comments_include_post_type_title', 10, 2 );

    @bigkahunaburger

    Participant

    Try this (the second function adds the course title):

    
    function customize_page_tracking_args() {
        if ( ! bp_is_active( 'activity' ) ) {
            return;
        }
         add_post_type_support( 'sfwd-courses', 'buddypress-activity' );
     
     
        bp_activity_set_post_type_tracking_args( 'sfwd-courses', array(
            'action_id'                         => 'new_sfwd-courses',
            'bp_activity_admin_filter'          => __( 'Published a new course', 'custom-textdomain' ),
            'bp_activity_front_filter'          => __( 'Course', 'custom-textdomain' ),
            'bp_activity_new_post'              => __( '%1$s wrote a new course, <a href="%2$s">[Course]</a>', 'custom-textdomain' ),
            'bp_activity_new_post_ms'           => __( '%1$s wrote a new course, <a href="%2$s">[Course]</a>, on the site %3$s', 'custom-textdomain' ),
            'contexts'                          => array( 'activity', 'member' ),
            'comment_action_id'                 => 'new_sfwd-courses_comment',
            'bp_activity_comments_admin_filter' => __( 'Commented on a course', 'custom-textdomain' ),
            'bp_activity_comments_front_filter' => __( 'Course Comments', 'custom-textdomain' ),
            'bp_activity_new_comment'           => __( '%1$s commented on a <a href="%2$s">Course</a>', 'custom-textdomain' ),
            'bp_activity_new_comment_ms'        => __( '%1$s commented on a <a href="%2$s">Course</a>, on the site %3$s', 'custom-textdomain' ),
            'position'                          => 100,
        ) );
    }
    add_action( 'init', 'customize_page_tracking_args', 1000 );
    
    function new_sfwd-courses_include_post_type_title( $action, $activity ) {
    	if ( empty( $activity->id ) ) {
    		return $action;
    	}
    
    	if ( 'new_sfwd-courses' != $activity->type ) {
    		return $action;
    	}
    
    	preg_match_all( '/<a.*?>([^>]*)<\/a>/', $action, $matches );
    
    	if ( empty( $matches[1][1] ) || '[Course]' != $matches[1][1] ) {
    		return $action;
    	}
    
    	$post_type_title = bp_activity_get_meta( $activity->id, 'post_title' );
    
    	if ( empty( $post_type_title ) ) {
    
    		switch_to_blog( $activity->item_id );
    
    		$post_type_title = get_post_field( 'post_title', $activity->secondary_item_id );
    
    		// We have a title save it in activity meta to avoid switching blogs too much
    		if ( ! empty( $post_type_title ) ) {
    			bp_activity_update_meta( $activity->id, 'post_title', $post_type_title );
    		}
    
    		restore_current_blog();
    	}
    
    	return str_replace( $matches[1][1], esc_html( $post_type_title ), $action );
    }
    add_filter( 'bp_activity_custom_post_type_post_action', 'new_sfwd-courses_include_post_type_title', 10, 2 );

    @bigkahunaburger

    Participant

    Anyone have any ideas?

    @bigkahunaburger

    Participant

    Anyone know how to do this?

Viewing 25 replies - 1 through 25 (of 40 total)
Skip to toolbar