The MU forums have moved to WordPress.org

Dashboard RSS (2 posts)

  1. carnold
    Member
    Posted 15 years ago #

    When i was using 1.3.3, i entered some RSS links into the dashboard area, other than the dev RSS and other wordpress news. With 1.5.1, i can not figure out how to enter in these new RSS feeds. Can someone set me right on this?
    Old index-extra.php:

    case 'devnews' :
    $rss = @fetch_rss(apply_filters( 'dashboard_primary_feed', 'http://www.crosswalk.com/rss/' ));
    if ( isset($rss->items) && 0 != count($rss->items) ) {
    ?>
    <h3><?php echo apply_filters( 'dashboard_primary_title', __('Christian News') ); ?></h3>
    <?php
    $rss->items = array_slice($rss->items, 0, 3);
    foreach ($rss->items as $item ) {
    ?>
    <h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> — <?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4>
    <p><?php echo $item['description']; ?></p>
    <?php
    	}
    }
    ?>
    
    <?php
    break;
    
    case 'planetnews' :
    $rss = @fetch_rss(apply_filters( 'dashboard_secondary_feed', 'http://www.bpnews.net/BPNewsRSS.asp' ));
    if ( isset($rss->items) && 0 != count($rss->items) ) {
    ?>
    <h3><?php echo apply_filters( 'dashboard_secondary_title', __('Other Christian New') ); ?></h3>
    <ul>
    <?php
    $rss->items = array_slice($rss->items, 0, 20);
    foreach ($rss->items as $item ) {
    $title = wp_specialchars($item['title']);
    $author = preg_replace( '|(.+?):.+|s', '$1', $item['title'] );
    $post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
    ?>
    <li><a href='<?php echo wp_filter_kses($item['link']); ?>'><span class="post"><?php echo $post; ?></span><span class="hidden"> - </span><cite><?php echo $author; ?></cite></a></li>
    <?php
    	}
    ?>
    </ul>
    <p class="readmore"><a href="<?php echo apply_filters( 'dashboard_secondary_link', 'http://planet.wordpress.org/' ); ?>"><?php _e('Read more &raquo;'); ?></a></p>
    <?php
    }
    break;
    }
    
    ?>

    New index-extra.php

    case 'incominglinks' :
    	wp_dashboard_incoming_links_output();
    	break;
    
    case 'devnews' :
    	wp_dashboard_rss_output( 'dashboard_primary' );
    	break;
    
    case 'planetnews' :
    	wp_dashboard_secondary_output();
    	break;
    
    case 'plugins' :
    	wp_dashboard_plugins_output();
    	break;
    
    }
    
    ?>
  2. dsader
    Member
    Posted 15 years ago #

    You can edit dashboard.php in wp-admin/includes, but it'll only change the feed for brand new blogs. The defaults are slapped into the db as a dashboard widget option when the blog is created. An add_filter mu-plugin will change the defaults so no core files are edited, but it won't change the options already written to the db.
    <?php
    function default_link($link) {
    $link = 'http://default.domain.org/';
    return $link;
    }
    function default_feed($feed) {
    $feed = 'http://default.domain.org/path/feed/';
    return $feed;
    }
    function default_title($title) {
    $title = 'Default Title';
    return $title;
    }
    add_filter( 'dashboard_secondary_link', 'default_link' );
    add_filter( 'dashboard_secondary_feed', 'default_feed' );
    add_filter( 'dashboard_secondary_title', 'default_title' );
    ?>

About this Topic