Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom post type


  • jaaahaaa
    Participant

    @jaaahaaa

    Hi,

    I’m running a plugin called ignitiondeck for wordpress. This plugin creates a custom post type for projects called ‘ignition_product’. These pages allow for comments, but I can’t get buddypress to track mentions in these comments.

    Site tracking is on and comment notifications works for my page comments. I’ve tried using in my functions.php but it doesn’t help.

    add_filter ( ‘bp_blogs_record_post_post_types’, ‘activity_publish_custom_post_types’,1,1 );
    function activity_publish_custom_post_types( $post_types ) {
    $post_types[] = ‘ignition_product’;
    return $post_types;
    }

    Running 2.6.1.1

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

  • jaaahaaa
    Participant

    @jaaahaaa

    GOt this from debugging:

    Debugging

    Bails here:
            // Bail if the activity type does not exist
            if ( empty( $activity_post_object->comments_tracking->action_id ) ) {
                return false;

    Line 2324


    danbp
    Participant

    @danbp

    Have you read this tutorial ?

    Note that most of BP custom functions for core are better handled when living in bp-custom.php. Sometimes also, a same function may work from within one file, but not from the other. In other case, which file has no real importance.
    Even if in background there is a hierarchy and a load order, to take in account for the file choice.

    That said, as it is related to CPT, bp-custom is the best place IMO.

    Theme’s functions.php contains functions related to theme, templating and evtl. wp stuff
    BP custom functions goes to bp-custom.php

    It’s also better for you to have such separated functions.


    jaaahaaa
    Participant

    @jaaahaaa

    I have tried both methods and also moved it to bp-custom.php but it does not make any difference, still no luck 🙁


    danbp
    Participant

    @danbp

    And no luck too by following instructions from the tutorial ?


    jaaahaaa
    Participant

    @jaaahaaa

    Solved!!

    What I was testing was tracking comments. I realized that it worked by using the tutorial for tracking when new objects are created.

    However, comments did not work so I ended up editing the creation of the custom post type. Posting the full code here if anyone else googles ignitiondeck buddypress integration:

    ignitiondeck-admin.php line 5 to 46:

    add_action( 'init', 'ign_create_post_type' );
    function ign_create_post_type() {
    	require 'languages/text_variables.php';
    	$slug = apply_filters('idcf_archive_slug', __('projects', 'ignitiondeck'));
    	register_post_type( 'ignition_product',
    		array(
    			'labels' => array(
    				'name' => $tr_Projects,
    				'singular_name' => $tr_Project,
    				'add_new' => $tr_Add_New_Project,
    				'add_new_item' => $tr_Add_New_Project,
    				'edit' => $tr_Edit,
    				'edit_item' => $tr_Edit_Project,
    				'new_item' => $tr_New_Project,
    				'view' => $tr_View_Project,
    				'view_item' => $tr_View_Project,
    				'search_items' =>$tr_Search_Project,
    				'not_found' => $tr_No_Products_found ,
    				'not_found_in_trash' => $tr_No_Product_in_Trash,
    				'all_items' => __( 'All Videos' ),
    			),
                'public' => true,
    			'show_in_nav_menus' => true,
    			'show_ui' => true,
    			'publicly_queryable' => true,
    			'exclude_from_search' => false,
    			'hierarchical' => apply_filters('idcf_hierarchical', false),
    			'menu_position' => 5,
    			'capability_type' => 'post',
    			'menu_icon' => plugins_url( '/images/ignitiondeck-menu.png', __FILE__ ),
    			'query_var' => true,
    			'rewrite' => apply_filters('id_register_project_post_rewrite', array('slug' => $slug, 'with_front' => true)),
    			'has_archive' => apply_filters('id_register_project_post_has_archive', $slug),
    			'supports' => array( 'title', 'author', 'editor', 'thumbnail', 'revisions', 'comments', 'buddypress-activity' ),
    			'taxonomies' => array('category', 'post_tag', 'project_category'),
    			'bp_activity' => array(
    			    'action_id'         => 'new_ignition_product',
    			    'comment_action_id' => 'new_ignition_product_comment',
    			)
    		)
    	);
    }

    danbp
    Participant

    @danbp

    Glad you got it !

    Sad you did it wrong by hacking a plugin core file (ignitiondeck-admin.php). What will happen to your modification at next Ignitiondeck update ?

    Couldn’t your filter work from within bp-custom.php or theme’s functions.php ?
    Has that plugin no hooks to extend it ?

    IMO a generous bad good idea.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar