I've built a check for current rsvp_status for an event and the currently logged in member. Now I'd like to show an I'm attending button depending on someone's status. I can work out the HTML for the different buttons depending on their RSVP-status, but what I'm not sure of is how to write someone's rsvp_status back into the Graph after clicking the "I'm attending" button... Can you guys give me a push in the right direction?
Thanks!
Steven
You can post back attending status, this requires two things:
you have to have the rsvp_event permission for that user, and
you have to call
FB.api(eventID+'/attending', 'post', function(resp) { // true if the rsvp was successfull })
This will check the user in the event.
For more info, see Graph API
Related
I'm gonna give a user discount when he tweeted through my website but I want to make sure that the user actually tweeted, not just clicked on a tweet button.
I have tried `
twttr.ready(function (twttr) {
twttr.events.bind('tweet', function(event) {
console.log(event);
});
});
but this detects only that the user clicked on a tweet button.
Well I don't get the scenario but you can do a lot of options to assure he tweets or not:
if user signed in Twitter , then you can use twitter api and check whether this tweet is published or not using this api : https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets
make the place he tweets in (form) to post the tweet and then you could track whether he tweets or not using this api : https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update
I've read the documentation about like actions, but can't get this to work.
I'm trying to get a status if a logged in user is liking an URL with the Javascript SDK. But doesn't get any progress.
How could this be done?
Below I use this code to "like" an URL.
FB.api(
'me/og.likes',
'post',
{
object: liked_url
},
function(response) {
// handle the response
}
);
HTML
<div class="like_button">Like This</div>
And when I click the above like button it likes the URL and add a class to the above div, but I want to be able to refresh the page and still have the "liked"-class on the objects that are liked.
I might have picked you up wrong but you could try using this to create your like button
//Update:
With help I managed to catch some errors which fixed the token issue. I've updated the code to reflect that. The code still doesn't produce an event on the timeline though so I'm leaving the question up.
Original question:
I'm trying to build a simple script using the Open Graph API that will push a link to a visited page (containing a movie) to Facebook, once the visitor hits the page.
I'm not using a custom action and object, but the standard Watch action (https://developers.facebook.com/docs/opengraph/video/) and Video.movie object.
I came up with this based on FB's example code:
<!-- first login-button with scope publish_actions: -->
<fb:login-button show-faces="false" width="200" max-rows="1" scope="publish_actions" ></fb:login-button>
<!-- Then script that should push update to timeline: -->
<script type="text/javascript">
function fbPublish(){
FB.api(
'/me/video.watches',
'post',
{ 'video.movie': '<?php the_permalink(); ?>',
'access_token': 'blablabla' },
function(response) {
if (!response || response.error) {
alert('Nope.');
} else {
alert('Yes.'); // any stuff
}
});
}
This triggers the alert 'Nope'.
I have added the Watch action through curl.
Any ideas as to what could be going on?
You still need to FB.login before you can automatically post to the user's timeline.
FB.login(function(response) {
// Post the action
}, {scope: 'publish_actions'});
While I didn't check the validity of your actual code to post the action, you problem is that before you can do this, you'll need the user's permission. The publish_actions permission is the one you'll need but I think its already included in new Auth Dialogs. Just leave it there to be sure.
Do the FB.login code first, you'll get a popup "Allow" dialog, after that, is the time you can freely post in the user's wall. It's a part of the security, Facebook users wouldnt want you posting on their timeline without them knowing.
I'm using a connect with twitter button on my site, no an OAuth, but I wanted a way to accurately judge how many people pressed connect. There is a way to have a custom connect with twitter button like this. so i was thinking the button might bring you to a url to record the visit and then redirect right back to the main page. I'm not sure how or even if this idea will even work. How would I go a bout doing this?
as present on the twitter website a method like this one can enable custom signin
document.getElementById("signin-btn").onclick = function () {
T.signIn();
};
simply call a url from inside this method fto track the number of clicks to this button some thing like this.
document.getElementById("signin-btn").onclick = function () {
T.signIn();
$.get("UR_LINK");
};
now on the server side. because i dont know what tech ur r using psuedo code can be
On_Request()
{
clicked++;
saveTODataBaseClickedNumber(clicked);
}
I have two buttons, "Yes" and "No". If user clicks on "Yes", I want to display a message that needs to be permanent.
Eg - I click on yes,the message should stay even after page reload or the next time the user logs in. It shouldn't appear again. Maybe possible if i delete the file or something.
I am able to hide all elements using hide() and then display a msg, but onpage reload, they come back..
Can you guys help?
Thanks
This is possible using html5's localstorage (but I've no experience in using that), or using the jQuery cookie plugin.
$(document).ready(
function(){
var msg = $.cookie('yesMsg');
$('#messages').text('yesMsg');
$('#messageSelectionDiv').click(
function(){
$.cookie('yesMsg',$(this).text() {expires: 30});
});
});
If the browser you are targeting supports HTML5, You can use HTML5 localStorage, otherwise cookies, to store some permanent data for the user.
For example:
if (localStorage['show_something'])
// Show it
else
// Hide it
To store it initially, you just set it:
localStorage['show_something'] = true;
For more info, refer to this awesome doc:
http://www.html5rocks.com/tutorials/offline/storage/