2

I would like to know what this code does in the joomla file

components/com_users/views/login/tmpl/default_login.php

<?php foreach ($this->form->getFieldset('credentials') as $field): ?>
<?php if (!$field->hidden): ?>

Also, how do I add the "remember me" option that is given with the login module? Thanks.

DaveRandom
  • 87,921
  • 11
  • 154
  • 174
theoth
  • 127
  • 3
  • 11

1 Answers1

2
<?php foreach ($this->form->getFieldset('credentials') as $field): ?>

This section will get the all the fields from the "credentials" fieldset stored in:

components/com_users/models/forms/login.xml


<?php if (!$field->hidden): ?>

If the field being processed on the loop is not hidden .... then... it will be displayed I guess.


Regarding the "remember me" option, you can find a solution in the joomla forum:

http://forum.joomla.org/viewtopic.php?f=615&t=695612

Shaz
  • 2,647
  • 2
  • 35
  • 45
  • So would it be okay for me to remove those lines? As I would like to load the labels and fields seperately, and to do that I need to remove, the foreach statement, which makes the second line of code useless in effect. – theoth Apr 03 '12 at 16:20
  • IMO you shouldn't modify the core files (even if it's a view), you should override the layout and there you can remove those lines and customize your view at your will. – Shaz Apr 03 '12 at 16:27
  • Yep this is an override I am doing. But I'm unsure if it's okay to remove those two lines? – theoth Apr 03 '12 at 16:37
  • It's OK :) as long as you use the same fieldnames... or well, it depends on what you are doing. – Shaz Apr 03 '12 at 16:40
  • Oh okay. I need to load the fields seperately so I can control their layout more. I have loaded the fields from the module instead: ` ` Is that method okay, or should I load them from the com_user folder? – theoth Apr 03 '12 at 16:51
  • If you are using that code is seems to be ok. It's using the same value in name. – Shaz Apr 03 '12 at 17:06