Display Facebook "Like" button when user is not logged in - javascript

Right now the "Like" button is not rendered if the Facebook page it links to has restrictions based upon age, country or content-type. The button only appears if the user is logged in to Facebook and his profile allows him to see the page.
The restrictions need to stay in place, but I want to display the like button along side the number of likes and have it prompt the user to login to Facebook instead of the button not showing at all.
I don't want to create hacks around the widget (if that's even possible) so is there a configuration or something to have the button show up even if the user is not logged in?

Related

Redirect user to specific website based on location when user clicks on webform pop up link

We have a link on a website.
When user clicks on the link, it pop ups an online form.
Customer wants that if a user from outside the USA clicks on that link, user gets redirected to another website.
Is this doable?
Website is based on latest Drupal 8 Version just in case there is a module that does that.
You can use form use hook_form_ID_alter like this.
function hook_form_FORM_ID_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
// get the IP address of user and determine where they are coming from
// Follow this https://stackoverflow.com/questions/12553160/getting-visitors-country-from-their-ip
// Redirect user
// Follow this https://drupal.stackexchange.com/questions/146185/how-to-create-a-redirection-in-drupal-8
}

LinkedIn Follow Button Requires External Login on Website

What is the precise behavior that should be expected of the Follow Company button (https://developer.linkedin.com/plugins/follow-company) provided by LinkedIn?
If a user is already logged into LinkedIn, nothing appears to happen when the user clicks the FOLLOW button. Clicking the button WILL
cause them to follow that company, but the user must manually navigate to the company's LinkedIn page to confirm this.
If the user is NOT logged in to LinkedIn, clicking the FOLLOW button prompts a login in a popup window, but submitting credentials does NOT change the users FOLLOW status with the company, nor does it take the user to the company's LinkedIn page. Other than logging the user in, there is no effect.
Is this behavior what's to be expected of the LinkedIn FOLLOW button? Has anyone managed to have the button require login and then have it follow the company in one process?

Facebook "Like" button versus Facebook login

I've been using the code here to handle Facebook logins:
https://developers.facebook.com/docs/facebook-login/web#example
https://developers.facebook.com/docs/plugins/like-button
I recently added the Like button but it appears that there is a separate flow for handling the login information that allows likes versus regular logins. Normally, when I log out, FB details (e.g., friends) can't be retrieved until another Facebook login is established. However, with the Like button, even if I logout and log back in or even log in with a different username, the Like button still works and is tied to the original FB user. To make that more clear, here's what happens:
Session 1 (FB user): FB like button is clicked --> FB login dialog pops up, info is entered, and like shows up on Facebook --> Log out
Session 2 (Other user): If the button still shows that the page is liked, clicking it again shows that the first user no longer likes the page on the actual Facebook page. Clicking it again to like the page again shows the first user liking the page again.
I'd like to tie the Like button login information to the regular SDK login. I'm reading that there is a lot of security around the Like and Share buttons so I'm wondering if that's even possible.

Share content on Facebook without opening a popup

I have one button and I want to share the content on Facebook without opening Facebook dialogue box.
Present code works like:
Click on a button;
It opens Facebook share dialogue;
And again click on share from dialogue;
I want something like this: click on a button and it would be shared on Facebook.
https://developers.facebook.com/docs/graph-api/reference/v2.2/user/feed#publish
You would need to authorize the user with publish_actions to do that. You need to go through the Login Review process with that permission and the message parameter must be 100% user generated according to the platform policy.
A lot of things to consider, i´d just stick to the popup.

How facebook/twitter share buttons avoid being blocked by popup blockers?

When a user which is not logged in to Facebook or Twitter, clicks the like/tweet button, a popup comes up asking the user to log in. This popup is not blocked by popup blockers of any kind. in IE for example, it opens up but anyway IE state a warning to the user. The bottom line is that all buttons probably use the same method.
I have a button that people click on it and it should open a similar screen, but it always gets blocked.
The button (in JS) works pretty much like FB like button. It checks if the user is logged in. If he does, then send the "like" to the servers. If he does not, then the login popup appears (and gets blocked).
So, it is a initiated by a user although not fully direct outcome, since we need to check if he logged in or not.
What is best method to do that?
The Popup Is activated by a click using the like, tweet button and they actually show only 1 popup. If you want, you can try by using only a single popup based on click for your website and you will definitely be able to understand this.

Categories

Resources