COMMUNITY FORUM
User Extended Fields Plugin
- David Raza
-
Topic Author
- Offline
- New Member
- Welcome to my presence!
My goal is to add additional fields to K2 Users.
I have installed the User extended fields plugin and which is working apart from some language errors on the plugin management page.
I have also started to add additional fields to this plugin as I need quite a few!
The problem is rendering the HTML output for the form elements both on the admin side and frontend user account page.
They are just being output as very basic form elements.
Can somebody please tell me where I can control/edit this html output?
Note: Viewing the users profile on the frontend is fine and I have found the template for this.
Thanks in Advance.
DR
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
The fields are presented in the frontend from the profile.php and register files.
Please Log in or Create an account to join the conversation.
- David Raza
-
Topic Author
- Offline
- New Member
- Welcome to my presence!
Thanks for responding.
I have already found the following code in profile.php and register.php:
<?php foreach($this->K2Plugins as $K2Plugin): ?>
<?php if(!is_null($K2Plugin)): ?>
<tr>
<td colspan="2">
<?php echo $K2Plugin->fields; ?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
.. but how do I expand this to display the output in a table etc?
Sorry if I am being dumb and missing something obvious here.
Also, does this render the output/form in admin or is that seperate?
Thanks
DR
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
The fields do render in a table cell.
You can try a <?php echo var_dump($K2Plugin->fields); ?>
to see all the object's elements so you can directly render fields.
You can achieve the same result however with CSS.
Please Log in or Create an account to join the conversation.
- David Raza
-
Topic Author
- Offline
- New Member
- Welcome to my presence!
The var_dump just displays the same form fields again except for string(15339)"..." around them. Is this right?
Although they are rendered in a table cell, after that there is no formatting so just an ugly group of fields.
Is this how it should be from the original plugin or could there be an error somewhere?
Screenshots -
I apologise... my PHP is not so great and trial/error most of the time!
Thanks again
DR
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Please Log in or Create an account to join the conversation.
- David Raza
-
Topic Author
- Offline
- New Member
- Welcome to my presence!
I used the imgur suggestion below...
2nd attempt:
[url=http://http://imgur.com/a/3Q5AX#0]imgur.com/a/3Q5AX#0[/url]
Should be imgur.com/a/3Q5AX#0
David
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
You are posting to two different threads. This is counter productive, it will only get us confused.
Please keep in in one thread.
Please Log in or Create an account to join the conversation.
- David Raza
-
Topic Author
- Offline
- New Member
- Welcome to my presence!
Images are of backend and frontend edit pages.
Basically, the only area which IS formatted with this plugin is the profile display on the frontend.
I am just trying to figure out where I can edit the output of the plugin which renders the form fields for the above pages.
Apologies about posting to the other thread, I should have just pointed to this one.
As you have seen in the other thread I have managed to hack the core K2plugin so that the label and input fields are wrapped in rows/cells but as you have also rightly pointed out this is far from ideal!
I just can't seem to get my head around how the plugin can be modified... even after looking at other k2 plugins and core Joomla ones!!
DR
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
I will make a PR in github in K2's backend styling to sort this out.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
and let me know if that works for you.
Please Log in or Create an account to join the conversation.
- David Raza
-
Topic Author
- Offline
- New Member
- Welcome to my presence!
I added the css styles as per your patch and while this improved things a little, it is still a very simple block layout and lacks further formatting to make the labels/fields inline etc.
I have added some css to improve this but when I add a class to the xml file, the class is only being added to the input fields and not the label.
Is this correct?
Looking at the source I see the following:
<label id="address-lbl" for="address" class="">Address</label>
<input type="text" name="plugins-[userExtendedFieldsaddress]" id="address" value="" class="rw-input" size="40"/>
Do you know how I can add a class to the label through xml?
At the moment I am simply styling using the label and input classes but would like more control.
While I appreciate that the extended fields plugin is free, it would have made sense to have it output the same structure as the core k2 forms so that the look is consistent which is what I am trying to achieve.
Thanks
David
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
The two lines that where added control the plugin's input and label elements in the user's forms.
Please Log in or Create an account to join the conversation.