OAuth expires_in time I want to add the expires_in time to the database when a user authorizes linkedin to store the token. https://www.drupal.org/project/linkedin

I have added token_expires

$sql = array(
    'uid' =&gt; $account-&gt;uid,
    'token_key' =&gt; $oauth['oauth_token'],
    'token_secret' =&gt; $oauth['oauth_token_secret'],
    'type' =&gt; 'access',
    **'token_expires' =&gt; $oauth['oauth_token_expires'],**


and have modified the query, but it does not store the record.

$uid = db_query("SELECT uid FROM {linkedin_token} WHERE token_key = :token_key AND token_secret = :token_secret AND type = :type ", array(':token_key' =&gt; $oauth['oauth_token'], ':token_secret' =&gt; $oauth['oauth_token_secret'], ':type' =&gt; 'access', ':token_expires' =&gt; $oauth['oauth_expires_in']))-&gt;fetchField();


I would like to store the expiration time to the database that is returned from OAuth
It appears to me that you are directly editing the sources of the linkedin module. This is considered bad practise, as any module update will remove your changes and subsequently lead to unexpected errors in your Drupal.

The reason why the queries do not work is that the corresponding database fields are missing.

You have to do several steps:

Create your own custom module. (I use MYMODULE as name in the following examples; alter that to your module's name.)

Add the linkedin module as dependency to your custom module's .info file, to make sure your changes will be removed before the linkedin module will be uninstalled:

dependencies[] = linkedin


Implement hook_install() within your module's .install file to add the field to the database:

/**
 * Implements hook_install().
 */
function MYMODULE_install() {
  // Add additional field to table 'linkedin_token'.
  if (db_table_exists('linkedin_token') &amp;&amp; !db_field_exists('linkedin_token', 'token_expires')) {
    db_add_field(
      'linkedin_token',
      'token_expires',
      array(
        'type' =&gt; 'int', // I suppose, you will save a unix timestamp.
        'description' =&gt; 'Token expiry date/time',
      )
    );
  }
}


Implement hook_uninstall() within your module's .install file to remove the field from the database when your module will be uninstalled:

/**
 * Implements hook_uninstall().
 */
function MYMODULE_uninstall() {
  // Remove additional field from table 'linkedin_token'.
  if (db_table_exists('linkedin_token') &amp;&amp; db_field_exists('linkedin_token', 'token_expires')) {
    db_drop_field(
      'linkedin_token',
      'token_expires'
    );
  }
}


Implement hook_schema_alter() within your .module file to publish your changes to Drupals database schema information:

/**
 * Implements hook_schema_alter().
 */
function MYMODULE_schema_alter(&amp;$schema) {
  $schema['linkedin_token']['fields']['token_expires'] = array(
    'type' =&gt; 'int',
    'description' =&gt; 'Token expiry date/time',
  );
}


Copy over the altered functions / code snippets from the linkedin module to your module, and rename the functions to MYMODULE_your_function_name. Afterwards restore the original module's source code.

Implement hook_menu_alter() to alter the menu callbacks of the linkedin module to point to your customized functions. (Refer to function linkedin_menu() to identify the items of question.)

/**
 * Implements hook_menu_alter().
 */
function MYMODULE_menu_alter(&amp;$items) {
  if (isset($items['the path of the menu callback to alter'])) {
    $items['the path of the menu callback to alter']['page callback'] =&gt; 'MYMODULE_your_function_name';
  }
  // Repeat the above step for every menu callback you like to change.
}


An additional note: Try rewriting as less as possible code from the original module's functions and check whether you can utilize hooks or do a call to the original function as well to make sure the application won't break once the original module is updated.