TOPIC:

Section only to a specific user 4 years 2 weeks ago #206005

  • Topic Author
  • AwK
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 94
  • Karma: 1
  • Thanks: 2
This text was translated with the Google translator because I do not speak English.
Hello,
I had this problem a long time ago already posted here.
But I lost sight of it.
Now I need your help again.
I want a particular section to be displayed to a specific user only.
All other registered users are not allowed to view this section.
How do I do that?

Many Thanks
Alexander

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

Section only to a specific user 4 years 2 weeks ago #206020

  • MarioPuco's Avatar
  • MarioPuco
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 5958
  • Karma: 119
  • Thanks: 557
Hello Alexander,

Please take a look at this article, it has an example for what you are trying to achieve.
crosstec.org/en/support/online-documenta...egistered-users.html
function ff_FORMNAME_init() // remember to replace FORMNAME with the real name of your form
{
     <?php
     if( JFactory::getUser()->get('id',0) > 0 )
     {
          echo
          "
          function mytoggler()
          {
               bfToggleFields('off', 'section', 'section1', bfDeactivateField);
               bfToggleFields('on', 'section', 'section2', bfDeactivateField);
          }
          ";
     }
     else
     {
          echo
          "
          function mytoggler()
          {
               bfToggleFields('on', 'section', 'section1', bfDeactivateField);
               bfToggleFields('on', 'section', 'section2', bfDeactivateField);
          }
          ";
     }
     ?>
} // ff_FORMNAME_init

You would only need to change if( JFactory::getUser()->get('id',0) > 0 ) to matches your user group you want to display this section to.

Let us know if you have any other questions.

Regards,
Mario

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

Section only to a specific user 4 years 2 weeks ago #206025

  • Topic Author
  • AwK
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 94
  • Karma: 1
  • Thanks: 2
I already tried it. Then the admin gets both files. That is correct.
But I want the user to get it. To his email address, which he entered into the form.

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

Section only to a specific user 4 years 2 weeks ago #206029

  • Topic Author
  • AwK
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 94
  • Karma: 1
  • Thanks: 2
Excuse me, I replied to the wrong position.
This is unfortunately not what I can use.
My form is only visible to registered users.
Now I would like that only the Admin sees a certain section, all other registered users should be hidden.

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

Section only to a specific user 4 years 2 weeks ago #206054

  • MarioPuco's Avatar
  • MarioPuco
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 5958
  • Karma: 119
  • Thanks: 557
Hello,

Go to your form advance options > More options > Form pieces > Before form > custom and paste this code :

$user = JFactory::getUser();
$groups = $user->get('groups');
foreach($groups as $group)
{ 
if ($group=='8') 
{
echo "<script>
jQuery( document ).ready(function() {
bfToggleFields('on','section','section2',bfDeactivateField);
bfToggleFields('on','section','section1',bfDeactivateField);
});
</script>";
}
else   {
echo "<script>
jQuery( document ).ready(function() {
bfToggleFields('off','section','section2',bfDeactivateField);
bfToggleFields('on','section','section1',bfDeactivateField);
});
</script>";

}
}

With this code only the SUPER USER ( SUPER USER ID = 8 ) will be able to see Section1 + Section 2. You can add an else statement with users group that you don't want to see this .
I'm sending you a form where you can see how it's done.

Regards,
Mario
Attachments:

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

Section only to a specific user 4 years 2 weeks ago #206140

  • Topic Author
  • AwK
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 94
  • Karma: 1
  • Thanks: 2
Thank you so much,
That was a great help.
Now I've figured out how it works.

Best regards
Alexander

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

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.052 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!