function follow_link_save in Follow 5
Same name and namespace in other branches
- 6 follow.module \follow_link_save()
- 7.2 follow.inc \follow_link_save()
- 7 follow.module \follow_link_save()
Inserts a new link, or updates an existing one.
Parameters
$link: A link object to be saved.
1 call to follow_link_save()
- follow_links_form_submit in ./
follow.module - Submit handler for the follow_links_form.
File
- ./
follow.module, line 599 - Allows users to add links to their social network profiles.
Code
function follow_link_save($link) {
$parsed = follow_parse_url($link->url);
$link->path = $parsed['path'];
$link->options = $parsed['options'];
$name = isset($link->name) ? $link->name : '';
$uid = isset($link->uid) ? $link->uid : 0;
$path = isset($link->path) ? $link->path : '';
$options = serialize(isset($link->options) ? $link->options : array());
$title = isset($link->title) ? $link->title : '';
$weight = isset($link->weight) ? $link->weight : 0;
if (isset($link->lid)) {
db_query("UPDATE {follow_links} set name = '%s', uid = %d, path = '%s', options = '%s', weight = %d, title = '%s' WHERE lid = %d", $name, $uid, $path, $options, $weight, $title, $link->lid);
}
else {
db_query("INSERT INTO {follow_links} (name, uid, path, options, weight, title) VALUES ('%s', %d, '%s', '%s', %d, '%s')", $name, $uid, $path, $options, $weight, $title);
}
return $link;
}