By Sky Host on Thursday, 16 April 2015
Posted in General Issues
Replies 3
Likes 0
Views 805
Votes 0
<?php if( $this->template->get( 'relationship' , true ) ){ ?>
<?php $rel = json_decode($user->getFieldData('RELATIONSHIP'));
echo $rel->type; ?>
<?php } ?>

The above code was given to me by you to display relationship status on the profile but since a few days back it only displays the values and not the relationship names as defined in ES language file.

Ex. For relationship type "It's complicated" - it shows only "complicated"

How do I display relationship type properly on the profile??

MORE EXPLANATION BELOW IF YOU WANT TO READ
---------------------------------------------------------------------------------
The above code shows the relationship status "constant". Example: for relationship status "It's complicated" it shows only "complicated" and for "In an Open Relationship" it just shows "open". See the attached screenshots.

Looks like the theme is not reading the language file.

When I change the values for relationshp status in the language file (siteroot/language/en-gb/en-GB.com_easysocial.ini), it doesn't show the changes on the profile. No matter what I type there, it doesn't show on the profile. Check the screenshot of "en-GB.com_easysocial.ini" file
Example: For PLG_FIELDS_RELATIONSHIP_OPEN="In an open relationship"
if I type PLG_FIELDS_RELATIONSHIP_OPEN="test". It doesn't show "test" on profile
Hello Sky,

You need to do the checking for each relationship type of the user and then add the JText language string for each relationship type. Refer my example below:

<?php if( $this->template->get( 'relationship' , true ) ){ ?>
<?php $rel = json_decode($user->getFieldData('RELATIONSHIP'));
$type = $rel->type;
if ($type == 'complicated') {
echo JText::_('PLG_FIELDS_RELATIONSHIP_COMPLICATED');
}


The above example is to display the relationship type for 'complicated'. You can do the rest by adding the if else for the rest. You can refer to the following file path for the relationship type value and their respective translation label at /media/com_easysocial/apps/fields/user/relationship/config/config.json

Hope these help
·
Thursday, 16 April 2015 18:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you Ezrul, I wish it was easier anyways thank you!!
·
Thursday, 16 April 2015 19:09
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Sky,

I wish it does too . By the I'm glad that your issue has been resolved now
·
Thursday, 16 April 2015 19:23
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post