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;
<label title="<?php echo PLUGIN_EVENT_ENTRYPROPERTIES_NL2BR; ?>" for="properties_no_nl2br"> <?php echo PLUGIN_EVENT_ENTRYPROPERTIES_NL2BR; ?> </label><br />
<?php } ?>
-
+
<br />
<?php echo PLUGIN_EVENT_ENTRYPROPERTIES_ACCESS; ?>:<br />
<div style="margin-left: 10px">
<option value="<?php echo $group['id']; ?>" <?php echo (in_array($group['id'], $access_groups) ? 'selected="selected"' : ''); ?>><?php echo htmlspecialchars($group['name']); ?></option>
<?php
}
+ echo '</select>';
}
?>
- </select>
</div>
<br />
+ <?php echo AUTHOR; ?>:<br />
+ <div style="margin-left: 10px">
+ <select name="serendipity[change_author]">
+ <?php
+ if (isset($serendipity['POST']['change_author'])) {
+ $selected_user = $serendipity['POST']['change_author'];
+ } elseif (!empty($eventData['authorid'])) {
+ $selected_user = $eventData['authorid'];
+ } else {
+ $selected_user = $serendipity['authorid'];
+ }
+
+ $avail_users =& $this->getValidAuthors();
+
+ foreach($avail_users AS $user) {
+ echo '<option value="' . $user['authorid'] . '" ' . ($selected_user == $user['authorid'] ? ' selected="selected"' : '') . '>' . $user['realname'] . '</option>' . "\n";
+ }
+ ?>
+ </select>
+ </div>
</fieldset>
<?php
return true;
if (!isset($serendipity['POST']['properties']) || !is_array($serendipity['POST']['properties']) || !isset($eventData['id'])) {
return true;
}
+
+ if (!empty($serendipity['POST']['change_author']) && $serendipity['POST']['change_author'] != $eventData['id']) {
+ // Check again if the POSTed value is an author that the current user has "access" to.
+ $avail_users =& $this->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'];