1 tilqicom Dec 11, 2010 18:09
3 tilqicom Dec 11, 2010 21:27
sam2kb wrote:
You don't need SQL at all
- Create a new tab in Tools
Stuck at first step P: i dont know how to create a new tab in admin.. i have to look into that.but the stuff above seems great and probable to work. i will try and let you know the results once i figure out how to.
4 sam2kb Dec 11, 2010 21:44
function AdminAfterMenuInit()
{
$this->register_menu_entry( $this->name );
}
Just open any of these plugins and see how they do it
Mail sender, Feed importer, Democracy poll
5 tilqicom Dec 16, 2010 21:54
i might be doing sth horribly wrong, i got the following errors:
Notice: Undefined variable: Form in C:\wamp\www\b41\plugins\_skin_setting_duplicator.plugin.php on line 67
Fatal error: Call to a member function select_object() on a non-object in C:\wamp\www\b41\plugins\_skin_setting_duplicator.plugin.php on line 67
here is the plugin:
http://emin.pastebin.com/yccz5NGf
<?php
/**
*
* This file implements the Skin Settings Duplicator plugin for {@link http://b2evolution.net/}.
*
* @package plugins
*
* @copyright (c)2010 by Russian b2evolution - {@link http://ru.b2evo.net/}.
*
* @license GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
*
*/
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
class skin_setting_duplicator_plugin extends Plugin
{
/**
* Variables below MUST be overriden by plugin implementations,
* either in the subclass declaration or in the subclass constructor.
*/
var $name = 'Skin Settings Duplicator';
/**
* Code, if this is a renderer or pingback plugin.
*/
var $code = 'skin_setting_dup';
var $priority = 50;
var $version = '0.1';
var $help_url = '';
var $apply_rendering = 'never';
var $number_of_installs = 1;
/**
* Init
*
* This gets called after a plugin has been registered/instantiated.
*/
function PluginInit( & $params )
{
$this->short_desc = $this->T_('Copy skin settings');
$this->long_desc = $this->T_('Copy skin settings from one to another');
}
function AdminAfterMenuInit()
{
// add our tab
$this->register_menu_entry( 'Skin Settings Copier' );
}
function AdminTabPayload()
{
global $BlogCache;
// Dropdown list
$BlogCache = & get_BlogCache();
$BlogCache->load_all();
$Form->select_object( 'blog_ID_FROM', NULL, $BlogCache, T_('From'), 'blah from' );
$Form->select_object( 'blog_ID_TO', NULL, $BlogCache, T_('To'), 'blah to' );
}
function copy_settings()
{
// Loop through all widget params:
foreach( $params_FROM as $parname => $parmeta )
{
autoform_set_param_from_request( $parname, $parmeta, $Skin_TO, 'Skin' );
}
if( ! param_errors_detected() )
{ // Update settings:
$Skin_TO->dbupdate_settings();
$Messages->add( T_('Skin settings have been updated'), 'success' );
}
}
// All done
}
?>
and i guess this would not work in 3.3 right ? Did 3.3 have cache ?
6 sam2kb Dec 17, 2010 04:00
you don't need this
global $BlogCache;
add this
$Form = & new Form('params here');
$Form->select_object
and i guess this would not work in 3.3 right ? Did 3.3 have cache ?
global $app_version;
if ( version_compare( $app_version, '4' ) > 0 )
{ // b2evo 4 and up
$ItemCache = & get_ItemCache();
load_class( 'items/model/_item.class.php', 'Item' );
}
else
{
$ItemCache = & get_Cache( 'ItemCache' );
load_class( 'items/model/_item.class.php' );
}
You also need to add new event and do form processing there
function AdminTabAction()
Again, Mail sender and Feed importer do similar stuff (submit a form and process its data)
7 tilqicom Dec 23, 2010 00:57
well, i genuinely tried but i just cant do this one.. While you are halfway there, let me know if you finish making this :D
8 sam2kb Dec 23, 2010 05:03
I don't work on this plugin. Anyway, post here what you've done.
9 tilqicom Dec 27, 2010 22:24
sam2kb wrote:
I don't work on this plugin. Anyway, post here what you've done.
Well i practically done nothing other than what you said, and i ve gotten nowhere, and i ve given up :D it'd be kind of you if you ever complete it
10 sam2kb Dec 28, 2010 01:26
Plugin released http://forums.b2evolution.net//viewtopic.php?t=21895
Thread closed
You don't need SQL at all
- Create a new tab in Tools
- Allow access to admins only
- Add a "Copy from" and "Apply to" dropdowns with blog name/id, and a submit button
- Once submitted, get skin settings from blog X, apply them to blog Y
- For even more coolness, add a multiselect dropdown list (or checkboxes) for target blogs, and apply settings to several blogs.
Not tested!