intval($tagcid),
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
$newname = str_replace('_',' ',$name);
//select someone from this user's contacts by name
dbesc($name),
intval($profile_uid)
);
- }
+ }*/
//$r is set, if someone could be selected
if(count($r)) {
$profile = $r[0]['url'];
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),
dbesc($name),
intval($page_owner_uid)
);
- }
+ }*/
if(count($r)) {
$newname = $r[0]['name'];
$profile = $r[0]['url'];
}
else {
$newname = $lookup;
- if(strstr($lookup,' ')) {
+/* if(strstr($lookup,' ')) {
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
intval(local_user())
dbesc($lookup),
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)) {
$prf = $r[0]['url'];