mirror of
https://github.com/friendica/friendica
synced 2024-12-23 03:20:15 +00:00
allow tagging of people by name or nickname
This commit is contained in:
parent
ebabd25717
commit
ce73cd560f
3 changed files with 52 additions and 5 deletions
22
mod/item.php
22
mod/item.php
|
@ -994,7 +994,25 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
|
||||||
intval($tagcid),
|
intval($tagcid),
|
||||||
intval($profile_uid)
|
intval($profile_uid)
|
||||||
);
|
);
|
||||||
} elseif(strstr($name,'_') || strstr($name,' ')) { //no id
|
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($profile_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($profile_uid)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* } elseif(strstr($name,'_') || strstr($name,' ')) { //no id
|
||||||
//get the real name
|
//get the real name
|
||||||
$newname = str_replace('_',' ',$name);
|
$newname = str_replace('_',' ',$name);
|
||||||
//select someone from this user's contacts by name
|
//select someone from this user's contacts by name
|
||||||
|
@ -1009,7 +1027,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
|
||||||
dbesc($name),
|
dbesc($name),
|
||||||
intval($profile_uid)
|
intval($profile_uid)
|
||||||
);
|
);
|
||||||
}
|
}*/
|
||||||
//$r is set, if someone could be selected
|
//$r is set, if someone could be selected
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
$profile = $r[0]['url'];
|
$profile = $r[0]['url'];
|
||||||
|
|
|
@ -481,7 +481,25 @@ function photos_post(&$a) {
|
||||||
intval($profile_uid)
|
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);
|
$newname = str_replace('_',' ',$name);
|
||||||
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
dbesc($newname),
|
dbesc($newname),
|
||||||
|
@ -494,7 +512,7 @@ function photos_post(&$a) {
|
||||||
dbesc($name),
|
dbesc($name),
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
}
|
}*/
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
$newname = $r[0]['name'];
|
$newname = $r[0]['name'];
|
||||||
$profile = $r[0]['url'];
|
$profile = $r[0]['url'];
|
||||||
|
|
|
@ -101,7 +101,7 @@ function profiles_post(&$a) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$newname = $lookup;
|
$newname = $lookup;
|
||||||
if(strstr($lookup,' ')) {
|
/* if(strstr($lookup,' ')) {
|
||||||
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
dbesc($newname),
|
dbesc($newname),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
|
@ -112,6 +112,17 @@ function profiles_post(&$a) {
|
||||||
dbesc($lookup),
|
dbesc($lookup),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
|
dbesc($newname),
|
||||||
|
intval(local_user())
|
||||||
|
);
|
||||||
|
if(! $r) {
|
||||||
|
$r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
|
dbesc($lookup),
|
||||||
|
intval(local_user())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
$prf = $r[0]['url'];
|
$prf = $r[0]['url'];
|
||||||
|
|
Loading…
Reference in a new issue