Topic-icon Sweepstakes Workflow with Facebook Auth Dialog Box?

Active Subscriptions:

None
Hey Alex, I've been playing around with the new Requests feature... again, this is an Awesome addition! :D

I want to use the Requests functionality in a sweepstakes. The idea is, for every sweepstakes entry generated by a referral (via the Request), the referring party would get an additional entry in the sweepstakes. So for example, I would get 1 entry for entering, and if I send a Request to 5 people to enter the sweepstakes and 3 of them sign up, I would get 3 additional entries (chances to win).

Alternatively, it could be set us as a "You Win, I Win" type promo. So if the person I refer wins a prize, then I also win a prize of equal value.

The tracking you built into JFBConnect Requests feature is great! It is very well thought out. After playing with it for a while, there are three things that could help me utilize it to run the promos I mentioned above:

1. Being able to see the person's email address in the User Map / Requests area would help a lot. This could be used as a unique identifier for selecting a winner. I'm not sure if Facebook lets you import this or not...

2. Since Requests can be sent by non-Joomla users, it would be nice to have the ability to sort by FB User Name and ID of the sender (From) and the recipient (To) . I see you have included Facebook profile URL's in the back end, so the addition of a Facebook Name would be great!

3. The ability to export the information to CSV / Excel format.

Not sure if it's possible to implement these features, but I wanted to provide you with some feedback on it. The additional columns might also make the admin area a bit cluttered. If so, maybe this extra information could only be included when the data is exported to CSV.

I hope this all makes sense, let me know if any of the ideas need clarification.
The topic has been locked.
Support Specialist
14 years 4 months ago #17892 by alzander
Ryan,
Glad to hear you're liking the Request stuff. What you're planning on doing is exactly the types of cool things we want to hear about! While the tracking is pretty slick, there is definitely some room for improvement. Unfortunately though, there's a very, very limited amount of information we can get about a user from Facebook that hasn't authorized your application to get that information. Makes sense (from a privacy standpoint) when you think about it. Keep that in mind with the responses to your questions below:
1) Email in UserMap Requests area - We could add this for any users that have signed up on your site (have a Joomla account), but for users that haven't approved your app, there'd be no way to get their email address :(

2) Agreed.. but. The only real problem I see here is that sorting by names would require us to have that info. While it is information we can get from Facebook, we don't store -everyone's- name in the database unless they have a Joomla User account as well.. in that case, we just use their Joomla name. Doing a lookup to get everyone's name in real-time would be impossible.
So... that's why we sort on the picture column now.. that's the user's FB ID, since we may not have their actual name stored anywhere. It's not a logical sort mechanism, but does group photos together at least.
Hope that all makes sense. I think I'm confusing myself.

3) Can definitely see the benefit of this, and it's something we can look into. Doing CSV exports is pretty easy, and I can help you with a SQL query to do it before we'd get it into a release, if you'd like. Again though, it won't have a user's real FB name.. just their FB ID.

Definitely all makes sense and great feedback. Unfortunately, we are a little limited on some things (as noted above). Some we can get around (storing every requestee/requester name), others may be more difficult.

Thanks again,
Alex
The topic has been locked.
Active Subscriptions:

None
Hey Alex, I am trying to use a custom login button, per your instructions on the FAQ page:
a href="javascript:void(0)" onclick="jfbc.login.login_custom();"

However, I don't want this button to appear to users who are logged in. Is it possible to do this using the code above? I checked facebook's Social Plugins page, but I didn't see an option for this functionality.

In short, I want it to work like this, but have a custom image :)
{JFBCLogin size=medium logout=false}
The topic has been locked.
Support Specialist
14 years 4 months ago #17951 by alzander
Ryan,
Yeah, that's something we'll be adding to the {JFBCLogin} tag in the future... an option similar to the JFBCRequest tag to specify an image or link, but it's not there yet :(

Until then, you'll need to do it in PHP, unfortunately. I'm not sure where you're trying to put the Login Button, but if it's in a template or something like that, you can use the following code:
<?php $user =& JFactory::getUser();
if ($user->guest)
  echo '<a href="javascript:void(0)" onclick="jfbc.login.login_custom();"><img src="linktoimage.jpg" /></a>';
?>
Hope that helps, but if you need more help, let me know.
The topic has been locked.
Active Subscriptions:

None
Thanks Alex! This button needs to appear in an article. I tried to use the code you wrote, but it's not being triggered on the client side. If I check the browser source, I don't see any of the code.

The PHP code is not being scraped out by JCE.. I have PHP turned on in the WYSIWYG settings, and the Content Blacklist turned off for Super Admin. I'm also using NoNumber's Sourcerer plugin to add the PHP script to the article.

Is "guest" the right trigger in Joomla 1.7? Should it be "public" or some other user level?
The topic has been locked.
Support Specialist
14 years 4 months ago #17984 by alzander
It's definitely guest:
api.joomla.org/Joomla-Platform/User/JUser.html

If you want to check if they're a certain level, then you do something much more complicated. Can you simply try changing the code to the following:
<?php $user =& JFactory::getUser(); 
echo "I'm HERE";
if (true) 
  echo '<a href="javascript:void(0)" onclick="jfbc.login.login_custom();"><img src="linktoimage.jpg" /></a>'; 
?>
The "I'm HERE" should always be displayed because there's nothing conditional about it. The login button, likewise will *always* show since the if statement is check if true is.... true. Let me know if any of that displays, as it will help diagnose if the right stuff is being executed as well or not. If nothing shows, then obviously, that code isn't being executed for some reason.

Hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
Hey Alex, I got everything loaded up on facebook. The fb app is now in sand box mode and everything seems to work in IE, Chrome and Safari. But I'm having some issues in Firefox 9 with the log in button. When I click the log in button (using the code you provided above), the app dialog box pops up and disappears within a second, and then the page refreshes and I'm not logged into Joomla. This happens on both the Facebook tab page, and the article page on my site.

I've tried clearing cache and cookies, and tested this on multiple computers. The log in button seems to work on firefox 4 and 8, but 9 doesn't work. If I navigate to the homepage after clicking the log in button, I get a system error message at the top which says: "You cannot access the private section of this site."

The article page contains a module that you have to be registered to see... this is how I'm switching between the Log In button and the Contact form... log in button registers the user, so when the page refreshes, they don't see the log in button, they see a pre-filled contact form that says "Enter the Sweepstakes". :)

Anyway, this all works amazingly well in the other browsers (so far), but Firefox 9 just isn't working. I can log into the site using the SCLogin module, but not using this custom button. Would you have any ideas on why this isn't working? I heard there was a bug with how facebook is creating and destroying cookies, but I don't know if that applies to this situation...
The topic has been locked.
Support Specialist
14 years 4 months ago #18031 by alzander
Ryan,
Shouldn't be a problem with the cookie thing happening with Facebook. Creation of cookies isn't the problem, its the destroying (logging out) of them that is.

Not sure why FF9 wouldn't work. Can you take your app out of sandbox mode and try? If it still doesn't work, can you post (or PM) me the page(s) I can visit to test with?

Glad to hear it's working well though.. I'm very curious to see it all in action!

Alex
The topic has been locked.
Active Subscriptions:

None
I just did some more testing when I got home... I was getting some really strange results. Long story short, it turns out that it was a User Account mapping/permissions issue. Earlier today, I was testing the sweepstakes work flow using multiple facebook accounts in different browsers, and it turns out that the same one kept failing. I thought I was logging into the site using my Super Admin, but instead, JFBC was mapping my facebook account to a Joomla user that was not assigned a user group... the account wasn't even "Registered". I think this was due to exporting the old account information from J1.5 and importing it into a fresh install of J1.7.

Anyway, as soon as I realized this, I added the appropriate permissions to the user account and everything worked! It's a beautiful thing, I'll send you a link so you can check it out. Thanks for all the help getting this sorted out, have a great weekend Alex!
The topic has been locked.
Active Subscriptions:

None
Hey Alex,

I have a scenario where I want to show non-registered users "Content-A", registered users "Content-B", and registered users who have submitted a form "Content-C". Since this content will appear on a facebook tab, all three content types must appear on the same URL. :)

Someone has suggested triggering this code when the form is submitted....
$db =& JFactory::getDBO();
$user = JRequest::getVar('my_table___users_id');
$query = "UPDATE #__user_usergroup_map SET group_id='4' WHERE user_id='$user';";
$db->setQuery($query);
$db->query();

He says this should update the users group access level to "4", which "Editor". And then use the following code to log them out and redirect them to a log in form:
global $mainframe;
$mainframe->logout();
$mainframe->redirect('your login url');

But I don't want users to see a log in module, I just want them to see to "Content-C". Is there a way to change a users access / group level, and then silently log them out and then back in using their facebook credentials? Or do you have any other suggestions on how to accomplish this?
The topic has been locked.