By Robert on Tuesday, 25 February 2014
Posted in General Issues
Likes 0
Views 653
Votes 0
Is it possible to add the city and state for each users under their name in the userlist? if so, can you guide me on how to do this.

thanks
Edit the file /components/com_easysocial/themes/default/users/default.list.php and add the following codes,


$user->getFieldValue( 'UNIQUEKEY' );


The UNIQUEKEY value must match the custom field's unique key.
·
Tuesday, 25 February 2014 10:32
·
0 Likes
·
0 Votes
·
0 Comments
·
In addition to what Mark said, you access the custom field's key in the advanced tab when viewing custom fields from the "profiles" page in the backend. JOOMLA_USERNAME is an example of a key.
·
Tuesday, 25 February 2014 10:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for sharing Josh Your an expert in EasySocial now (Two thumbs up!)
·
Tuesday, 25 February 2014 10:46
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Mark. I found a handful of more settings today which got me excited! So even when I think I know all the ends, there are usually more possibilities than what we see.
·
Tuesday, 25 February 2014 10:54
·
0 Likes
·
0 Votes
·
0 Comments
·
Yep, EasySocial actually has tons of features that sometimes even we forget about it
·
Tuesday, 25 February 2014 11:18
·
0 Likes
·
0 Votes
·
0 Comments
·
You guus are awesome. If i want to add city and state do i use a comma in between fields?
·
Tuesday, 25 February 2014 21:19
·
0 Likes
·
0 Votes
·
0 Comments
·
Lastly can this line of code be added anywhere in default.list.php forit to show under the user name?
·
Tuesday, 25 February 2014 21:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Robert,

Hm, this is a little tricky for address because the city and the state itself is a field on it's own. Running the code above will return you the entire address. Perhaps we could improvise this in the future so that you can get selective data about the address.
·
Tuesday, 25 February 2014 23:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Got it. I found a way to make it work, thanks Mark
·
Wednesday, 26 February 2014 07:29
·
0 Likes
·
0 Votes
·
0 Comments
·
ES 1.3 is planned to have a state field to work with the country field. This ought to make the address situation a little cleaner.
·
Wednesday, 26 February 2014 07:41
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes indeed
·
Wednesday, 26 February 2014 07:55
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for the heads up on this Robert
·
Wednesday, 26 February 2014 11:02
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark unique key for address field is throwing errors when use in this example

$user->getFieldValue( 'ADDRESS' ); and the error is;
Catchable fatal error: Object of class SocialFieldsUserAddressObject could not be converted to string in /administrator/components/com_easysocial/includes/fields/dependencies.php on line 1195

is there another way to get this work? all other Unique Key works fine except address field

Thanks in advance
·
Sunday, 23 March 2014 06:49
·
0 Likes
·
0 Votes
·
0 Comments
·
We have made some changes to the way getFieldValue works as it now returns a standard class object where you can choose what data you want to output. For instance,


$my = Foundry::user();

echo $my->getFieldValue('ADDRESS')->value->address1;
echo $my->getFieldValue('ADDRESS')->value->address2;
echo $my->getFieldValue('ADDRESS')->value->city;
echo $my->getFieldValue('ADDRESS')->value->state;
echo $my->getFieldValue('ADDRESS')->value->zip;
echo $my->getFieldValue('ADDRESS')->value->country;
echo $my->getFieldValue('ADDRESS')->value->latitude;
echo $my->getFieldValue('ADDRESS')->value->longitude;
·
Sunday, 23 March 2014 15:13
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark, I 've tried the code like this
?php echo $my= Foundry::user();? ?php echo $my->getFieldValue('ADDRESS')->value->city;?
and it returns this error. What am I doing wrong? I am still a rookie in php. Again, I really appreciate your help. Thanks

