Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 25th)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Don't Understand a CB API Function

  • bulldogsay
  • bulldogsay
  • OFFLINE
  • Posts: 25
  • Thanks: 0
  • Karma: 11
18 years 10 months ago #5406 by bulldogsay
Don't Understand a CB API Function was created by bulldogsay
I am needing help with function:

function onBeforeUserRegistration (&$row, &$rowextras, false)

would i just put this in my plugin and then put the php code with this function and when a new user registers it will perform it. Would this be similar with other functions.

Could you give a quick example if i would have to change the function! Thanks Luke

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

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
18 years 10 months ago #5421 by nant
Replied by nant on topic Re:Don't Understand a CB API Function
Ok, let me take ashot at this and hopefully others will bail me out when I get into trouble (...)

So lets assume your plugin file is cb.myplugin.php:

[code:1]
<?php

/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

$_PLUGINS->registerFunction( 'onBeforeUserRegistration', 'myfunction','getMyPluginTab' );

class getMyPluginTab extends cbTabHandler {

/**
* Constructor
*/
function getMyPlugin() {
$this->cbTabHandler();
}

/**
* My function - this is called after the onBeforeUserRegistration event
*/
function myfunction(&$row, &$rowextras, false) {

}
} // end of class


[/code:1]

Now, hopefully with this plugin published after every event is triggered the myfunction() will be executed. Now what exactly are the 3 function variables - I dont know!
Beat or JJ help!

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

  • bulldogsay
  • bulldogsay
  • OFFLINE
  • Posts: 25
  • Thanks: 0
  • Karma: 11
18 years 10 months ago #5437 by bulldogsay
Replied by bulldogsay on topic Re:Don't Understand a CB API Function
also when i do this function, would this allow me to use and lookup variables for the current user that has registered. As it is hard to think of a way finding this. If so where should i Look for the variables, thanks!

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

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
18 years 10 months ago #5476 by nant
Replied by nant on topic Re:Don't Understand a CB API Function
To get cb field values for the current user you must do a query search on the comprofiler table in one of your plugin functions.

So you can create a function in your plugin class called myplug_GetUserConfig() as follows:

[code:1]
function myplug_GetUserConfig($id) {
global $database;

$database->setQuery("select cb_field1, cb_field2, cb_field3 from #__comprofiler WHERE id=".$id);
$userConfig=$database->loadObjectList();

return $userConfig[0];

}
[/code:1]

This function could then be called in your getDisplayTab() class function as follows:

[code:1]
function getDisplayTab($tab,$user,$ui) {
global $database, $mosConfig_live_site, $acl, $my, $mosConfig_offset, $ueConfig,$mainframe, $mosConfig_lang;

$this->_getLanguageFile();

//Get User Level Configuration Options
$userConfig = $this->myplug_GetUserConfig($user->id);

$cbfield1 = $userConfig->cb_field1;
$cbfield2 = $userConfig->cb_field2;
$cbfield3 = $userConfig->cb_field3;

}
[/code:1]

Hope this helps!

Post edited by: nant, at: 2006/02/03 09:18

Post edited by: nant, at: 2006/02/03 09:19

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

  • bulldogsay
  • bulldogsay
  • OFFLINE
  • Posts: 25
  • Thanks: 0
  • Karma: 11
18 years 10 months ago #5482 by bulldogsay
Replied by bulldogsay on topic Re:Don't Understand a CB API Function
yeh, i know that - however after when the user confirms, would it only be possuble to do so getting md5 of the confirm code and turning that into an id? As that it is the only way in the code that I could see it possible to do anything at the that point.

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

  • bulldogsay
  • bulldogsay
  • OFFLINE
  • Posts: 25
  • Thanks: 0
  • Karma: 11
18 years 10 months ago #5509 by bulldogsay
Replied by bulldogsay on topic Re:Don't Understand a CB API Function
Also I get this when i use it: as an error

Parse error: syntax error, unexpected T_STRING, expecting '&' or T_VARIABLE or T_CONST in /usr/home/bulldog/public_html/components/com_comprofiler/plugin/user/plug_cbrecommendation/cb.recommended.php on line 17

which is the line that calls the function

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

Moderators: beatnantkrileon
Powered by Kunena Forum