Skip to content

Instantly share code, notes, and snippets.

@nfreear
Created February 22, 2012 16:19
Show Gist options
  • Select an option

  • Save nfreear/1885840 to your computer and use it in GitHub Desktop.

Select an option

Save nfreear/1885840 to your computer and use it in GitHub Desktop.
Fix oEmbed core_provider_save/delete, for Drupal 6(.24) - specify 'cache' table / nfreear/ IET-at-OU.
/**
* Enable a default provider.
*/
function oembedcore_enable_provider($provider) {
if (!is_object($provider)) {
$provider = oembedcore_provider_load($provider);
}
ctools_include('export');
ctools_export_set_status('oembedcore_provider', $provider->name, FALSE);
cache_clear_all('oembedcore:providers', 'cache'); //NDF $table='cache' is mandatory.
drupal_goto();
}
/**
* Disable a default provider.
*/
function oembedcore_disable_provider($provider) {
if (!is_object($provider)) {
$provider = oembedcore_provider_load($provider);
}
ctools_include('export');
ctools_export_set_status('oembedcore_provider', $provider->name, TRUE);
cache_clear_all('oembedcore:providers', 'cache'); //NDF $table='cache' is mandatory.
drupal_goto();
}
/**
* Write a provider to the database.
*/
function oembedcore_provider_save(&$provider) {
$update = (isset($provider->pid)) ? array('pid') : array();
drupal_write_record('oembedcore_provider', $provider, $update);
cache_clear_all('oembedcore:providers', 'cache'); //NDF $table is mandatory.
return $preset;
}
/**
* Remove a provider.
*/
function oembedcore_provider_delete($provider) {
db_query("DELETE FROM {oembedcore_provider} WHERE name = '%s' AND pid = %d", $provider->name, $provider->pid);
cache_clear_all('oembedcore:providers', 'cache'); //NDF $table is mandatory.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment