[SOLVED] plugin onPrepareContent

Questions and bug reports for current release of CKForms

[SOLVED] plugin onPrepareContent

Postby gobezu » Mon Oct 26, 2009 7:23 am

i have failed to make the plugin load with the current code and just wanted to report back with a version that works (at least for me) which is found further down

Code: Select all
function onPrepareContent( &$article, &$params, $limitstart )
    {
        $regex = '/{ckform\s*(.*?)}/i';

        // find all instances of plugin and put in $matches
        preg_match_all( $regex, $article->text, $matches );

        // Number of plugins
        $count = count( $matches[0] );

        if ($count > 0) {
            foreach ($matches[1] as $i => $textFound) {
                // Load Selected form
                $form = $this->loadCkForm($textFound);
             if ($form == null)
            {
               $html = "<span style='color: #FF0000'>CKForms Error Message : <br />Form  '" . $textFound . "' not found !!!</span>";
               $article->text = str_replace($ckFormTag, $html, $article->text);
               
               return;
            }   
                           
                $fields = $this->loadCkFormFields($form->id);

                $_SESSION['ck_send_once'.$form->id] = "1";

                $this->formLink = "index.php?option=com_ckforms&view=ckforms&task=send&id=".$form->id;

                $html = $this->generateCkFormHTML( $form, $fields);

                $article->text = str_replace($matches[0][$i], $html, $article->text);
            }
        }
   }
gobezu
 
Posts: 6
Joined: Sat Oct 03, 2009 7:01 pm
Top

Re: plugin onPrepareContent

Postby pedrino » Mon Oct 26, 2009 9:59 am

Thanks

I change the code of the plug-in and will be on-line in the next release.

Pierre
User avatar
pedrino
Site Admin
 
Posts: 150
Joined: Tue Aug 25, 2009 1:13 pm
Top


Return to CKForms 1.3.x Support forum

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron