fb_permissions.install in Facebook Autopost 7
Installation file.
File
fb_permissions/fb_permissions.installView source
<?php
/**
* @file
* Installation file.
*/
/**
* Implements hook_install().
*/
function fb_permissions_install() {
// Set default values for the different roles.
variable_set('fb_permissions_facebook_permissions:1', array(
'publish_actions',
));
variable_set('fb_permissions_facebook_permissions:2', array(
'publish_actions',
));
variable_set('fb_permissions_facebook_permissions:3', array(
'manage_pages',
'publish_actions',
'publish_pages',
));
}
/**
* Implements hook_uninstall().
*/
function fb_permissions_uninstall() {
foreach (user_roles() as $role_id => $role) {
variable_del('fb_permissions_facebook_permissions:' . $role_id);
}
}
/**
* Set per-role permissions.
*/
function fb_permissions_update_7100(&$sandbox) {
$permissions = variable_get('fb_permissions_facebook_permissions', array(
'publish_stream',
));
// We can only assume that those permissions are for all roles.
foreach (user_roles() as $role_id => $role) {
variable_set('fb_permissions_facebook_permissions:' . $role_id, $permissions);
}
variable_del('fb_permissions_facebook_permissions');
}
/**
* Set per-role permissions.
*/
function fb_permissions_update_7101(&$sandbox) {
// We can only assume that those permissions are for all roles.
foreach (user_roles() as $role_id => $role) {
$permissions = variable_get('fb_permissions_facebook_permissions:' . $role_id, array(
'publish_actions',
));
$key = array_search('publish_stream', $permissions);
if ($key !== FALSE) {
unset($permissions[$key]);
variable_set('fb_permissions_facebook_permissions:' . $role_id, $permissions);
}
}
}
Functions
Name | Description |
---|---|
fb_permissions_install | Implements hook_install(). |
fb_permissions_uninstall | Implements hook_uninstall(). |
fb_permissions_update_7100 | Set per-role permissions. |
fb_permissions_update_7101 | Set per-role permissions. |