问题
am trying to convert this plugin to Joomla 1.7, as I don have extensive understanding of PHP I am not getting anywhere. Any kind of help is appreciated.
URL of the plugin: http://extensions.joomla.org/extensions/content-sharing/mailing-a-newsletter-bridges/10400
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
class plgSystemAutoresponder extends JPlugin{
function onUserAfterSave($user, $isnew, $succes, $msg){
//$mainframe->redirect("index.php?option=com_contact");//Put your new page URL here
global $mainframe;
// convert the user parameters passed to the event
// to a format the external application
$args = array();
$args['username'] = $user['username'];
$args['email'] = $user['email'];
$args['fullname'] = $user['name'];
$args['password'] = $user['password'];
$email1 = $user['email'];
$name1 = $args['username'];
$email = $args['email'];
$name = $args['username'];
//load plugin parameters
$plugin=&JPluginHelper::getPlugin('autoresponder');
$pluginParams = new JParameter( $plugin->params );
$responderUrl = $this->params->get( 'responder_url' );
$MetaWebFormId = $this->params->get( 'meta_web_form_id');
$MetaSplitId = $this->params->get( 'meta_split_id' );
$Unit = $this->params->get( 'unit' );
$Redirect = $this->params->get( 'redirect' );
$MetaRedirectOnlist = $this->params->get( 'meta_redirect_onlist' );
$MetaAdtracking = $this->params->get( 'meta_adtracking' );
$MetaMessage = $this->params->get( 'meta_message' );
$MetaRequired = $this->params->get( 'meta_required' );
$MetaForwardVars = $this->params->get( 'meta_forward_vars' );
$mainframe->redirect($responderUrl."?from=".$email."&name=".$name."&meta_web_form_id=".$MetaWebFormId."&meta_split_id="."&unit=".$Unit."&redirect=".$Redirect."&meta_redirect_onlist=".$MetaRedirectOnlist."&meta_adtracking=".$MetaAdtracking."&meta_message=".$MetaMessage."&meta_required=".$MetaRequired."&meta_forward_vars=".$MetaForwardVars);
}
}
?>
I have updated the XML to Joomla 1.7. But Joomla 1.7 is giving error is line 38 and 54
Line 38: `$pluginParams = new JParameter( $plugin->params );`
Line 54: ` $mainframe->redirect($responderUrl."?from=".$email."&name=".$name."&meta_web_form_id=".$MetaWebFormId."&meta_split_id="."&unit=".$Unit."&redirect=".$Redirect."&meta_redirect_onlist=".$MetaRedirectOnlist."&meta_adtracking=".$MetaAdtracking."&meta_message=".$MetaMessage."&meta_required=".$MetaRequired."&meta_forward_vars=".$MetaForwardVars);`
回答1:
Take a look at http://docs.joomla.org/Adapting_a_Joomla_1.5_extension_to_Joomla_1.6 ... It says for extensions, but it includes what to do for plugins too.
回答2:
Also - take a look here, great detailed source and examples of changes:
http://www.theartofjoomla.com/topics/upgrading.html
http://www.theartofjoomla.com/converting-old-extensions.html
http://www.theartofjoomla.com/home/9-developer/112-upgrading-a-plugin-to-joomla-16.html
http://www.theartofjoomla.com/home/41-extensions/132-more-on-upgrading-plugins-to-joomla-16.html
http://www.theartofjoomla.com/home/9-developer/135-database-upgrades-in-joomla-16.html
来源:https://stackoverflow.com/questions/9847875/code-conversion-joomla-1-5-to-joomla-1-7-2-5