title: Facebook-only login button in a wordpress page
body: <p>I need to insert in a page a Facebook only login button, without redirect (user after login remains on the same page) using one of this functions, creating a shortcode if it's possible.
  These function are from a plugin active on the site. The plugin manages all the wordpress login, but I need on a single page a Facebook only login.</p>
  
  <pre><code>add_action('userpro_inside_form_submit','userpro_social_connect');
  
  function userpro_social_connect($array){
  
      global $userpro;
  
  
  
      // only in login/register
  
      if ($array['template'] == 'login' || $array['template'] == 'register' ) {
  
  
  
          echo '&lt;div class="userpro-social-connect"&gt;';
  
  
  
          if (userpro_get_option('facebook_app_id') != '' &amp;&amp; userpro_get_option('facebook_connect') == 1) {
  
              ?&gt;
  
  
  
              &lt;div id="fb-root" class="userpro-column"&gt;&lt;/div&gt;
  
              &lt;script&gt;
  
              window.fbAsyncInit = function() {
  
  
  
                  FB.init({
  
                      appId      : "&lt;?php echo userpro_get_option('facebook_app_id'); ?&gt;", // Set YOUR APP ID
  
                      status     : true, // check login status
  
                      cookie     : true, // enable cookies to allow the server to access the session
  
                      xfbml      : true  // parse XFBML
  
                  });
  
  
  
                  FB.Event.subscribe('auth.authResponseChange', function(response)
  
                  {
  
                  if (response.status === 'connected')
  
                  {
  
  
  
                  //SUCCESS
  
  
  
                  }   
  
                  else if (response.status === 'not_authorized')
  
                  {
  
  
  
                  //FAILED
  
  
  
                  } else
  
                  {
  
  
  
                  //UNKNOWN ERROR
  
  
  
                  }
  
                  });
  
  
  
              };
  
  
  
              // Login user
  
              function Login(element){
  
  
  
                  var form = jQuery(element).parents('.userpro').find('form');
  
                  userpro_init_load( form );
  
  
  
                  if ( element.data('redirect')) {
  
                      var redirect = element.data('redirect');
  
                  } else {
  
                      var redirect = '';
  
                  }
  
  
  
                  FB.login(function(response) {
  
                      if (response.authResponse){
  
  
  
                          // post to wall
  
                          &lt;?php if (userpro_get_option('facebook_autopost')) { ?&gt;
  
  
  
                          &lt;?php $scope = 'email,user_photos,publish_stream'; ?&gt;
  
  
  
                          &lt;?php if ( userpro_get_option('facebook_autopost_name') ) { ?&gt;
  
                          var name = "&lt;?php echo userpro_get_option('facebook_autopost_name'); ?&gt;"; // post title
  
                          &lt;?php } else { ?&gt;
  
                          var name = '';
  
                          &lt;?php } ?&gt;
  
  
  
                          &lt;?php if ( userpro_get_option('facebook_autopost_body') ) { ?&gt;
  
                          var body = "&lt;?php echo userpro_get_option('facebook_autopost_body'); ?&gt;"; // post body
  
                          &lt;?php } else { ?&gt;
  
                          var body = '';
  
                          &lt;?php } ?&gt;
  
  
  
                          &lt;?php if ( userpro_get_option('facebook_autopost_caption') ) { ?&gt;
  
                          var caption = "&lt;?php echo userpro_get_option('facebook_autopost_caption'); ?&gt;"; // caption, url, etc.
  
                          &lt;?php } else { ?&gt;
  
                          var caption = '';
  
                          &lt;?php } ?&gt;
  
  
  
                          &lt;?php if ( userpro_get_option('facebook_autopost_description') ) { ?&gt;
  
                          var description = "&lt;?php echo userpro_get_option('facebook_autopost_description'); ?&gt;"; // full description
  
                          &lt;?php } else { ?&gt;
  
                          var description = '';
  
                          &lt;?php } ?&gt;
  
  
  
                          &lt;?php if ( userpro_get_option('facebook_autopost_link') ) { ?&gt;
  
                          var link = "&lt;?php echo userpro_get_option('facebook_autopost_link'); ?&gt;"; // link
  
                          &lt;?php } else { ?&gt;
  
                          var link = '';
  
                          &lt;?php } ?&gt;
  
  
  
                          FB.api('/me/feed', 'post', { message:body,caption:caption,link:link,name:name,description:description}, function (response) { });
  
  
  
                          &lt;?php } else { $scope = 'email,user_photos'; } // end post to wall ?&gt;
  
  
  
                          // get profile picture
  
                          FB.api('/me/picture?type=large', function(response) {
  
                              profilepicture = response.data.url;
  
                          });
  
  
  
                          // connect via facebook
  
                          FB.api('/me', function(response) {
  
  
  
                              jQuery.ajax({
  
                                  url: userpro_ajax_url,
  
                                  data: "action=userpro_fbconnect&amp;id="+response.id+"&amp;username="+response.username+"&amp;first_name="+response.first_name+"&amp;last_name="+response.last_name+"&amp;gender="+response.gender+"&amp;email="+response.email+"&amp;name="+response.name+"&amp;link="+response.link+"&amp;profilepicture="+profilepicture+"&amp;redirect="+redirect,
  
                                  dataType: 'JSON',
  
                                  type: 'POST',
  
                                  success:function(data){
  
  
  
                                      userpro_end_load( form );
  
  
  
                                      /* custom message */
  
                                      if (data.custom_message){
  
                                      form.parents('.userpro').find('.userpro-body').prepend( data.custom_message );
  
                                      }
  
  
  
                                      /* redirect after form */
  
                                      if (data.redirect_uri){
  
                                          if (data.redirect_uri =='refresh') {
  
                                              document.location.href=jQuery(location).attr('href');
  
                                          } else {
  
                                              document.location.href=data.redirect_uri;
  
                                          }
  
                                      }
  
  
  
                                  },
  
                                  error: function(){
  
                                      alert('Something wrong happened.');
  
                                  }
  
                              });
  
  
  
                          });
  
  
  
                      // cancelled
  
                      } else {
  
                          alert( 'Unauthorized or cancelled' );
  
                          userpro_end_load( form );
  
                      }
  
                  },{scope: '&lt;?php echo $scope; ?&gt;'});
  
  
  
              }
  
  
  
              // Logout
  
              function Logout(){
  
                  FB.logout(function(){document.location.reload();});
  
              }
  
  
  
              // Load the SDK asynchronously
  
              (function(d){
  
               var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
  
               if (d.getElementById(id)) {return;}
  
               js = d.createElement('script'); js.id = id; js.async = true;
  
               js.src = "//connect.facebook.net/en_US/all.js";
  
               ref.parentNode.insertBefore(js, ref);
  
              }(document));
  
  
  
              &lt;/script&gt;
  
  
  
              &lt;a href="#" class="userpro-social-facebook userpro-tip" data-redirect="&lt;?php echo $array['facebook_redirect']; ?&gt;" title="&lt;?php _e('Login with Facebook','userpro'); ?&gt;"&gt;&lt;/a&gt;
  
  
  
              &lt;?php
  
          }
  </code></pre>