From: garvinhicking Date: Fri, 8 Jul 2005 14:28:17 +0000 (+0000) Subject: * RFE #1231423: Allow to change the author of an entry with the X-Git-Tag: 0.9~333 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5c6b8a525da0c55ef563ef2a696c65e343c90ea7;p=s9y.git * RFE #1231423: Allow to change the author of an entry with the "entryproperties" plugin. (garvinhicking) --- diff --git a/docs/NEWS b/docs/NEWS index d81629c..1869b94 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,9 @@ Version 0.9 () ------------------------------------------------------------------------ + * RFE #1231423: Allow to change the author of an entry with the + "entryproperties" plugin. (garvinhicking) + * Templates can now be handled via Spartacus (garvinhicking) * Plugin Manager: Improve Spartacus interface and include plugin diff --git a/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php b/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php index f6ec04b..1f78013 100644 --- a/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php +++ b/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php @@ -142,6 +142,21 @@ class serendipity_event_entryproperties extends serendipity_event serendipity_plugin_api::hook_event('backend_cache_purge', $this->title); } + function &getValidAuthors() { + global $serendipity; + + if (serendipity_checkPermission('adminUsersMaintainOthers')) { + $users = serendipity_fetchUsers(''); + } elseif (serendipity_checkPermission('adminUsersMaintainSame')) { + $users = serendipity_fetchUsers('', serendipity_getGroups($serendipity['authorid'], true)); + } else { + $users = serendipity_fetchUsers($serendipity['authorid']); + } + + return $users; + } + + function updateCache(&$entry) { global $serendipity; @@ -252,7 +267,7 @@ class serendipity_event_entryproperties extends serendipity_event
- +
:
@@ -274,11 +289,31 @@ class serendipity_event_entryproperties extends serendipity_event '; } ?> -

+ :
+
+ +
getValidAuthors(); + $new_authorid = (int)$serendipity['POST']['change_author']; + foreach($avail_users AS $user) { + if ($new_authorid == $user['authorid']) { + serendipity_db_query("UPDATE {$serendipity['dbPrefix']}entries SET authorid = " . $new_authorid . " WHERE id = " . (int)$eventData['id']); + } + } + } if ($is_cache) { $serendipity['POST']['properties']['cache_body'] = $eventData['body'];