Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8207873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:08:36+00:00 2026-06-07T09:08:36+00:00

I am trying to connect with social web sites like facebook,twitter,linkedin etc using Hybridauth

  • 0

I am trying to connect with social web sites like facebook,twitter,linkedin etc using Hybridauth
This is what I do to connect with social web sites. I am new to PHP just started to learn and doing this.
index.php

<?php
    # start a new PHP session
    session_start();

    // we need to know it
    $CURRENT_URL = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
      //  print "CURRENT_URL $CURRENT_URL";
    // change the following paths if necessary 
    $config   = dirname(__FILE__) . '/hybridauth/config.php';
    require_once( "hybridauth/Hybrid/Auth.php" );

    try{
        $hybridauth = new Hybrid_Auth( $config );
    }
    catch( Exception $e ){
        echo "Ooophs, we got an error: " . $e->getMessage();
    }

    $provider = ""; 

    // handle logout request
    if( isset( $_GET["logout"] ) ){
        $provider = $_GET["logout"];

        $adapter = $hybridauth->getAdapter( $provider );

                $adapter->logout();

        header( "Location: index.php"  );

        die();
    }

    // if the user select a provider and authenticate with it 
    // then the widget will return this provider name in "connected_with" argument 
    elseif( isset( $_GET["connected_with"] ) && $hybridauth->isConnectedWith( $_GET["connected_with"] ) ){
        $provider = $_GET["connected_with"];

        $adapter = $hybridauth->getAdapter( $provider );

        $user_data = $adapter->getUserProfile();

        // include authenticated user view
        include "authenticated_user.php";

        die();
    } // if user connected to the selected provider 

    // if not, include unauthenticated user view
    include "unauthenticated_user.php";

authenticated_user.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en">
<head>
    <style type="text/css" media="screen">
        <!--
            BODY {
                margin: 10px;
                padding: 0;
            }
            H1 {
                margin-bottom: 2px;
                font-family: Garamond, "Times New Roman", Times, Serif;
            }
            FIELDSET {
                border: 1px solid #ccc;
                padding: 1em;
                margin: 0;
            }
            LEGEND {
                color: #666666;
            } 
        -->
    </style> 
</head>
<body>
    <br /><br />
    <center>
        <h1>Welcome <?php echo $user_data->displayName; ?></h1>
        <br />
        <br /> 

        <table width="600" border="0" cellpadding="2" cellspacing="2">
          <tr>
            <td valign="top"><fieldset>
                <legend>Connected user badge</legend>
                <table width="100%" border="0" cellpadding="2" cellspacing="2"> 
                  <tr> 
                    <td width="100" rowspan="5">
                        <?php
                            if( $user_data->photoURL ){
                        ?>
                            <a href="<?php echo $user_data->profileURL; ?>"><img src="<?php echo $user_data->photoURL; ?>" title="<?php echo $user_data->displayName; ?>" border="0" width="100" height="120"></a>
                        <?php
                            }
                            else{
                        ?> 
                            <img src="avatar.png" title="<?php echo $user_data->displayName; ?>" border="0" >
                        <?php
                            } 
                        ?>
                    </td>
                    <td width="60" nowrap><div align="right"><strong>Provider</strong></div></td>
                    <td align="left" ><?php echo $adapter->id; ?></td>
                  </tr> 
                  <tr>
                    <td nowrap><div align="right"><strong>Identifier</strong></div></td>
                    <td align="left"><?php echo $user_data->identifier; ?></td>
                  </tr>
                  <tr>
                    <td nowrap><div align="right"><strong>Dispaly name</strong></div></td>
                    <td align="left"><?php echo $user_data->displayName; ?></td>
                  </tr>
                  <tr>
                    <td nowrap><div align="right"><strong>Email</strong></div></td>
                    <td align="left"><?php 
                            if( $user_data->email ){
                                echo $user_data->email ; 
                            }
                            else{
                                echo "not provided by " . $adapter->id ; 
                            }
                        ?></td>
                  </tr>
                  <tr>
                    <td nowrap valign="top"><div align="right"><strong>Profile URL</strong></div></td>
                    <td align="left" valign="top"><?php echo $user_data->profileURL; ?></td>
                  </tr>
                                    <tr>
                                        <td align="right"><strong>Update Status</strong></td>
                                        <td align="center"><input name="updatestatus" id="updatestatus" /></td>
                  </tr>
                </table> 

              </fieldset></td>
          </tr>
          <tr>
            <td valign="top" align="right">
                <img src="arrow.gif" align="texttop" style="margin-top:-5px;" >
                <a href="?logout=<?php echo $adapter->id; ?>">Log me out</a>
            </td>
          </tr>
        </table>
    </center> 
</body>
</html>


