Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Intro Black Friday Offer for a lifetime*

Plugin error

  • rswennen
  • rswennen
  • OFFLINE
  • Posts: 12
  • Thanks: 0
  • Karma: 0
18 years 7 months 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 or Create an account to join the conversation.

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
18 years 7 months ago #10623 by nant
Replied by nant on topic Re:Plugin error
Maybe you could post the xml installation file...

Please Log in or Create an account to join the conversation.

  • rswennen
  • rswennen
  • OFFLINE
  • Posts: 12
  • Thanks: 0
  • Karma: 0
18 years 7 months 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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum