function user_relationships_save_elaboration in User Relationships 7
Same name and namespace in other branches
- 6 user_relationship_elaborations/user_relationship_elaborations.module \user_relationships_save_elaboration()
Save an elaboration to the DB
Parameters
$rid: an integer, the relationship ID
$elaboration: a string version of the elaboration. if you're only using the API side of this you could easily serialize the data
Return value
An elaboration object or FALSE if the save was not successful
2 calls to user_relationships_save_elaboration()
- user_relationship_elaborations_request_submit in user_relationship_elaborations/
user_relationship_elaborations.module - Submit handler to store the elaboration for the relationship
- user_relationship_elaborations_submit in user_relationship_elaborations/
user_relationship_elaborations.module - process the submitted form and save the new record
File
- user_relationship_elaborations/
user_relationship_elaborations.module, line 22 - User Relationships Elaborations feature @author Jeff Smick (creator) @author Darren Ferguson http://drupal.org/user/70179
Code
function user_relationships_save_elaboration($rid, $elaboration) {
$record = array(
'rid' => $rid,
'elaboration' => $elaboration,
);
//#456056 need to check if a record already exists, and update. do not assume there is no such rid
$existing_rid = db_query("SELECT rid FROM {user_relationship_elaborations} WHERE rid = :rid", array(
':rid' => $rid,
))
->fetchField();
return drupal_write_record('user_relationship_elaborations', $record, $existing_rid ? array(
'rid',
) : array());
}