Skip to Content.
Sympa Menu

lyceum-users - [Lyceum-users] "All blogs" hack

lyceum-users AT lists.ibiblio.org

Subject: Lyceum-users mailing list

List archive

Chronological Thread  
  • From: "Alexander Wasiljev (home account)" <rudut AT tks.ru>
  • To: Lyceum-users AT lists.ibiblio.org
  • Subject: [Lyceum-users] "All blogs" hack
  • Date: Mon, 13 Nov 2006 12:20:41 +0300

Hi people!

John, great work! Lyceum is the best!

So, I made "dirty" hack for Lyceum, it shows metablog with all posts from all
blogs (feeds, search, archives are supported!)
Warning! My system is configured NOT for subdomains! I don't know how my hack
will work on subdomain config.

Main idea is create blog (e.g. with slug 'all') and catch requests for these
blog.

Solution:
1. Follow hack instructions.
2. Create blog, remember slug for it (my choise is "all")
3. Go to System admin, fill option "All blogs metablog slug" with created
blog's slug.
4. voila :)

Working system (sorry, in russian with windows-1251 charset):
http://blogs.tks.ru/all



Hack instructions
==================
File: lib/wp-includes/classes.php
Catch requests to our metablog

near line 487

AFTER
--
$join ="
INNER JOIN $wpdb->post2cat ON
($wpdb->post2cat.post_id = $wpdb->posts.ID)
INNER JOIN $wpdb->categories ON
($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) ";
$blogblog = " AND $wpdb->categories.blog = '$blog' ";
--
INSERT
--
// Al
if (get_option('allblogs_slug') == $_REQUEST['b']) $blogblog = '';
// eof Al
--

===

Files: lyceum/wp-content/_your_theme_/index.php
lyceum/wp-content/_your_theme_/archive.php
lyceum/wp-content/_your_theme_/search.php

right links on posts, comments etc

AFTER
--
<?php if (have_posts()) : ?>
--
INSERT
--
<?php
global $blog;
$old_blog = $blog;
?>
--

AFTER
--
<?php while (have_posts()) : the_post(); ?>
--
INSERT
--
<?php
$blog = $post->blog;
?>
--

AFTER --
<?php endwhile; ?>
--
INSERT
--
<?php $blog = $old_blog;
?>
--
===

File: liceum/wp-commentsrss.php
comments feed for all blogs

near line 30
BEFORE --
if (is_single() || is_page()) {
$comments = $wpdb->get_results("
--
INSERT
--
// Al
$blogblog = '';
if (get_option('allblogs_slug') != $_REQUEST['b']) $blogblog = "blog = '$blog'
AND";
// eof Al
--

near line 60
REPLACE --
WHERE blog = '$blog' AND
--
WITH
--
WHERE ".$blogblog."
--

===

File: lib/wp-includes/wp-db.php
Show archive

near line 300
AFTER --
function make_post_query($columns, $criteria){
global $blog;
--
INSERT
--
// Al
$blogblog = "blog = '$blog' AND";
if (get_option('allblogs_slug') == $_REQUEST['b']) {
$blogblog = '';
}
// eof Al
--

near line 315
REPLACE --
WHERE
$blogblog
--
WITH
--
WHERE
blog = '$blog' AND
--

===

File lyceum/wp-content/_your_theme_/sidebar.php
hide Categories from sidebar

near line 45
before insert (1) after insert (2)

-- <li><h2>Categories</h2>
<ul>
<?php
wp_list_cats('sort_column=name&optioncount=1&hierarchical=1'); ?>
</ul>
</li>
--

(1)
--
<?php // Al
if (get_option('allblogs_slug') != $_REQUEST['b']) { ?>
--
(2)
--
<?php
} // eof Al
?>
--

===

File lyceum/system-admin/settings.php

at any place
INSERT
--
<form method="post" action="setoption.php">
<?php echo tokeninput('setoption.php', 'allblogs_slug')?>
<fieldset>
<legend>All blogs metablog slug</legend>
<input type="hidden" name="option" value="allblogs_slug" />
<p><input type="text" name="value" size="100" maxlength="100"
value="<?php echo get_option('allblogs_slug') ?>" />
<input type="submit" value="Submit" name="submit" /></p>
</fieldset>
</form>
--
==================

--
Al
http://blogs.tks.ru





Archive powered by MHonArc 2.6.24.

Top of Page