Forums

Can't use form inside include (PHP)

htp44 26 Jan, 2011
Hello,

specs: component chronocontact 3.2, plugin chronocontact 3.1, Joomla 1.5.22, desperated

I want to display my form only if the Joomla User is logged in.
Therefore I tried this (using directphp):

If (Login == "No")
{
echo "nope, blabla";
}
else
{
echo "{chronocontacts}form{/chronocontacts}";
}


But the form shows up no matter if the user is logged in or not. The plugin just ignores "else"
therefore I tried this:

If (Login == "No")
{
echo "nope, blabla";
}
else
{
inculde 'folder/form.php';
}


And inside form.php:

<?php echo "{chronocontacts}form{/chronocontacts}"; ?>
}


Result:

The screen displays (besides the normal joomla-content) just this:

{chronocontacts}form{/chronocontacts}




Question:

Is there a way, that I can use pure PHP to display the form without the plugin?
What else can I do? 😢

PS I need to show some explanations before I display the form. This explanation has to be public, therefore I need to use the plugin, don't I?

Thanks in advance,
Frank
GreyHead 30 Jan, 2011
Hi htp44,

You can use the Watchman Plug-in or you can add this code to the beginning of the Form HTML
<?php
$user =& JFactory::getUser();
if ( !$user->id ) {
  return;
}
?>

Bob
htp44 31 Jan, 2011
Thanks Bob!

Glad you're back.😉

What is the watchman plug-in? Google didn't want to tell me?

Best regards,
Frank
GreyHead 31 Jan, 2011
Hi htp44,

It's one of the ChronoForms plug-ins on the left hand column in the Form Manager. It lets you control access to your form by user groups and/or by date and/or by time.

Check the box by the form name, then click the Plug-in link to configure it. Lastly open the Form Editor and enable the plug-in on the Plug-ins tab (green bars are enabled).

Bob
This topic is locked and no more replies can be posted.