unathenticated.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en">
<head>
    <style type="text/css" media="screen">
        <!--
            BODY {
                margin: 10px;
                padding: 0;
            }
            H1 {
                margin-bottom: 2px;
                font-family: Garamond, "Times New Roman", Times, Serif;
            }
            FIELDSET {
                border: 1px solid #ccc;
                padding: 1em;
                margin: 0;
            }
            LEGEND {
                color: #666666;
            }
            INPUT {
                display: block;
                font-family: Arial, verdana;
                padding: 7px;
                border: 1px solid #999;
                margin: 10px;
            } 
   /* Gradient 2 */
   .textbox{
    background-image: url(images/bg.png);
    border: 1px solid #6297BC;
    width: 230px;
}
        -->
    </style> 
</head>
<body>
    <br /><br />
    <center>
        <h1>Social web sites integration</h1>
        <br />
        <br /> 
        <table width="380" border="0" cellpadding="2" cellspacing="2">
                    <tr>
            <td valign="top"><fieldset>
                <legend>Sign-in form</legend>
                <table width="00%" border="0" cellpadding="2" cellspacing="2">
                  <tr>
                    <td><div align="right"><strong>login</strong></div></td>
                                        <td><input type="text" name="textfield" id="textfield" class="textbox"/></td>
                  </tr>
                  <tr>
                    <td><div align="right"><strong>password</strong></div></td>
                    <td><input type="text" name="textfield2" id="textfield2" class="textbox"/></td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td><div align="center">
                        <input type="submit" value="Sign-in" />
                      </div></td>
                  </tr>
                </table>
              </fieldset></td>
          </tr>
          <tr>
            <td valign="top" align="right">
                <!--img src="arrow.gif" align="texttop" style="margin-top:-5px;" -->
                <!-- CODE REQUIRED BY THE WIDGET -->
                    <link media="screen" rel="stylesheet" href="widget/css/colorbox.css" />
                    <script src="widget/js/jquery.min.js"></script>
                    <script src="widget/js/jquery.colorbox.js"></script> 
                    <script>
                        $(document).ready(function(){
                            $(".widget_link").colorbox({iframe:true, innerWidth:430, innerHeight:222});
                        }); 
                    </script>
                <!-- /WIDGET -->
                <!-- 
                    LINK TO THE WIDGET 
                        return_to: call back this page after authenticatin the user
                        ts: nocache
                --> 
                    <a href="widget/?_ts=<?php echo time(); ?>&return_to=<?php echo urlencode( $CURRENT_URL ); ?>" class='widget_link' title="Socail web sites linker">Or sign-in with Social web sites</a>
            </td>
          </tr>
        </table> 
        <br /><br /><br />
        <!--b>Note:</b> This is just a proof of concept! it works good enough to try out on Firefox or on Chrome.-->
    </center> 
</body>
</html>

So please help me how to go about this?, Here I do display user information like first name and last name and picture url. I want to add another text box which will enable to update user status or post wall.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:08:38+00:00Added an answer on June 7, 2026 at 9:08 am

    From the User Guide: Update User Status

    This method exists:
    $adapter->setUserStatus("");

    Note From User Guide:
    Currently only Facebook, Twitter, Identica, LinkedIn, QQ, Sina, Murmur, Pixnet and Plurk support this feature

    You could create a form on authenticated_user.php and add a text field with ID “status_update”. When it’s submitted, you could check for it and run the setUserStatus method.

    // if the user select a provider and authenticate with it
        // then the widget will return this provider name in "connected_with" argument
        elseif( isset( $_GET["connected_with"] ) && $hybridauth->isConnectedWith( $_GET["connected_with"] ) ){
        $provider = $_GET["connected_with"];
    
        $adapter = $hybridauth->getAdapter( $provider );
    
    
        // *****************************************************
        // NEW CODE TO UPDATE USER STATUS
        if( isset( $_GET["status_update"] ) && !empty( $_GET["status_update"] ) ) {
          $adapter->setUserStatus( $_GET["status_update"] );
        }
    
    
        $user_data = $adapter->getUserProfile();
    
        // include authenticated user view
        include "authenticated_user.php";
    
        die();
    } // if user connected to the selected provider
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When trying to connect to a web service using the following $client = new
I am trying to connect the JSF to database. This are the files web.xml
I am trying to integrate facebook connect with nmy social network site, currently users
I am trying to connect to Sybase backend using PHP. However, when I run:
I'm using HostMonster as my web host and I'm trying connect to a database
I have been trying to connect to mysql all evening using PHP. I know
Im trying to connect from PHP(Zend Framework) code to an aspx Web Service. I
I am trying to connect to Postgre using a PHP script, but it returns
I am trying to connect to a MySQL Server using JDBC tool in java
I'm trying to connect to a FTP using Apaches FTPSClient but I keep getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.