Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Group Blog + P2 or Posthaste


peterverkooijen
Participant

@peterverkooijen

Posthaste experiments go nowhere. I’m closer to a solution with P2, with the theme integrated directly into the bp-groupblog plugin (old version for 1.1.3…).

I’ve boiled the problem down to this: I need to tell the p2.js file which blog it is operating in. Without a blogid it assumes it’s working on the main blog.

The solution is probably in here somewhere: Get blog_id in external files. Also mentions the switch_to_blog function that Marius Ooms pointed out to me in bp-groupblog.

How can I turn that into a line of javascript that I can add at the top of p2.js? ‘var something = something;’?

Or should I add something to functions.php? It has functions like this:

function latest_post_permalink() {
global $wpdb;
$sql = "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1";
$last_post_id = $wpdb->get_var($sql);
$permalink = get_permalink($last_post_id);
return $permalink;
}

What should I add to a function like this to tell it from which blog to get the last post permalink? Or can I add $blogid as global or something like that?

Skip to toolbar