Skip to content
Snippets Groups Projects
Commit 9af29467 authored by Sven Schüring's avatar Sven Schüring Committed by Nicolas N
Browse files

Issue #3498702 by sunlix: Instagram: There are no medias after first profile fetch

parent 2a09dc30
No related branches found
No related tags found
1 merge request!10Call for medias directly based on plugin config
......@@ -164,6 +164,7 @@ class InstagramSocialNetwork extends SocialNetworkBase implements ContainerFacto
$cachePool = new FilesystemAdapter();
$api = new Api($cachePool, $this->httpClient);
$profile = $api->getProfile($account_to_retrieve);
$profile = $api->getMoreMedias($profile, $nb_of_posts);
$medias = $profile->getMedias();
if (!empty($medias)) {
......@@ -172,9 +173,7 @@ class InstagramSocialNetwork extends SocialNetworkBase implements ContainerFacto
'#elements' => [],
];
for ($i = 0; $i < $nb_of_posts && $i < count($medias); $i++) {
$media = $medias[$i];
foreach ($medias as $media) {
// Truncate caption.
$caption = nl2br(Xss::filter($media->getCaption()));
if (!empty($caption) && $text_length > 0 && strlen($caption) > $text_length) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment