Not sure

mni82 04 Dec, 2010
Hi there,

First of all... Nice tool!
But i have one thing i cant figure out.
I have a created 3 forms.
1. contact form
2. profile to watch
3. profile to edit

I use the chronocontact plugin to display the foms in a article.
What i'm trying to achieve is that guests will see the contactform.
If it is a regstered user with a different alias (querystring) then they see the watch profile. (to see information about others). If it is a rgistered user with the same alias (querystring) then the can see the edit profile. (to edit his own information).
What is the best sulliotion to approach this.

Many thanks

Frog
GreyHead 05 Dec, 2010
Hi Frog,

This is tricky, you are trying to do is to put three forms in the same space depending on the current user id. I can think of a few ways that you could make this work:[list=a]
  • You could merge all three forms into one and use PHP in the Form HTML to select which parts of the HTML to display. This would work but would be quite a lot of work to set up.
  • YOu could add a very simple fourth form to embed in the article that just redirected toe user to the appropriate form for them. This is very easy to do but may not give you the look and feel that you want.
  • You could use a plug-in like Jumi (or Sourcerer) to check the current user id and then display the appropriate form plug-in code. I haven't tested this but as long as the Jumi plug-in runs before the ChronoForms plug-in it should work OK.
  • [/list:o]
    Bob
    mni82 07 Dec, 2010
    Hi bob,

    Awsome response time 😀. Not used to that in other forms.
    I installed Sourcerer and i already tried what you described in option 'c'.
    This is what i tested. It's not exactly what i described before, but if i got this
    working, it would be a piece of cake:

    
    {source}
    <?php
          $user = JFactory::getUser();
          if($user->get('guest') == 1) : ?>
              {chronocontact}contactFormulier{/chronocontact}
          <?php endif; ?>
    {/source}
    {source}
    <?php
          $user = JFactory::getUser();
          if($user->get('guest') == 0) : ?>
              {chronocontact}Profile{/chronocontact}
          <?php endif; ?>
    {/source}
    


    If i do this the forms wil be display perfectly.
    However, in the profile the textboxes are empty. The
    Adres: {address}
    does work. The form on his own uses the profile plugin and works perfectly.

    In the contactform (named as contactFormulier) a simple form is displayed.
    Howerver when i try to send a message, sometimes the validation of the user emailaddress (supplied by user) is shown. The text of the email address textbox changes to:
    
    <script language='JavaScript' type='text/javascript'> <!-- var prefix = 'mailto:'; var suffix = ''; var attribs = ''; var path = 'hr' + 'ef' + '='; var addy12768 = 'test' + '@'; addy12768 = addy12768 + 'test' + '.' + 'nl'; document.write( '<a ' + path + '\'' + prefix + addy12768 + suffix + '\'' + attribs + '>' ); document.write( addy12768 ); document.write( '<\/a>' ); //--> </script><script language='JavaScript' type='text/javascript'> <!-- document.write( '<span style=\'display: none;\'>' ); //--> </script>Dit e-mailadres is beschermd tegen spambots. U heeft Javascript nodig om het te kunnen zien. <script language='JavaScript' type='text/javascript'> <!-- document.write( '</' ); document.write( 'span>' ); //--> </script>
    


    Does this ring any bell for you?
    GreyHead 07 Dec, 2010
    Hi mni82,

    I'll reply to the first part in the morning.

    For the second part: You have the Joomla! Email Cloaking Plug-in enabled and it is trying to cloak the sample e-mail in the ChronoForms validation message. Disable the plug-in temporarily to check this is the problem. If you need the plug-in change the plug-ins order so that Email Cloaking runs before ChronoForms.

    NB These are Joomla! plug-ins that you manage from Site Admin | Extensions | Plug-in Manager

    Bob
    mni82 07 Dec, 2010
    about the second part:
    I changed the Plug in order and it seems to work.
    Thank you very much.

    I cant hardly wait until tomorow. 😀
    GreyHead 08 Dec, 2010
    Hi mni82,

    What do you have in the Profile Page plug-in setup for the Profile form?

    Bob

    For other readers here's a slightly simplifed version of your 'Sourcerer' code:
    {source}<?php
    $user = JFactory::getUser();
    if($user->get('guest') == 1) {
      $form = 'contactFormulier';
    } else {
      $form = 'Profile';
    } 
    echo "{chronocontact}$form{/chronocontact}";
    ?>{/source}


    Bob
    mni82 08 Dec, 2010
    Thanks for the simplified code.
    In the profile plugin page of the profile form i got:

    Table name: joom_contact_details
    Target field name: Alias
    'Request' parameter name: alias
    Default Request Parameter value: <EMPTY>
    Oder type: ASC
    Editable: Yes
    Skipped fields list: <EMPTY>
    Evaluate code: Yes

    I call the page with the querystring http://www.domain.nl/page.php?alias=<joomlaAlias>
    GreyHead 09 Dec, 2010
    Hi mni82,

    The column name in #__contact details is 'alias', not 'Alias'. Please see if that makes the difference.

    Bob
    mni82 09 Dec, 2010
    The "'Request' parameter value" is the name of the querystring if i dont mistake.
    Furthermore the profile form works perfectly when i navigate to it from the joomla menu.

    The textboxes are only empty when the profile is in a article shown with Sourcerer as i try to do.

    Btw, i changed the subject. So other users will know what this post is about

    Frog
    GreyHead 11 Dec, 2010
    Hi mni82,

    The "'Request' parameter value" is the name of the querystring if i dont mistake.

    Yes, but that isn’t the entry I was asking about.

    What is the Sourcerer code you are using now and how does that pass the parameter?

    Bob
    mni82 14 Dec, 2010

    Yes, but that isn’t the entry I was asking about.


    Im not sure what your it is that your asking.

    For now i use the code.
    
    {source}
    <?php
          $user = JFactory::getUser();
          if($user->get('guest') == 1) {
                $form = 'contactFormulier';
          } else {
                $form = 'Profile';
          }
          echo "{chronocontact}$form{/chronocontact}";
    ?>{/source}
    

    The simplified code as you provided me.
    But i still have the same issue with empty textboxes in the profile.
    I tried different things last days, but none seems to work.
    Do you know if it should work with Chronoforms?

    Seems like the profile plugin is not connected to the textboxes when
    the form is displayed using php or something like that.
    mni82 25 Dec, 2010
    Unfortunately i still didnt get this to work.
    Is there somebody on this form who maybe got a solution?
    Any help would be appreciated.

    Frog
    GreyHead 27 Dec, 2010
    Hi Frog,

    Sorry, I was hoping to set this up and test it but I just haven't had time. When you have Two Joomla! plug-ins, the ChronoForms extension and a ChronoForms plug-in working together then there are many places that the code could break.

    I'd suggest that you try setting the values in the Profile page plug-in directly by reading the values from the table.

    Bob
    mni82 28 Dec, 2010
    Okay, i'll try it that way.
    Bit more work, but if it is the key to the solution im a happy man.
    Thanks for your time
    This topic is locked and no more replies can be posted.