Joomla and wordpress MU bridge

Tuesday, September 1, 2009
By Link Sutra

I will try to explain how you can use wordpress MU (2.8.4)  inside your joomla (1.5)  to create blogs for your joomla users automatically.

you will not want  every joomla user to have blogs without actually user wants it to create.

keeping it in mind we follow these things.

1)  install wordpress MU inside your joomla main installation directory (i.e if my joomla is installed in ABC/joomla then I would install wordpress inside ABC/Joomla/wordpress

2) when installing your wordpress keep the database same as joomla is using (remember you should not have ur joomla tables prefix “wp_” if it is so then change your joomla tables prefix to something else)

3) configure your wordpress.

4) now come to the button or link on your registered joomla user page where you want to give user an option to create wordpress blogs.

5) following functions you should have

function  getUserValue($id,$field){

  $db	  =& JFactory::getDBO();
  $query="SELECT $field from #__users Where id=".$id;
  $db->setQuery($query);
  $result=$db->loadObject($field);

  //if(strlen($result->$field)<100){
  return nl2br($result->$field);
 // }else{
  //return ;
//  }

}
function isBlogActive($username){
 $db	  =& JFactory::getDBO();
 $query="SELECT COUNT(*) FROM wp_blogs Where domain='".$username.".yourdomain.com'";
  //echo $query;

  $db->setQuery($query);
  //echo $db->stdErr();
  $results=$db->loadResult();

  //echo $results;

 return $results;

}

#### now paste given below where you want to give user an option to create  blog

<?php
 $user=& JFactory:getUser();
$id=$user->get('id);
if(isBlogActive(getUserValue($id,'username'))){
echo '<a href="http://'.getUserValue($id,'username').'.yourdomain.com">
 MY BLOGS</a>';
}else{

?>

<form method="post" action="/wordpress/wp-admin/wpmu-edit.php?action=addblog">
<input name="blog[createblog]" type="hidden" title="some key" value="some key"/>
<input name="blog[domain]" type="hidden"
title="<?php echo getUserValue($id,'username'); ?>"
value="<?php echo getUserValue($id,'username'); ?>"/>

<input type="hidden" name="blog[title]"  size="20"
title="<?php echo getUserValue($id,'name'); ?>"
value="<?php echo getUserValue($id,'name'); ?>"/>

<input type="hidden" name="blog[email]"  size="20"
title="<?php echo getUserValue($id,'email'); ?>"
value="<?php echo getUserValue($id,'email'); ?>"/>

<input type="submit" name="go" id="go"
Value="Add <?php echo getUserValue($id,'name');?> Blogs" >

</form>

              <?php

             }
           ?>

##################################

6) now come to wordpress/wp-admin/wpmu-edit.php file to make some changes

#######CHANGE FROM:##########################

if( is_site_admin() == false ) {
wp_die( __(’You do not have permission to access this page.’) );
}
do_action(’wpmuadminedit’, ”);
if( isset($_GET[ 'id' ]) ) {
$id = intval( $_GET[ 'id' ] );
} elseif( isset($_POST[ 'id' ]) ) {
$id = intval( $_POST[ 'id' ] );
}
if( isset( $_POST['ref'] ) == false && !empty($_SERVER['HTTP_REFERER']) ) {
$_POST['ref'] = $_SERVER['HTTP_REFERER'];
}

#######################  CHANGE TO:##########

$blog = $_POST['blog'];

if($blog['createblog']==’82cJK6vkanMbp’){

}else{

if( is_site_admin() == false ) {
wp_die( __(’You do not have permission to access this page.’) );
}

do_action(’wpmuadminedit’, ”);

if( isset($_GET[ 'id' ]) ) {
$id = intval( $_GET[ 'id' ] );
} elseif( isset($_POST[ 'id' ]) ) {
$id = intval( $_POST[ 'id' ] );
}

}

7)  go to case “addblog”: line  in wp-edit.php and replace check_admin_referer(’add-blog’); line with

$blog = $_POST['blog'];
if($blog['createblog']==’some key‘){
}else{
check_admin_referer(’add-blog’);
}

8) open admin.php in same directory and comment the line auth_redirect();

to

//auth_redirect();

################

DO NOT FORGET TO CHANGE “some key” and “yourdomain“.

and you are done with it but make sure your wordpress is configured to send user login/passwd after their registeration so that user can get his blog pasword otherwise use “configure smtp” plugin to send mail using gmail or google hosted emails.

HAPPY BLOGGING

http://www.linksutra.com



15 Responses to “Joomla and wordpress MU bridge”

  1. MacDaddy

    What versions of Wordpress & Joomla was this tutorial based on?

    #3
  2. tutorial was based on joomla(1.5) and wordpress version 2.8.4 MU

    #5
  3. John

    4) now come to the button or link on your registered joomla user page where you want to give user an option to create wordpress blogs.

    Please is needed for the above statement.
    What are you referring to when you said “button or link”? Does it mean the Section, Category or the Article created for such. Or something entirely different.

    I would appreciate a swift response.

    Thanks so much for the help file.

    #15
  4. actually “button or link” plays a role to get user response to create blog in your joomla site

    check this part here user submit the button which says ” Add username Blogs”

    <input name="blog[domain]" type="hidden"
    title="”
    value=”"/>

    <input type="hidden" name="blog[title]" size="20"
    title="”
    value=”"/>

    <input type="hidden" name="blog[email]" size="20"
    title="”
    value=”"/>

    <input type="submit" name="go" id="go"
    Value="Add Blogs” >

    #16
  5. Great Site! Thanks for the Information. Just what I was looking for. Will definately bookmark.

    #32
  6. There is nothing better than to go to your blog in the morning with a cup of coffee

    #33
  7. You are very interesting to write. Can you recommend any similar sites similar to yours?

    #35
  8. Is there anyone who could either install or help me install the Jooml/WPMU Bridge on my site for me? This looks a bit hairy for me and I’m nervous about doing it. I’d love to be able to give my users the option to be able to create a wordpress blog. We are a non-profit social and political reforms organization and we’re having some problems getting our site up and running. We are inexperienced Joomla users, and learning as we go along. It makes things rough on us, but we have to do it this way due to a lack of money right now. Any help or advice you could lend to us Gaurav would be greatly appreciated.

    Walter.

    #182
  9. [...] Linksutra » Blog Archive » Joomla and wordpress MU bridge By admin | category: joomla, joomla bridge | tags: cms, install-the-jtag, [...]

    #185
  10. Really? I will test by myself.

    #193
  11. admin fans

    wordpress MU 2.9.X + joomla 1.5.X Support ?

    #201
  12. Hi, that’s a great tip – thanks! This is my first Wordpress site but I’m still a touch lost… I can’t believe the sheer number of themes and plugins out there! But I’m slowly getting there and it’s starting to take form. I’m guessing that installation and setup won’t take forever next time. Anyhow… cool blog – I’m subscribed to your RSS feed now so I’ll check in more often!

    #202
  13. Hi, I really would like to use this bridge, but steps 4 and 5 are a bit unclear to me as well as ’some key’ part. What key?

    If possible, can you give a brisk description of what this means:
    4) now come to the button or link on your registered joomla user page where you want to give user an option to create wordpress blogs.

    5) following functions you should have

    You mean make a link to an article that will have the code? and for #5 what functions , where does the code go? inside the same page where the input for add blog goes?

    #203
  14. Skoro eto sluchitsya

    #205

Leave a Reply