By adrien on Friday, 19 June 2015
Replies 3
Likes 0
Views 0.9K
Votes 0
Hello dear StackIdeas team,

I was reading the documentation about setFieldValue at
http://stackideas.com/docs/easysocial/developers/users/users
And wanted to use getFieldValue too.

I need to copy a user'ss address field content to an other user's address field so I tryed this and did not work. I know address fields are particualr as they hold multiple keys and values.


require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php' ;
$user1 = Foundry::user($userid1);
$address = $user1 ->getFieldValue( 'ADDRESS' );

$user2 = Foundry::user($userid2);
$user2->setFieldValue( 'ADDRESS' , $address );

I wonder if it's missing some parameters or serialization...
Any tip welcome
Hello Adrien,

I am sorry for the delay of this reply.

For address field its kinda complicated to achieve. Can you try the following code instead and see how it goes?
require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php' ;
$user1 = FD::user($userid1);
$address = $user1 ->getFieldValue( 'ADDRESS' );

$user2 = FD::user($userid2);
$user2->setFieldValue( 'ADDRESS' , $address->value->address);
·
Monday, 22 June 2015 17:15
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you for the reply.
Actually not only the address part of the address needs to be set:
I need address1, address2, zip, state, city, country , latitude and longitude.

I think I'll do it by sql queries.
·
Saturday, 27 June 2015 18:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Adrien,

I am sorry for the delay of this reply.

Thank you for the heads up on this. If you've found a workaround by using sql queries perhaps you can post the solution here so that other user could use it.
·
Tuesday, 30 June 2015 12:36
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post