Sign in Action Button

Yeah, actually I just did a quick test and it looks you can’t use a computed column for the avatar. So my previous suggestion won’t work.

But your idea should be fine :+1:

2 Likes

Will try it thank you!

Hi Darren, So I did the above, seems to work, but the user can change the image to something else. Do you know if there is anyway to stop that? How do you deal with the wrong type of images being uploaded?

1 Like

hmm, that’s a good question. If there is a way to do that I am not aware of it. The only thing I can think of would involve a scripting solution with a trigger. ie. if a user changes the image, then immediately overwrite it with the correct image.

Perhaps @Jeff_Hager or @ThinhDinh might know of a way to disable this.

1 Like

No, there isn’t a way. Let 'em change it. They’re the only ones that have to look at it.

Ah ok! so if someone uploads a nude or something, doesn’t it get saved on my glide sheet?

Well, yeah, but if you assign it to a column that’s not used anywhere else in your app, then nobody else will see it.

OK I’ll see how it goes once I figure this favorites thing. I’ll add the logo as a default then they can change it if they want. Thanks!

1 Like

@Jen_NYCP - just for a bit of fun, I coded up something that would automatically change the image back. I’ve tested it, and it works fine, albeit with a short delay.

function enforce_profile_image(event) {
  var profile_sheet_name = 'Users';  // Replace with the name of your user profiles sheet
  var image_col = 4; // Replace this with the column number that contains the image (A=1, B=2, C=3, etc)
  var image_url = 'https://randomuser.me/api/portraits/women/74.jpg'; // Replace this with the URL of your logo
  
  var sheetname = event.source.getActiveSheet().getName();
  if (sheetname != profile_sheet_name) {
    return;
  }
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName(sheetname);
  var data = sheet.getRange(2,image_col, sheet.getLastRow()-1, 1).getValues();
  data.forEach(function (row) {
    row[0] = image_url;
  });
  sheet.getRange(2,image_col, sheet.getLastRow()-1, 1).setValues(data);
} 

You would use that with an On Change trigger. If you’re not sure how to configure triggers, I covered this in a recent tutorial (Part 4). If you wanted to use it, note that you’d need to replace the variable values on the first 3 lines.

2 Likes

Oh, thank you for this!! I think it would be weird to change the image back once a user uploads one. Only if it was possible for them not to have the option at all, Or I’m thinking to have select graphics they can choose from. Not sure if that is possible.

1 Like

You can check out this concept.

2 Likes

Will check it out. Thanks!

1 Like