Skip to Content.
Sympa Menu

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

lyceum-users AT lists.ibiblio.org

Subject: Lyceum-users mailing list

List archive

Chronological Thread  
  • From: John Joseph Bachir <jjb AT ibiblio.org>
  • To: "Alexander Wasiljev (home account)" <rudut AT tks.ru>
  • Cc: Lyceum-users AT lists.ibiblio.org
  • Subject: Re: [Lyceum-users] "All blogs" hack
  • Date: Mon, 13 Nov 2006 22:14:09 -0500 (EST)

Alexander-

Wow, this looks like a very interesting hack.

Do you know how to generate a proper diff file? That would be more convenience for me to look at and possibly integrate into the code.

If you don't, could you make a zip file of your modified code, and send it to me? Then I can generate a proper diff file, and maybe we can document this on the wiki, make a ticket for it, possibly integrate it in the future, etc etc. Thanks!

Again, great work!

john




On Mon, 13 Nov 2006, Alexander Wasiljev (home account) wrote:

Small addition to hack solution:

==========
file lyceum/wp-rss2.php

make right links to post, comments etc

AFTER
--
<?php $items_count = 0; if ($posts) { foreach ($posts as $post) {
start_wp(); ?>
--
INSERT
--
<?php global $blog; $blog = $post['blog']; ?>
--
==========



Alexander Wasiljev (home account) ?????:
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>
--
==================

_______________________________________________
Lyceum-users mailing list
Lyceum-users AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/lyceum-users


--
John
----
aim/yim/msn/jabber.org: johnjosephbachir
713.494.2704
irc://irc.freenode.net/lyceum
http://lyceum.ibiblio.org/
http://blog.johnjosephbachir.org/




Archive powered by MHonArc 2.6.24.

Top of Page