Keyword

Add dropdown field to k2 user profile

  • Tibbe van Asten
  • Tibbe van Asten's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 6 months ago #132703 by Tibbe van Asten
Add dropdown field to k2 user profile was created by Tibbe van Asten
Hi there,

I'm an user of Joomla for quite a while now, but I'm new to K2. So far, I love the possibility's, but not evertything is easy adjustable. Can anyone help me with the following two questions:

1. I'm extended the profile page with a lot of fields. I did this through a 'hack' I found. Now I only miss one last field. I would like to create a dropdown list with personal titles (professor or something). To make this work, I have tried to add this to the registration.xml from com_users, but I just can't make it show up in my profile.php from com_k2.

2. How do I get to show all added field easy in the K2 user page?

I hope there is a simple solution to this.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 6 months ago #132704 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Add dropdown field to k2 user profile
How does this hack of yours work?

I would suggest that you used a K2 plugin like User Extended Fields.
While you cannot add new fields, you can use this plugin as a skeleton plugin to build upon.

This way you will not lose any changes when you update K2.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Tibbe van Asten
  • Tibbe van Asten's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 6 months ago #132705 by Tibbe van Asten
Replied by Tibbe van Asten on topic Re: Add dropdown field to k2 user profile
Excuse me for the late answer.

I have used a solution like this one: manchumahara.com/2010/03/18/how-to-add-extra-fields-in-joomla-registration/

I have also tried to install User Extended Field, but that leads to error.

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

  • Tibbe van Asten
  • Tibbe van Asten's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 6 months ago #132706 by Tibbe van Asten
Replied by Tibbe van Asten on topic Re: Add dropdown field to k2 user profile
I just installed User Extended Fields and added my custom field through the XML en PHP files.
But now I can't get the lay-out right.

I would like to the fields in a table very field in one row and some titles between fields.
Anyone know how to do this?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 6 months ago #132707 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Add dropdown field to k2 user profile
It is possible but you have to override K2's register and profile.php.
There is a foreach loop that prints fields from plugins.

More about overriding can be found here: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Tibbe van Asten
  • Tibbe van Asten's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 6 months ago #132708 by Tibbe van Asten
Replied by Tibbe van Asten on topic Re: Add dropdown field to k2 user profile
Thanks for the quick respons.

I have already made changes to register.php and user.php and the information is now showing up in on the userpage. But in the profile.php, all extra fields are dumped in just one table column. I would like to make one row per field. Is that possible?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 6 months ago #132709 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Add dropdown field to k2 user profile
Yes, you have probably omitted the closing </td> and </tr> tags in the loop that prints these fields.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Tibbe van Asten
  • Tibbe van Asten's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 6 months ago #132710 by Tibbe van Asten
Replied by Tibbe van Asten on topic Re: Add dropdown field to k2 user profile
The closing tags are still there. I have now solved it with the use of CSS.

One more question: is it possible to show one of the extra fields in the k2 users module. In this case, I would like to add the jobtitle to someone's name. I can't get the retrieval of just one value from the column right.

Hope you can help!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 6 months ago #132711 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Add dropdown field to k2 user profile
What does the var_dump of $user in the module produce?
<pre><?php echo var_dump($user);  ?></pre>

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Tibbe van Asten
  • Tibbe van Asten's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 6 months ago #132712 by Tibbe van Asten
Replied by Tibbe van Asten on topic Re: Add dropdown field to k2 user profile
The part of the user Extended Fields extension:
["plugins"]=>
  string(500) "{"userExtendedFieldsbirthday":"11-11-2011","userExtendedFieldsgender":"Vrouw","userExtendedFieldstitle":"drs.","userExtendedFieldsemployment":"Testbedrijf","userExtendedFieldsdepartment":"Testafdeling","userExtendedFieldsfunction":"Testfunctie","userExtendedFieldsaffiliated":"NARIM","userExtendedFieldsaddress":"","userExtendedFieldszipcode":"","userExtendedFieldscity":"","userExtendedFieldscountry":"","userExtendedFieldslinkedin":"","userExtendedFieldstwitter":"","userExtendedFieldsfacebook":""}"

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


Powered by Kunena Forum