Skip to Content Skip to Menu

Server back online & plugin "roadmap"

18 years 2 weeks ago #21985 by Weatherangel
Replied by Weatherangel on topic Re:Server back online & plugin
mikko wrote:

list tab

Allows user to make tab "list enabled", that is, a tab can have several entries with the field

+does not work on registration
+a minor useability bug on the admin side
-might cause data loss if set up carelessly


Mikko,

I am trying to get the update working at registration, and I'm having issues. I was wondering how much you've looked into the option, and if you think this code should fix the problem?

[code:1]
$_PLUGINS->registerFunction( 'onBeforeUserProfileDisplay', 'checkForConfigUpdates','listTab' );
$_PLUGINS->registerFunction( 'onAfterUserUpdate', 'checkForConfigUpdates','listTab' );
$_PLUGINS->registerFunction( 'onAfterUserRegistration', 'checkForConfigUpdates','listTab' );
[/code:1]

I was thinking that it should, but it's not. Do you have any thoughts? Am I calling the wrong method?

1 4M N0T 4 G33K!
1 4M N0T 4 G33K!
1 4M N0T 4 G33K!
--
0K 1 4M

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

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
18 years 2 weeks ago #21987 by mikko
Replied by mikko on topic Re:Server back online & plugin
Here is the very latest version of listtab which enables the use of listtab in registration. I am abtou to go into production with this one, so it should be quite stable.

checkForConfigUpdates is meant for checking if the parameters of the plugin (meaning the tabs for which it has been activated) have changed.

mikko

Attachment listtab-f642b9730d50e930dffe39de04b63ec2.zip not found



Post edited by: mikko, at: 2006/10/04 08:00
Attachments:

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

18 years 2 weeks ago #22068 by Weatherangel
Replied by Weatherangel on topic Re:Server back online & plugin
Weatherangel wrote:

mikko wrote:

list tab

Allows user to make tab "list enabled", that is, a tab can have several entries with the field

+does not work on registration
+a minor useability bug on the admin side
-might cause data loss if set up carelessly


Mikko,

I am trying to get the update working at registration, and I'm having issues. I was wondering how much you've looked into the option, and if you think this code should fix the problem?

[code:1]
$_PLUGINS->registerFunction( 'onBeforeUserProfileDisplay', 'checkForConfigUpdates','listTab' );
$_PLUGINS->registerFunction( 'onAfterUserUpdate', 'checkForConfigUpdates','listTab' );
$_PLUGINS->registerFunction( 'onAfterUserRegistration', 'checkForConfigUpdates','listTab' );
[/code:1]

I was thinking that it should, but it's not. Do you have any thoughts? Am I calling the wrong method?


The locations that I've added into registerFunctions may be over board, but this code seems to be working, at least in my instance. The ONE draw back is that I have the tabid hardcoded for the time being in my code. For me it works and I can leave it this way for my purposes, however for a general roll out, it would need to be a little more self sufficent, maybe going through each of the listtabs that are available? I don't know. Anyway, I hope this code helps your efforts :)

[code:1]
$_PLUGINS->registerFunction( 'onBeforeUserProfileDisplay', 'checkForConfigUpdates','listTab' );
$_PLUGINS->registerFunction( 'onAfterUserUpdate', 'updateListTab','listTab' );
$_PLUGINS->registerFunction( 'onAfterUserRegistration', 'updateListTab','listTab' );
$_PLUGINS->registerFunction( 'onAfterNewUser', 'updateListTab','listTab' );


function updateListTab($user, $ui, $postvars)
{
global $database;
$tab = new stdClass;

//TODO: switch this from being hard coded to variable based.
$tab->tabid = "23";

$database->setQuery("SELECT * FROM #__comprofiler_fields WHERE published=1 and tabid = ".$tab->tabid." and readonly=0"«»);
$rowFields = $database->loadObjectList();

$cbFields=new cbFields();^M
$dataFound=false;
$rowExtras = new stdClass();
for($i=0, $n=count( $rowFields ); $i < $n; $i++)
{
$field=cbGetEscaped($rowFields[$i]->name);
$value=null;
if(isset($_POST[$rowFields[$i]->name]))
{
$value=$cbFields->prepareFieldDataSave($rowFields[$i]->type,$rowFields[$i]->name,$_POST[$rowFields[$i]->name]);

if($value!='')
$dataFound=true;
}

$rowExtras->$field=$value;
}
$rowExtras->userid=$user->id;
$rowExtras->tabid=$tab->tabid;

//If data is found, do INSERT

if($dataFound)
{
$database->insertObject( '#__comprofiler_listtab_'.$tab->tabid, $rowExtras);
if($database->getErrorNum()==1054)
{
$database->insertObject( '#__comprofiler_listtab_'.$tab->tabid, $rowExtras);
}
}
}
[/code:1]

Post edited by: Weatherangel, at: 2006/10/05 07:54

1 4M N0T 4 G33K!
1 4M N0T 4 G33K!
1 4M N0T 4 G33K!
--
0K 1 4M

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

Moderators: beatnantkrileon
Powered by Kunena Forum