Plugin error

18 years 1 week ago #10605 by rswennen
Plugin error was created by rswennen
Hi,

I tried to develop my first user plugin but get the following error when I install it.

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'plug_secretcode_install' was given in /var/www/dieetlijn.com/administrator/components/com_comprofiler/plugin.class.php on line 1403

The plugin seems to work.
Any idea where the error comes from ?

The plugin generates a random code after user registration.

See code below:

[code:1]
<?php
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
/*
*
*/

// Declarations for triggers
$_PLUGINS->registerFunction( 'onAfterUserRegistration' , 'na_registratie_code', 'secretcode' );
$_PLUGINS->registerFunction( 'onAfterNewUser' , 'na_registratie_code', 'secretcode' );

class secretcode extends cbEventHandler {

function secretcode() {
$this->cbEventHandler();
}

function na_registratie_code ($row) {
global $database;
$codext = secretcode::randomkeys(4);
$seccode = "$row->id"."$codext";

$codesql = "UPDATE #__comprofiler set cb_secretid = '$seccode' where user_id = '$row->id'";
$database->setQuery( $codesql );
if (!$database->query()) {
die("SQL error when attempting to set secret id" . $database->stderr(true));
};



return true;
}

function randomkeys($length)
{
$pattern = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for($i=0;$i<$length;$i++)
{
$key .= $pattern{rand(0,33)};
}
return $key;
}


} //end of class

?>[/code:1]

Post edited by: rswennen, at: 2006/04/19 09:49

Please Log in to join the conversation.

18 years 6 days ago #10623 by nant
Replied by nant on topic Re:Plugin error
Maybe you could post the xml installation file...

Please Log in to join the conversation.

18 years 6 days ago #10628 by rswennen
Replied by rswennen on topic Re:Plugin error
Sure,

it's quite basic actually.

[code:1]
<?xml version="1.0" encoding="utf-8"?>
<cbinstall version="4.5.0" type="plugin" group="user">
<name>secretcode</name>
<author>Rohnny Swennen</author>
<creationDate>April 2006</creationDate>
<copyright>(C) 2006</copyright>
<license>www.gnu.org/copyleft/gpl.html GNU/GPL
<authorEmail>info@swennen.org
<authorUrl>www.swennen.org
<version>1.0 RC 2</version>
<description>Generates user random code after registration.</description>
<files>
<filename plugin="secretcode">secretcode.php</filename>
<filename>index.html</filename>
</files>

<installfile>secretcode.php</installfile>
<uninstallfile>secretcode.php</uninstallfile>
<params>
</params>
<tabs>
</tabs>
<install>
<queries>
</queries>
</install>
<uninstall>
<queries>
</queries>
</uninstall>
</cbinstall>
[/code:1]

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.188 seconds

Facebook Twitter LinkedIn