WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: ThreeWP Activity Monitor] Support for pages and custom post types (2 posts)

  1. Ov3rfly
    Member
    Posted 2 years ago #

    ThreeWP Activity Monitor Version 2.3

    If you want to add support for pages, sub-pages and custom post types, locate this code-block in file ThreeWP_Activity_Monitor.php near line 1570:

    private function post_is_for_real($post)
    {
    	// Posts must be published and the parent must be 0 (meaning no autosaves)
    	// Also: posts must actually be posts, not pages or menus or anything.
    	if ( !is_object($post) )
    		return false;
    	return $post->post_status == 'publish' && $post->post_parent == 0 && $post->post_type == 'post';
    }

    Replace with this:

    private function post_is_for_real($post)
    {
    	// Posts must be published
    	// Also: posts must actually be a post or page or custom post type.
    	if ( !is_object($post) )
    		return false;
    	$post_types = array('post', 'page');
    	$custom_post_types = get_post_types(array('public' => true, '_builtin' => false));
    	$post_types = array_merge($post_types, $custom_post_types);
    	return $post->post_status == 'publish' && in_array($post->post_type, $post_types);
    }

    Note that the explaination in comment the parent must be 0 (meaning no autosaves) is not correct, in WP 3.2.1 autosaves have post_status 'inherit'.

    For correct links to non-'post' post types in activities overview, here is a fix.

    http://wordpress.org/extend/plugins/threewp-activity-monitor/

  2. edward mindreantre
    Member
    Posted 2 years ago #

    Will be included in 2.5

Topic Closed

This topic has been closed to new replies.

About this Topic