views:

432

answers:

2

Hi

We have a Joomla 1.5 site with a blog in a subfolder /blog/

We would like to have a login status at the top of each page. For consistency of navigation we want to show the joomla login status at the top of the wordpress blog.

eg

Login | Register | Help

or

You are loged in as stephen baugh | Help

The problem is that although the scipt blow correctly returns the login status, if I add it to a wordpress template the status is correctly returned and drawn to the screen, but then the page stops drawing. Anyone have any ideas how I stop the Joomla scripts making the Wordpress script stop.

Thanks Stephen

    <?php

define( '_JEXEC', 1 );
define('JPATH_BASE', '/Library/WebServer/testqueensberrycom');
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
//$mainframe->triggerEvent('onAfterInitialise');
//$mainframe->route();
//$mainframe->authorize('');

$user =& JFactory::getUser();

     if (($user->id) > 0)
     {
     return 'You are signed in as: <a href="/editprofile/user.html">' . $user->username . '</a> | <a href="/index.php?option=com_content&view=article&id=225">Help</a> | <a href="/index.php?option=com_user&task=logout&return=cGFydG5lci9wcm9jZXNzL3BhcnRuZXIuaHRtbA==">Sign out</a>';
     } else {
     return '<a href="/index.php?option=com_user&view=login">Login</a> | Join | <a href="/index.php?option=com_content&view=article&id=225">Help</a>';
     }


?>
A: 

Hmm, there are a lot of possibilities. Joomla has a lot of features like register globals emulation etc (many depend on if you're using legacy mode...) - which could easily clash with other scripts. It also makes lots of defines and fills a lot of global spots, which could also possibly clash with other scripts.

Things I could think of to try:

  • Add $mainframe->close();
  • Try setting error_reporting(E_ALL); after the Joomla code has run to see what Wordpress is choking on
KingJackaL
A: 

Hey, did you find the answer to this issue? I'm now struggling with this same problem and I would really appreciate your experiences on this issue.

IPFox
I didn't end up adding to the blog, so no I didn't really work it through all the way. Having said that I am sure their must be a way to call php scripts and mysql calls that are not part of the Wordpress core. You can certainly do this with Joomla, but you must through the joomla core and database calls.Sorry I can't be more helpful, cheers Stephen
Stephen Baugh