allow tagging of people by name or nickname

This commit is contained in:
Zach Prezkuta 2012-09-29 17:55:40 -06:00
commit ce73cd560f
3 changed files with 52 additions and 5 deletions

View file

@ -481,7 +481,25 @@ function photos_post(&$a) {
intval($profile_uid)
);
}
elseif(strstr($name,'_') || strstr($name,' ')) {
else {
$newname = str_replace('_',' ',$name);
//select someone from this user's contacts by name
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
intval($page_owner_uid)
);
if(! $r) {
//select someone by attag or nick and the name passed in
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name),
dbesc($name),
intval($page_owner_uid)
);
}
}
/* elseif(strstr($name,'_') || strstr($name,' ')) {
$newname = str_replace('_',' ',$name);
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
@ -494,7 +512,7 @@ function photos_post(&$a) {
dbesc($name),
intval($page_owner_uid)
);
}
}*/
if(count($r)) {
$newname = $r[0]['name'];
$profile = $r[0]['url'];