Topic-icon Feature needed, likely to make your head explode ;)

You must really love me these days ;)

Here's what I need to accomplish - I have a feature on my site (a component we developed) that implements a photo contest. We let user submit photos and then they can vote on their favorite(s) in a gallery. This works well, but I'd like to allow non-members to vote as well.

Naturally, I could restrict based on IP address or drop a cookie on the user's machine, but both can be gamed. What I'd love to do is have a button that says, "Vote using your Facebook account" that, given that a visitor is logged-in to Facebook, can get their authentication information, register their vote, and store that authentication information so that they only get the one vote. I'd like to do this without having to make them register for my site. This would increase usage by, even conservatively, a couple orders of magnitude. We get a couple hundred votes per contest, I think we could get a couple thousand (we have over 32,000 fans on just one of our Facebook pages, the vast majority of whom don't use our site other than casually for informational purposes, but not as members).

I can build token storage into my component, it's the Facebook integration that I'm after. And, of course, asking permission (a checkbox) for "post my vote to my timeline" would be beneficial as well.

Thoughts on how this can be accomplished? Ambitious? ;)
The topic has been locked.
Support Specialist
10 years 6 months ago #37876 by alzander
It could actually be very simple.. but we'll see.

First, if you want to do 'anything' with the user, you pretty much need to have them authenticate first. That's how they approve your application, and, with that, you can see stuff about the user... like their FB ID, which can be used to track if they've voted or not. Without them approving your App, there's really nothing Facebook will return about the user because the user hasn't approved your app to get any of that information.

So.. what I would recommend doing is setting up an Open Graph Action for "Vote". The button will display to all users, logged in or not. If you have authentication in JFBConnect set to "Automatic Registration" and the new user registration set to "Same Page", when the user clicks the "Vote for this photo" button.. an authentication popup and permissions dialog will appear. It will register the user and refresh the page, but it's not as obvious that it's a registration process and more a "we need your information to vote" flow.

Beyond that, if you setup the Open Graph Action to unique, the vote would only be able to be cast one time per image. You could do a SQL query to quickly get the number of actions/votes per image and do whatever you want to tabulate results.

Let me know if that sounds reasonable or not. I'm not sure of any other thing you could do to track a Facebook user without getting them to initially approve that tracking by authorizing your app.

I hope that helps,
Alex
The topic has been locked.
10 years 6 months ago #37877 by chramb1
I can't do the automatic registration without removing registration normally, though, right? I mean, if I do this, people can't register for my site and use the normal flow to give me all the additional information we ask.

So what happens if I make an open graph action for VOTE and don't have automatic registration turned on? Can't I just have it do the application approval and move on? That is, have an open graph action on my site totally untied to registration? How does the open graph authenticate? If they click and aren't signed in to FB, it asks them to, right? And if they're logged in to FB, it'll see if they've approved my app and, if not, ask them to. Then it does the open graph action.

But then how do I know they did the open graph action so I can count their vote? You say a SQL query - what am I querying against?

But automatic registration won't work for me because it'll kill my normal registration, and I can't do that.
The topic has been locked.
Support Specialist
10 years 6 months ago #37931 by alzander

I can't do the automatic registration without removing registration normally, though, right? I mean, if I do this, people can't register for my site and use the normal flow to give me all the additional information we ask.

Correct. Right now, you can only have one registration flow. We're planning the 'new' registration flow for using your existing extension with v5.2 and I can see in v5.3 having a way to select (on the fly) what flow will be used. That can be either on a per-situation basis or even something like the user going to the "normal" registration flow and seeing a button like "create this for me" to bypass everything. Obviously, not there yet though.

So what happens if I make an open graph action for VOTE and don't have automatic registration turned on? Can't I just have it do the application approval and move on? That is, have an open graph action on my site totally untied to registration? How does the open graph authenticate? If they click and aren't signed in to FB, it asks them to, right? And if they're logged in to FB, it'll see if they've approved my app and, if not, ask them to. Then it does the open graph action.

You can't post an action without the user being logged into your site, for a few reasons. Some are JFBC restrictions, others are FB restrictions:
* (FB) Open Graph Action policies state that the user need to be able to delete the activity from the site it occurred on. For that, we need to know what user it was that did that and be able to show them the activity log page on your site.
* (FB/JFBC) JFBConnect has checks to make sure the user is actually logged in and hasn't disabled the action (if user disabling is allowed) before posting.
* (JFBC) Once the app is approved, if "Auto Login" is enabled, that user will be logged in whenever the visit the site. There's no way for JFBC to know that the user just approved the app but didn't create an account, so they'd be sent to the registration page each time they visit until they create an account.

I hope that helps explain, though it doesn't sound like it really helps solve any issues for you.
Alex
The topic has been locked.