By benjamin beaugh on Tuesday, 23 April 2019
Likes 0
Views 2.6K
Votes 0
Hi guys!

Is there a way to make use of foundry.php outside of joomla environment?
i have a script i made that takes easysocial users and some specific profile fields and puts them into a json file to use for other reasons.

I either want to call this script when the user updates their profile (cant find what view does that tho)
OR
schedule to run that script with a cronjob.
the script cant access foundry.php outside of the joomla environment tho.

Thanks for any advice!
Hi Benjamin,

Perhaps, you can call your script inside the controller file instead located in:
.../components/com_easysocial/controllers/profile.php
in the save function

Hope this help.

You're suggested to backup the file that you want to customize beforehand for precaution
·
Tuesday, 23 April 2019 10:36
·
0 Likes
·
0 Votes
·
0 Comments
·
or actualy not foundry... easysocial.php
i see foundry is deprecated as of now.
·
Tuesday, 23 April 2019 10:19
·
0 Likes
·
0 Votes
·
0 Comments
·
thank you for your quick response!

this is the code im trying to inject

require_once( JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/easysocial.php' );

$groupId = '23'; // define which memberoup you want to display.
$model = FD::model('Groups');
$members = $model->getMembers( $groupId, array( 'users' => true ));


foreach ($members as $member) {
$item = array(

'username' => $member->getName(),
'mixer' => $member->getFieldData('mixerchannel'),
'twitch' => $member->getFieldData('twitchchannel'),
'dlive' => $member->getFieldData('dlivechannel'),
'youtube' => $member->getFieldData('youtubelink'),
'shedrole' => $member->getFieldData('shedrole'),
'contentcreator' => $member->getFieldData('contentcreator'),
'avatar' => $member->getAvatar('medium')
);
$file_data_array[]=$item;
}
$fp = fopen('results.json', 'w');
fwrite($fp, json_encode($file_data_array));
fclose($fp);


the result is "results.json" file
ive tried inserting this into the file you mentioned after

public function save()
{

but it doesnt seem to initiate

I know this is beyond helpdesk scope, i appreciate your help
·
Tuesday, 23 April 2019 11:35
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Benjamin,

For your information I have move this ticket to more appropriate category.
I have tried to use your code(remove some code that not necessary me to test) seems it works fine https://take.ms/lHYv0
·
Tuesday, 23 April 2019 12:08
·
0 Likes
·
0 Votes
·
0 Comments
·
Fadhli!!

Thanks! i was looking in the wrong place for the resulting file... i thought it would appear in the same directory!

Thank you so much for your help. The support here at Stackideas is amazing.

Have a great week!
·
Wednesday, 24 April 2019 05:13
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome Benjamin Glad to hear your issue has resolved.

Just for your information, I have locked and marked this thread as resolved to avoid confusions in the future. Please start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiries.

Thanks for understanding and have a great week as well to you;)
·
Wednesday, 24 April 2019 10:16
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post