link_owner == $user_ID ) { $my_link = &$link; break; } /* NOTE: With this method, the first link returned is by the author, which means, people should never ever edit the blogroll!!!! Only admins!!! This isn't a problem, unless admin tries to do... */ $link_rss = $my_link->link_rss; $link_id = $my_link->link_id; // echo "
";
// print_r($my_link);
// print_r($user_identity);
// print_r($user_ID);
// echo "";
?>
ERROR: The blog URL entered is not correct.');
// exit;
}
$_POST['link_rss'] = clean_url($_POST['link_rss']);
/* check blog feed */
if ( !empty($_POST['link_rss']) && is_url($_POST['link_rss']) )
{
$errors['feed_url'] =__('ERROR: The feed URL entered is not correct.');
// exit;
}
// $_POST['link_name'] = wp_specialchars( $_POST['link_name'] );
// Nasty picking of a name for the link (without will fail!)
$_POST['link_name'] = ( !empty($_POST['display_name']) ?
$_POST['display_name'] :
( !empty($_POST['user_login']) ?
$_POST['user_login'] : $_POST['link_url']) );
// $_POST['link_image'] = wp_specialchars( $_POST['link_image'] );
// TODO: Get contributors category dynamically
// $_POST['link_category'] = $_POST['post_category'];
/*
echo "";
print_r( $_POST );
echo "";
*/
// Check to see if the same link exists, and if so, alert that you can't
// have the same link
$links_searched =
get_bookmarks("link_owner=$user_ID&category_name=Contributors");
foreach ( $links_searched as $link )
{
// We want to allow empty set feed uri's
if ( empty($link->link_rss) )
continue;
if ( $link->link_owner != $user_ID &&
$link->link_rss == $_POST['link_rss'] )
{
// don't allow update saying, this shit is bunk
$errors['duplicate_feed'] = __("ERROR: " .
"This feed is already entered into the system. " .
"Please enter another feed.");
// exit;
}
}
if ( !empty( $_POST['link_id'] ) )
return wp_update_link( $_POST);
else
return wp_insert_link( $_POST);
}
?>