SocialUser Notice: Trying to get property of non-object in components/com_easysocial/themes/wireframe/users/default.list.php on line 79
·
Sunday, 23 March 2014 20:54
·
0 Likes
·
0 Votes
·
0 Comments
·
Double check if the custom field key is really "ADDRESS" ?
·
Sunday, 23 March 2014 21:20
·
0 Likes
·
0 Votes
·
0 Comments
·
Correction, it works, but how to get rid of the title socialuser in front of the city? this is how it's showing

socialuserbrooklyn

lastly, it showing the same city and state for all userss
·
Sunday, 23 March 2014 21:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Robert,

Your code is incorrect


$my= Foundry::user();
·
Sunday, 23 March 2014 21:44
·
0 Likes
·
0 Votes
·
0 Comments
·
That's what I have in my code and still the same result
·
Sunday, 23 March 2014 22:02
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Robert,

This is the exact code that should be used


<?php $my = Foundry::user(); ?>
<?php echo $my->getFieldValue('TEXTBOX-03')->value->city; ?>, <?php echo $my->getFieldValue('TEXTBOX-03')->value->state;?>


Notice that my codes doesn't have the "echo" on the $my?
·
Monday, 24 March 2014 01:24
·
0 Likes
·
0 Votes
·
0 Comments
·
Sorry Mark, I did try this method before and it didn't work

I am still getting the same error
·
Monday, 24 March 2014 01:38
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

Different fields have different structure of data.

If you are using Textbox field, then it should just be:


echo $my->getFieldValue('TEXTBOX-03');
·
Monday, 24 March 2014 11:04
·
0 Likes
·
0 Votes
·
0 Comments
·
I guess there's no work around for address field because I am using it and the code provided is not working
·
Monday, 24 March 2014 18:59
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Robert,

Which file did you modified? I can go take a look at it
·
Tuesday, 25 March 2014 03:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark, default.list.php from theme/wireframe/users/

Thanks a lot Mark
·
Tuesday, 25 March 2014 03:35
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

1. I can't log in to your site's backend with the given credentials

2. As mentioned before, different custom field has different data structure. If you are working with Address field then the code should but judging from the unique key that you are passing in (from your screenshot), the unique key TEXTBOX-03 seems to mean that you are working with a TEXTBOX field instead of an ADDRESS field. If you are working with a TEXTBOX field, then the code should only be echo $my->getFieldValue('TEXTBOX-03'); without the ->value->state behind.
·
Tuesday, 25 March 2014 10:55
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jason, you should be able to log in now. I am working with address instead of textbox
·
Tuesday, 25 March 2014 18:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Robert,

I have changed the codes for you and it works fine now. Please understand that we can't be helping you customize this all the time

Thank you for being understanding.
·
Wednesday, 26 March 2014 00:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark & John,

Would be nice if there is a section here in the forum for us to share Snippets of code, share ideas or how did I do things.

Thanks!
·
Wednesday, 26 March 2014 00:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark, i greatly appreciate your help. I checked the userlist page and noticed the city for users showed Petaling Jaya Selangor
Instead. Any ideas? Once again thank you
·
Wednesday, 26 March 2014 00:52
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Robert,

That's because I tested this with the user Jane by placing the city and the state. You need to set the correct values accordingly as I don't know where your users live
·
Wednesday, 26 March 2014 00:57
·
0 Likes
·
0 Votes
·
0 Comments
·
LAC Infosys wrote:

Hi Mark & John,

Would be nice if there is a section here in the forum for us to share Snippets of code, share ideas or how did I do things.

Thanks!

Yep, when I have some free time maybe over the weekend or so, I would create a site for contributors to contribute. Of course, you wouldn't just be contributing but you'll be getting other benefits perhaps?
·
Wednesday, 26 March 2014 01:17
·
0 Likes
·
0 Votes
·
0 Comments
·
You're the MAN! Thanks again Mark.
·
Wednesday, 26 March 2014 05:26
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome To avoid any confusions, I will lock this thread now but please start a new thread if you need anything else
·
Wednesday, 26 March 2014 12:00
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post