By Richard on Saturday, 15 March 2014
Posted in General Issues
Replies 20
Likes 0
Views 2.9K
Votes 0
Hi there,

I'm trying to figure out how to call, and display custom field data in the user module.

<?php echo $user->getFieldValue( 'ADDRESS' ); ?>


I've the above with no success. Using the unique key in quotes returns a php error:

Catchable fatal error: Object of class SocialFieldsUserAddressObject could not be converted to string


I've tried creating a new gender custom field with a drop down for male and female and then used:

<?php echo $user->getFieldValue( 'GENDER_2' ); ?>


GENDER_2 being the unique key I assigned to the custom field. All it returns is
SocialTableFieldOptions


Address was just an example, I'm adding MANY different extra fields and I need a way to display the data that the user supplies during the registration process inside a module.

Could anyone offer some insights on how I can achieve this?

Example of what I'm trying to achieve:
Row of 5 recent users. I need to display their Name and Avatar (got that part figured out), I also need to display data from customfield1, customfield2 and customfield3 whether the data comes from a radio field, text field, drop down, etc.
Hello Richard,

Are you testing this on 1.2.0 or 1.1.6 ? We have changed quite a bit since 1.1.x as it wasn't standardized on 1.1.x but in 1.2.0 we have standardized this and the fields should output the appropriate data.
·
Saturday, 15 March 2014 04:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Testing with EasySocial v1.2.0 as per the dashboard. Fresh install of Joomla and EasySocial.

I've made an override for "mod_easysocial_users" and in the loop I've added this:


<?php foreach( $users as $user ){ ?>
<p><?php echo $user->getFieldValue( 'GENDER_2' ); ?></p>
<?php } ?>


The custom field is a dropdown with 2 options, Male and Female and this is what it outputs: SocialTableFieldOptions
·
Saturday, 15 March 2014 04:34
·
0 Likes
·
0 Votes
·
0 Comments
·
If you need me to provide the modified file or site information, let me know.
·
Saturday, 15 March 2014 08:54
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Richard,

Try this instead,


// The return values are
// 1 - male , 0 - female
echo $actor->getFieldData('GENDER_2');
·
Saturday, 15 March 2014 14:24
·
0 Likes
·
0 Votes
·
0 Comments
·
Using $actor returns a php error, but replacing $actor with $user displays the correct information.

<p><?php echo $user->getFieldData('GENDER_2'); ?></p>


So it looks like using getFieldData is the right course rather than getFieldValue.

I will do somemore testing to make sure all is well, and if everything works as I hope, then I will mark the topic resolved.

Thank you, Mark!
·
Saturday, 15 March 2014 14:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Richard,

Ah, that code was just a sample You should change the variables accordingly.
·
Saturday, 15 March 2014 23:45
·
0 Likes
·
0 Votes
·
0 Comments
·
What if you want to call a custom field for instance in the user list.Is there something extra as the above method does not work. the file I want to include extra fields is default.list.php.Thanks.
·
Saturday, 19 July 2014 02:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

It's actually using the same exact code and perhaps you want to see what errors you are getting from it.
·
Saturday, 19 July 2014 15:06
·
0 Likes
·
0 Votes
·
0 Comments
·
There isn't any error when I am using it but field info is not called in the list view. I unclude "<div class="user-extrainfo"> <p><?php echo $user->getFieldData('MOBILE'); ?></p></div>" on line 81 after item-title.No errors.
·
Sunday, 20 July 2014 17:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Is the key "MOBILE" that you are using is a valid key?
·
Sunday, 20 July 2014 22:29
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes it is.I am 100% sure for it.
·
Monday, 21 July 2014 03:06
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Toddimus,

I am sorry for the late reply.
I cannot replicate this issue with my local site. It seems like it is working as it should be. Perhaps you can provide us with backend access and ftp access to your site so that we can check this issue on your site and help you fix this issue.

Please be advise.
Thanks.
·
Monday, 21 July 2014 15:17
·
0 Likes
·
0 Votes
·
0 Comments
·
site details provided. please reference previous responses
·
Monday, 21 July 2014 22:54
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

Kindly please set the user tempadmin with super administrator privileges as we need to look at the fields that you have created.
·
Monday, 21 July 2014 23:33
·
0 Likes
·
0 Votes
·
0 Comments
·
alrighty, give it a shot.
·
Monday, 21 July 2014 23:34
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Toddimus,

Hm, I don't really see any issues here. I have edited the user Aaron Huey and included his mobile number. It appears correctly at

P/S: I don't seem to see any fields on your site that uses the key of TEXTBOX . Which field are you trying to display here?
·
Monday, 21 July 2014 23:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for the help Mark. A couple more things. We're having difficulty displaying the users' email address on the same page. Is the email field blocked from being called for security reasons or something of that sort?
·
Tuesday, 22 July 2014 10:04
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Toddimus,

Hm, we don't actually disable any emails. What is the code that is used to display user's email? It should just be the following:


<?php echo $user->email;?>
·
Tuesday, 22 July 2014 13:31
·
0 Likes
·
0 Votes
·
0 Comments
·
that does it thanks man. can you please remove the above link in this thread to our client's site? thanks!
·
Tuesday, 22 July 2014 23:29
·
0 Likes
·
0 Votes
·
0 Comments
·
Sure
·
Tuesday, 22 July 2014 23:35
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post