Skip to content

Commit

Permalink
Saving username in database. Fixing username error on import
Browse files Browse the repository at this point in the history
  • Loading branch information
3Dgoo committed Jun 3, 2020
1 parent 0d52514 commit cebd661
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Tasks/ImportInstagramPostsTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ class ImportInstagramPostsTask extends BuildTask
public function run($request)
{
$username = $request->getVar('username');
$username = Environment::getEnv('INSTAGRAM_USERNAME');
$password = Environment::getEnv('INSTAGRAM_PASSWORD');
$loginUsername = Environment::getEnv('INSTAGRAM_USERNAME');
$loginPassword = Environment::getEnv('INSTAGRAM_PASSWORD');

if (!$username) {
return;
}

$instagram = null;

if ($username && $password) {
$instagram = Instagram::withCredentials($username, $password, new Psr16Adapter('Files'));
if ($loginUsername && $loginPassword) {
$instagram = Instagram::withCredentials($loginUsername, $loginPassword, new Psr16Adapter('Files'));
$instagram->login();
$instagram->saveSession();
} else {
Expand Down Expand Up @@ -60,6 +60,7 @@ public function run($request)

$instagramPost->InstagramID = $instagramID;
$instagramPost->Title = $title;
$instagramPost->Username = $username;
$instagramPost->ImageURL = $imageURL;
$instagramPost->ImageThumbnailURL = $imageThumbnailURL;
$instagramPost->Posted = $posted;
Expand Down

0 comments on commit cebd661

Please sign in to comment.