Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter bullemhead

    (@bullemhead)

    Here is some example code that finds posts across the network based on number of comments. I think it could be altered, but I’m not sure how.

    global $wpdb;
    global $table_prefix;
    
    // get an array of the table names that our posts will be in
    // we do this by first getting all of our blog ids and then forming the name of the
    // table and putting it into an array
    $rows = $wpdb->get_results( "SELECT blog_id from $wpdb->blogs WHERE
        public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0';" );
    if ( $rows ) :
        $blogPostTableNames = array();
        foreach ( $rows as $row ) :
            $blogPostTableNames[$row->blog_id] = $wpdb->get_blog_prefix( $row->blog_id ) . 'posts';
        endforeach;
    
        // now we need to do a query to get all the posts from all our blogs
        // ordered by the number of comments and with limits applied
        if ( count( $blogPostTableNames ) > 0 ) :
            $query = '';
            $i = 0;
            foreach ( $blogPostTableNames as $blogId => $tableName ) :
                if ( $i > 0 ) :
                    $query.= ' UNION ';
                endif;
                $query.= " SELECT ID, post_type, $blogId as <code>blog_id</code> FROM $tableName WHERE post_type = 'prompt' AND post_status = 'publish' ";
                $i++;
            endforeach;
    
            $rows = $wpdb->get_results( $query );
    
            // now we need to get each of our posts into an array and return them
            if ( $rows ) :
                $posts = array();
                foreach ( $rows as $row ) :
                    $posts[] = get_blog_post( $row->blog_id, $row->ID );
                endforeach;
                print_r($posts);
                return $posts;
                echo ('<br /><br />');
            endif;
        endif;
    endif;
    Thread Starter bullemhead

    (@bullemhead)

    So I guess what I’m looking for is the appropriate SQL query to run so I can know which blog to switch to.

    Thread Starter bullemhead

    (@bullemhead)

    Yeah it would have to be custom SQL because I can’t switch to a blog before knowing which one to switch to.

    I’ll 3rd that. Haven’t been able to find anything on this.

    We have over 600 categories on evilvlog.com. Not useful or anything, but we use wordpress as sort of an art, some posts have 40 categories. Sometimes we add 20 new categories for a single post.

    Anyhow, this is slowing down our posting considerably, I guess because it has to load all those categories.

    Is there any way to get around this? (other than “don’t use so many categories”)

    One of the goals of Evilvlog.com is to break wordpress, and we have succeeded many times, but we’ve found workarounds for everything but this.

    bullemhead

    (@bullemhead)

    Thanks for the reply Moshu. I knew about the /feed location, but the location I posted had been working previously. We had to reinstall WP last week due to database problems and everything got messed up.

    I created 2 modified feed templates:
    https://www.thepan.org/admin/wp-rss2-qt.php
    https://www.thepan.org/admin/wp-rss2-wmv.php

    They are identical to the default rss2 feed, but their enclosures pull from the c2c get_custom plugin in order to distinguish between our different video types.

    Anyhow, neither of them are working anymore after our reinstall, and I can’t figure out why.

    Is it just a matter of having them in the wrong place?

    I feel like I need to tell WordPress to go look for them and populate them somehow.

    bullemhead

    (@bullemhead)

    Same problem here:
    https://www.thepan.org/admin/wp-rss2.php

    This is really strange.

    Forum: Fixing WordPress
    In reply to: RSS 2.0 Enclosures

    Hello,

    I can’t get this to work either, trying to use it for separate WMV and Quicktime feeds.

    Parsing error, it says.

    Wish I knew PHP so I could tell what’s going on.

    Videobloggers around the world would be very happy to have a working answer to this problem!

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