我有我的wordpress安裝在localhost /和我的joomla安裝在本地主機/ s。WordPress的Joomla登錄表集成
我的登錄表單爲WordPress的代碼是
<?php
/**
* @package gantry
* @subpackage widgets
* @version 1.0 March 15, 2011
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2011 RocketTheme, LLC
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*/
defined('GANTRY_VERSION') or die();
gantry_import('core.gantrywidget');
add_action('widgets_init', array("GantryWidgetLoginForm","init"));
class GantryWidgetLoginForm extends GantryWidget {
var $short_name = 'loginform';
var $wp_name = 'gantry_loginform';
var $long_name = 'Gantry Login Form';
var $description = 'Gantry Login Form Widget';
var $css_classname = 'widget_gantry_loginform';
var $width = 200;
var $height = 400;
function init() {
register_widget("GantryWidgetLoginForm");
}
function render_title($args, $instance) {
global $gantry;
if($instance['title'] != '') :
echo $instance['title'];
endif;
}
function render($args, $instance){
global $gantry, $current_user;
ob_start();
?>
<?php if(!is_user_logged_in()) : ?>
<form id="form-login" action="<?php echo wp_login_url(get_bloginfo('url')); ?>" method="post">
<fieldset class="input">
<p id="form-login-username">
<input id="modlgn_username" type="text" name="log" class="inputbox" alt="username" size="18" value="<?php _re('Username'); ?>" onfocus="if (this.value=='<?php _re('Username'); ?>') this.value=''" onblur="if(this.value=='') { this.value='<?php _re('Username'); ?>'; return false; }" />
</p>
<p id="form-login-password">
<input id="modlgn_passwd" type="password" name="pwd" class="inputbox" size="18" alt="password" value="<?php _re('Password'); ?>" onfocus="if (this.value=='<?php _re('Password'); ?>') this.value=''" onblur="if(this.value=='') { this.value='<?php _re('Password'); ?>'; return false; }" />
</p>
<p id="form-login-remember">
<input type="checkbox" name="rememberme" class="checkbox" alt="<?php _re('Remember Me'); ?>" />
<label class="rememberme"><?php _re('Remember Me'); ?></label>
</p>
<div class="readon"><input type="submit" value="<?php _re('Login'); ?>" class="button" name="submit" /></div>
</fieldset>
<ul>
<li>
<a href="<?php echo wp_lostpassword_url(); ?>"><?php _re('Forgot your password?'); ?></a>
</li>
<?php if(get_option('users_can_register')) : ?>
<li>
<a href="<?php bloginfo('wpurl'); ?>/wp-register.php"><?php _re('Register'); ?></a>
</li>
<?php endif; ?>
</ul>
</form>
<?php else : ?>
<form id="form-login" action="<?php echo wp_logout_url(get_bloginfo('url')); ?>" method="post">
<fieldset class="input">
<div class="user-greeting">
<b><?php echo $instance['user_greeting']; ?> <?php echo $current_user->display_name; ?></b><br />
</div>
<div class="readon"><input type="submit" name="Submit" class="button" value="Log out" /></div>
</fieldset>
</form>
<?php endif; ?>
<?php
echo ob_get_clean();
}
我的Joomla登錄表單的代碼是
<?php
/**
* @version $Id: login.php 303 2010-01-07 02:56:33Z joomlaworks $
* @package K2
* @author JoomlaWorks http://www.joomlaworks.gr
* @copyright Copyright (c) 2006 - 2010 JoomlaWorks Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// OpenID stuff (do not edit)
if(JPluginHelper::isEnabled('authentication', 'openid')){
$lang->load('plg_authentication_openid', JPATH_ADMINISTRATOR);
$langScript = '
var JLanguage = {};
JLanguage.WHAT_IS_OPENID = \''.JText::_('WHAT_IS_OPENID').'\';
JLanguage.LOGIN_WITH_OPENID = \''.JText::_('LOGIN_WITH_OPENID').'\';
JLanguage.NORMAL_LOGIN = \''.JText::_('NORMAL_LOGIN').'\';
var modlogin = 1;
';
$document = &JFactory::getDocument();
$document->addScriptDeclaration($langScript);
JHTML::_('script', 'openid.js');
}
// Get user stuff (do not edit)
$usersConfig = &JComponentHelper::getParams('com_users');
?>
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2LoginBlock <?php echo $params->get('moduleclass_sfx'); ?>">
<form action="<?php echo JRoute::_('index.php', true, $params->get('usesecure')); ?>" method="post" name="login" id="form-login" >
<?php if($params->get('pretext')): ?>
<p class="preText"><?php echo $params->get('pretext'); ?></p>
<?php endif; ?>
<fieldset class="input">
<p id="form-login-username">
<label for="modlgn_username"><?php echo JText::_('Username') ?></label>
<input id="modlgn_username" type="text" name="username" class="inputbox" alt="username" size="18" />
</p>
<p id="form-login-password">
<label for="modlgn_passwd"><?php echo JText::_('Password') ?></label>
<input id="modlgn_passwd" type="password" name="passwd" class="inputbox" size="18" alt="password" />
</p>
<?php if(JPluginHelper::isEnabled('system', 'remember')) : ?>
<p id="form-login-remember">
<input id="modlgn_remember" type="checkbox" name="remember" class="inputbox" value="yes" alt="Remember Me" />
<label for="modlgn_remember"><?php echo JText::_('Remember me') ?></label>
</p>
<?php endif; ?>
<div class="readon"><input type="submit" name="Submit" class="button" value="<?php echo JText::_('LOGIN') ?>" /></div>
</fieldset>
<ul>
<li><a href="<?php echo JRoute::_('index.php?option=com_user&view=reset'); ?>"><?php echo JText::_('Forgot your password?'); ?></a></li>
<li><a href="<?php echo JRoute::_('index.php?option=com_user&view=remind'); ?>"><?php echo JText::_('Forgot your username?'); ?></a></li>
<?php if ($usersConfig->get('allowUserRegistration')): ?>
<li><a href="<?php echo JRoute::_('index.php?option=com_user&view=register'); ?>"><?php echo JText::_('Create an account'); ?></a></li>
<?php endif; ?>
</ul>
<?php if($params->get('posttext')): ?>
<p class="postText"><?php echo $params->get('posttext'); ?></p>
<?php endif; ?>
<input type="hidden" name="option" value="com_user" />
<input type="hidden" name="task" value="login" />
<input type="hidden" name="return" value="<?php echo $return; ?>" />
<?php echo JHTML::_('form.token'); ?>
</form>
</div>
我希望它這樣,當用戶點擊我的wordpress的登錄按鈕頁面與他的用戶和通行證,用戶和通行證應提交給joomla登錄目的和用戶應登錄到joomla而不是wordpress。 joomla的正常登錄網址是localhost/s/index.php?option = com_user & view = login & Itemid = 204。
這個問題在Diverting WordPress login and register links to Joomla有所解決,但沒有多大幫助。
好,我使用的JFusion了,但它不支持WordPress的到Joomla登錄。所以請回答我的問題。我正在使用jfusion。 – 2011-06-05 03:18:46
@brent好的,我已經使用jfusion,但它不支持WordPress的Joomla登錄。所以請回答我的問題。我正在使用jfusion – 2011-06-05 08:21:34
您將需要更改安裝或編寫大量自定義代碼以使其工作。 JFusion確實支持WP,但你必須按照他們的說明來完成。 http://www.jfusion.org/docs/doku.php?id=wordpress;beforeyoubegin – 2011-06-05 16:21:41