diff options
author | friendica <info@friendica.com> | 2012-02-24 20:40:09 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-02-24 20:40:09 -0800 |
commit | a3cf563b6836391ff4d07335cf25189c7a06418e (patch) | |
tree | 919975e4ba99bb0986f69e3ae4a18a0f2091e881 /include/items.php | |
parent | cb9d0993f195841a5d8adcaed4faeb7423f13a14 (diff) | |
download | volse-hubzilla-a3cf563b6836391ff4d07335cf25189c7a06418e.tar.gz volse-hubzilla-a3cf563b6836391ff4d07335cf25189c7a06418e.tar.bz2 volse-hubzilla-a3cf563b6836391ff4d07335cf25189c7a06418e.zip |
update author name across items if changed.
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/include/items.php b/include/items.php index ba4ec036f..de3ade6b4 100755 --- a/include/items.php +++ b/include/items.php @@ -1308,12 +1308,28 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) } if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name-date'])) { - q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", + $r = q("select * from contact where uid = %d and id = %d limit 1", + intval($contact['uid']), + intval($contact['id']) + ); + + $x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", dbesc(notags(trim($new_name))), dbesc(datetime_convert()), intval($contact['uid']), intval($contact['id']) ); + + // do our best to update the name on content items + + if(count($r)) { + q("update item set `author-name` = '%s' where `author-name` = '%s' and `author-link` = '%s' and uid = %d", + dbesc(notags(trim($new_name))), + dbesc($r[0]['name']), + dbesc($r[0]['url']), + intval($contact['uid']) + ); + } } if(strlen($birthday)) { |