1. czarrna
  2. General
  3. Saturday, March 12 2016, 07:57 PM
Hello,

I have 2 groups - people and companies.

In case of companies I need to hide first- and lastname fields (both required) on the profile list and the profile view.

I do not want companies to be listed by first and last name of a person who will be registering particular company.

Is there a way to hide those fields for a particular group and to link the created field "company_name" as the main link to the profile view?

Would be grateful for help!
Accepted Answer
admin Accepted Answer
Admin
Hi,
sorry for late reply, it is a weekend for us.

In case of companies I need to hide first- and lastname fields (both required) on the profile list and the profile view.
This is not possible, fields like firstname are core fields directly connected to Joomla Name. You can do something like this:
1) User these fields for a reference person of Company
2) Set in Easy Profile options "format name" parameter to "only name", with this option the lastname will be disabled and you can use name field for Company name or User name.

I do not want companies to be listed by first and last name of a person who will be registering particular company.

Is there a way to hide those fields for a particular group and to link the created field "company_name" as the main link to the profile view?
You can create a override of our profile page to show title from another field, see this example:

I have a select field called "registration_type" with these options:
0|User
1|Company
If you choose Company you will have a field called company_name.

Now I can override profile page template and show comany_name instead firstname and lastname if registration_type is "1"
- Copy file from /components/com_jsn/views/profile/tmpl/default.php to /templates/your-template-folder/html/com_jsn/profile/default.php
- Edit new field and replace at line 66 with this:
<?php 
if( $this->data->registration_type == 1 ) echo $this->data->company_name;
else JsnHelper::getFormatName($this->data);
?>


Why override? because with override when you update Easy Profile then this code will not be overwritten. This is a Joomla feature.

NOTE: this code is for example purpose, not tested and not supported.
  1. more than a month ago
  2. General
  3. # Permalink


There are no replies made for this post yet.
However, you are not allowed to reply to this post.