function _user_relationship_blocks_settings in User Relationships 6
Push or pull the settings from the database
4 calls to _user_relationship_blocks_settings()
- user_relationship_blocks_block in user_relationship_blocks/
user_relationship_blocks.module - Implementation for hook_block
- _user_relationship_blocks_form in user_relationship_blocks/
user_relationship_blocks.module - helper function user_relationship_blocks_block delegates to when $op == 'configure'
- _user_relationship_blocks_insert_defaults in user_relationship_blocks/
user_relationship_blocks.module - Update the table with default values This makes sure it's not writing over user defined settings
- _user_relationship_blocks_view in user_relationship_blocks/
user_relationship_blocks.module - helper function user_relationship_blocks_block delegates to when $op == 'view'
File
- user_relationship_blocks/
user_relationship_blocks.module, line 315 - User Relationship Blocks implementation @author Jeff Smick (creator) @author Alex Karshakevich (maintainer) http://drupal.org/user/183217
Code
function _user_relationship_blocks_settings($bid = NULL, $new_settings = NULL) {
static $settings = array();
if (isset($new_settings)) {
//can't find a better spot for this. If get_account php snippet is cleared by user, revert to default value
if (!$new_settings['get_account']) {
$new_settings['get_account'] = _user_relationship_blocks_find_user_php();
}
drupal_write_record('user_relationship_blocks', $new_settings, 'bid');
$settings[$key] = (object) $new_settings;
}
elseif ($bid && (!isset($settings[$bid]) || !$settings[$bid])) {
$settings[$bid] = db_fetch_object(db_query("SELECT * FROM {user_relationship_blocks} WHERE bid = '%s'", $bid));
}
else {
$results = db_query("SELECT * FROM {user_relationship_blocks}");
while ($setting = db_fetch_object($results)) {
$settings[$setting->bid] = $setting;
}
}
return $bid ? $settings[$bid] : $settings;
}