Skip to Content Skip to Menu

Error: Plugin for adding new fieldtype

  • tingel
  • tingel
  • OFFLINE
  • Posts: 6
  • Thanks: 2
  • Karma: 0
13 years 10 months ago #150411 by tingel
Hello CB Community,
I am currently developing a CB plugin to add a new fieldtype in the field management. It's a special singel select dropdown field in which the value is different to the displayed name:
[code:1]<option value="2009-ss">SS 2009</option>[/code:1]
The plugin is based on the CBfield_select_multi_radio class which I extended.

I can install my plugin succesfully, enable it, and create a new field where I can chose my field (semfield). The field is correctly added in the jos_comprofiler and the jos_comprofiler_fields table.

Unfortunately, it's not working properly. I have the following errors for which I can't find a solution:

1) The created field does not appear in the user management so no data can be filled in.

2) When opening the tab user management I get the following php errors

a)

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /.../administrator/components/com_comprofiler/plugin.class.php on line 2445

and

b)

Warning: Invalid argument supplied for foreach() in /.../administrator/components/com_comprofiler/plugin.class.php on line 2476



to 1) It might be some wrong syntax in the xml file for handling the database field, I couldn't find any example or forum post about it (see also full source code below)
[code:1]
.
.
<database version="1">
<table name="#__comprofiler" class="moscomprofiler" maintable="true" strict="false" drop="never" shared="true">
<columns>
<column name="" nametype="namesuffix" type="sql:varchar(255)" null="true" default="0" />
</columns>
</table>
</database>
.
.
[/code:1]

to 2b) it might be correlated to the error reportet today in www.joomlapolis.com/component/option,com_joomlaboard/Itemid,38/func,view/id,150399/catid,146/

The xml file:
[code:1]
<?xml version="1.0" encoding="UTF-8"?>
<cbinstall version="1.0.0" type="plugin" group="user">
<name>CB Sem Field</name>
<author>Tingel</author>
<creationDate>2011-01-07</creationDate>
<copyright>(C) 2011 Tingel</copyright>
<license> www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL version 2
<authorEmail>solonx@web.de
<authorUrl> www.test.de
<version>1.0</version>
<description>
A Community Builder field plugin to add a Semesterfield type to the available CB fields.
</description>
<files>
<filename plugin="cb.semfield">cb.semfield.php</filename>
<filename>index.html</filename>
</files>
<fieldtypes>
<field type="semfield" label="Sem Field">
<database version="1">
<table name="#__comprofiler" class="moscomprofiler" maintable="true" strict="false" drop="never" shared="true">
<columns>
<column name="" nametype="namesuffix" type="sql:varchar(255)" null="true" default="0" />
</columns>
</table>
</database>
<params>
<fieldset label="Sortierbare Semesterfelder" description="">
<param name="startyear" type="text" default="1940" label="Start Jahr für Semester" description="Start Jahr für Semester eingeben. 1940 scheint mir als default Wert ausreichend" />
<param name="fieldValidateForbiddenList_register" type="text" default="http:,https:,mailto:,//.,<a,</a>;,&#" label="Forbidden words at registration" description="You can set a list of bad words (separated by comma ,) which are not allowed in this field for registration. Use comma twice (,,) to add comma as bad character." />
<param name="fieldValidateForbiddenList_profile" type="text" default="" label="Forbidden words in user profile edits" description="You can set a list of bad words (separated by comma ,) which are not allowed in this field when user updates his profile in profile edits. Use comma twice (,,) to add comma as bad character." />
</fieldset>
</params>
</field>
</fieldtypes>
<fieldsparams>
</fieldsparams>
<params>
</params>
<install>
</install>
<uninstall>
</uninstall>
<database>
</database>
</cbinstall>
[/code:1]

The php field:
Actually I can't paste the php code in the code tag and now the file selection field disapeard.



I appreciate any suggestions that could help solve the problems to get the plugin working correctly.

Thanks

Tingel

Post edited by: tingel, at: 2011/01/09 20:09
Attachments:

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

  • tingel
  • tingel
  • OFFLINE
  • Posts: 6
  • Thanks: 2
  • Karma: 0
13 years 10 months ago #150413 by tingel
Replied by tingel on topic PHP code: Plugin for adding new fieldtype
Again the php code as textfile

Attachment cb-ded02e71a2feffa146ba67d13adfe576.txt not found

Attachments:

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

  • schrubber
  • schrubber
  • OFFLINE
  • Posts: 2
  • Thanks: 0
  • Karma: 0
13 years 9 months ago #154031 by schrubber
Replied by schrubber on topic Re: PHP code: Plugin for adding new fieldtype
Hello,

could you make any progress with your plugin? I would also be interested in this kind of plugin.

Cheers, Jake

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

  • tingel
  • tingel
  • OFFLINE
  • Posts: 6
  • Thanks: 2
  • Karma: 0
13 years 9 months ago #154033 by tingel
I actually found the problem and completed the plugin. Now its working for me.

I attached the files.


Alex
Attachments:
The following user(s) said Thank You: schrubber, heyai

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

  • heyai
  • heyai
  • OFFLINE
  • Posts: 324
  • Thanks: 79
  • Karma: 24
13 years 9 months ago #154035 by heyai
Thanks for sharing :-)

hey-ai - the community for asian guys and non-asian girls

The search bar is your friend, not just decoration!

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

  • schrubber
  • schrubber
  • OFFLINE
  • Posts: 2
  • Thanks: 0
  • Karma: 0
13 years 9 months ago #154043 by schrubber
Replied by schrubber on topic Re: PHP code: Plugin for adding new fieldtype
Thank you very much for the quick response and share your plugin!

Cheers, Jake

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

Moderators: beatnantkrileon
Powered by Kunena Forum