I am running Joomla 1.7 and that i realize that it is able to add custom form fields to components having a wordpress plugin.

There's an example wordpress plugin situated at: /plug ins/user/profile

This wordpress plugin enables you to definitely put custom form fields around the account front-end and back finish which fields are saved inside a custom table.

I produced an identical wordpress plugin for user profiles also it labored perfectly.

However, after i go to produce a wordpress plugin such as this for com_content, I'm met having a problem.

this is exactly what my XML file appears like:

<?xml version="1.0" encoding="utf-8"?>
  <form>
   <fields name="additionalinfo">
    <fieldset name="additionalinfo_fieldset" label="PLG_CONTENT_ADDITIONALINFO_FIELDSET_LABEL">
        <field name="tagline" type="text" size="50" default="" label="PLG_CONTENT_ADDITIONALINFO_TAGLINE_LABEL" description="PLG_CONTENT_ADDITIONALINFO_TAGLINE_DESC" />
        <field name="pseudocategory" type="category" extension="com_content" label="PLG_CONTENT_ADDITIONALINFO_PSEUDOCATEGORY_FIELD_LABEL" description="PLG_CONTENT_ADDITIONALINFO_PSEUDOCATEGORY_FIELD_DESC" />
    </fieldset>
  </fields>
</form>

Nevertheless this doesn't work, whenever I actually do something similar to above, the shape fields never show on the admin form (despite the fact that I've it set properly, and also the only factor that transformed between your user wordpress plugin and also the content wordpress plugin may be the title from the form i would like the shape to look on

After I change my XML for this:

<?xml version="1.0" encoding="utf-8"?>
  <form>
   <fields name="attribs">
    <fieldset name="additionalinfo_fieldset" label="PLG_CONTENT_ADDITIONALINFO_FIELDSET_LABEL">
        <field name="tagline" type="text" size="50" default="" label="PLG_CONTENT_ADDITIONALINFO_TAGLINE_LABEL" description="PLG_CONTENT_ADDITIONALINFO_TAGLINE_DESC" />
        <field name="pseudocategory" type="category" extension="com_content" label="PLG_CONTENT_ADDITIONALINFO_PSEUDOCATEGORY_FIELD_LABEL" description="PLG_CONTENT_ADDITIONALINFO_PSEUDOCATEGORY_FIELD_DESC" />
    </fieldset>
  </fields>
</form>

After I get this to simple change, the shape fields appear! BUT, the information is not saved or retrieved in the custom table, it simply adopts the 'attribs' column around the _content table. This stores this content in JSON, that is okay, but we want to have the ability to index this content through the custom fields (without having to loop through each record within the database to locate what we are searching for).

Any tips on how to fix this?

thanks!

david barratt

I suppose your wordpress plugin file ( for instance, "yourplugin.php" ) may have one way known as "onContentPrepareForm". If you wish to add data for an article, this process should start such as this:

function onContentPrepareForm($form, $data)
{

    if (!($form instanceof JForm))
    {
        $this->_subject->setError('JERROR_NOT_A_FORM');
        return false;
    }

    // Check we're manipulating an
    if ( $form->getName() != "com_content.article" ) {
        return true;
    }
    //[...] The rest of your code here

Besides, if you wish to store these fields in another table to be able to allow it to be simpler to look by using this fields, perhaps you should produce a new table and save the information while using "onContentAfterSave" method:

public function onContentAfterSave( $context, &$article, $isNew )

About this method, it is best to make sure that $context is "com_content.article", or else you might face problems when saving groups.

I really hope it will help!