By Mel on Friday, 19 October 2018
Posted in General Issues
Replies 3
Likes 0
Views 374
Votes 0
Hi,

I have some custom work that automatically creates event.

I want to use the same image that is used for my event cover as the avatar also. The reason I want to do this is I use the appcarvers events app and they use the avatar as the event image on the app. At the moment all the events without avatars are showing the default calendar icon which is pointless within the app.

I have found the code that I need to change but not exactly sure what to add. This is the code that creates my event cover:


// Set the cover for the event
// Only upload cover if this came from importer
if ($this->image && $fromImporter) {
$this->uploadCover($event, SOCIAL_TYPE_EVENT, $creator);
}
}


I found your documentation on retrieving the avatar and cover as follows:


require_once(JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/easysocial.php');
$my = ES::user();
// Cover is a photo object
$photo = $my->getCover();


s it as simple as changing the last line of your example to this:

$avatar = $my->getCover();

Or is it more complicated?

I did try just adding the above line to the end of the original code but it did nothing.

Kind regards

Mel
Hello Mel,

I am sorry but adding image as avatar is more complicated then just assigning it to variable $avatar.
·
Monday, 22 October 2018 10:44
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Nik,

thanks for responding. I will add it to my custom work jobs

Kind regards

Mel
Mel
·
Monday, 22 October 2018 11:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mel,

You're welcome.
·
Monday, 22 October 2018 12:00
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post