Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It appears that when a person updates their profile picture, their image becomes broken in my feed. Anyone have a solution for this?
Comment | File | Size | Author |
---|---|---|---|
#8 | updated_profile_image-2394595-8.patch | 1.69 KB | LiamPower |
#7 | twitter-profile-info-outdated-2394595-7.patch | 1.7 KB | kevinchampion |
#5 | twitter-n2394595-5.patch | 1.55 KB | DamienMcKenna |
Comments
Comment #1
DamienMcKennaPlease leave the issue status at "Active" when you open an issue, "Needs work" is for when someone uploads a patch but the patch itself needs work. Thanks for opening the issue!
Comment #2
DamienMcKennaWhich image is broken - their Drupal user profile pic or their Twitter pic? Can you please provide some example HTML to show what it looks like after they update their account?
Comment #3
kevinchampion CreditAttribution: kevinchampion as a volunteer commentedI believe the issue here is that the twitter account profile information can become outdated, specifically the data retrieved from the users_show API endpoint. This includes the twitter account profile image url stored in twitter_account->profile_image_url.
Steps to reproduce
- Add an unauthenticated twitter account
- Confirm that the account's profile photo was correctly retrieved and displays on the listing page
- Change the twitter accounts profile photo on twitter.com
- Confirm that the account's profile photo on the listing page is now a broken image
This user data is retrieved from users_show API endpoint, which only gets called when an authentication attempt happens in twitter_signin.module or when a user (authenticated or unauthenticated) is added at admin/config/services/twitter. Since in most cases the data is only retrieved once, there's no facility to keep it up-to-date over time. So, when a user updates their profile photo on twitter.com, twitter removes the previous profile photo and this leads to the broken images.
Fixing this could be a user-triggered configuration action, but it seems better as an automated routine that runs periodically in the background to keep the data up-to-date. The attached patch does just that by adding a call to make a request to users_show in an effort to update the twitter profile information stored in Drupal.
Comment #4
LiamPower CreditAttribution: LiamPower at Reading Room commentedPatch works for me
Comment #5
DamienMcKennaThe new function needed a little tweaking to handle the auth process better.
Comment #6
LiamPower CreditAttribution: LiamPower at Reading Room commentedPatch #5 also works for me.
Comment #7
kevinchampion CreditAttribution: kevinchampion as a volunteer commentedFound that an outdated profile could be present in the list of users (for instance if a Twitter account was deleted), which causes breakage. Added a check on the returned data from Twitter to prevent such a problem.
Interdiff 5-7
Comment #8
LiamPower CreditAttribution: LiamPower at Reading Room commentedThe patch from #7 breaks as twitter_fetch_user_account required a $twitter_account as an object, not just the ID.
Added a fixed patch.
Comment #9
rossb89 CreditAttribution: rossb89 at ComputerMinds commentedJust ran into this issue, confirmed patch #8 seems to do the trick!
I haven't tested thoroughly if this impacts anything else as we only have a very simple use case of pulling in some tweets and displaying them in a view. But running the site cron after the patch applied results in the profile information being updated as intended with no errors / warnings on cron etc.