emlog 文章页新增作者选项
emlog 文章页作者默认是当前登录用户,无法自己选择作者,只能发布文章后再更改作者,这样操作起来比较麻烦,所以个人新增作者选项来方便自己。
1. 修改 admin\write_log.php
找到约行19 和 行50 新增 $users = $CACHE->readCache('user');
2. 修改 admin\views\add_log.php
找到约行86 删除 <input type="hidden" name="author" id="author" value=<?php echo UID; ?> /> 在合适的地方新增 <?php if (ROLE == ROLE_ADMIN): ?> <select name="author" id="author" style="width:130px;"> <option value="<?php echo UID; ?>">选择作者...</option> <?php foreach ($users as $key => $value): $flg = $key == $author ? 'selected' : ''; ?> <option value="<?php echo $key; ?>" <?php echo $flg; ?>><?php echo $value['name']; ?></option> <?php endforeach; ?> </select> <? else: ?> <input type="hidden" name="author" id="author" value=<?php echo UID; ?> /> <?php endif; ?>
3. 修改 admin\views\edit_log.php
找到约行90 删除 <input type="hidden" name="author" id="author" value=<?php echo $author; ?> /> 在合适的地方新增 <?php if (ROLE == ROLE_ADMIN): ?> <select name="author" id="author" style="width:130px;"> <option value="<?php echo UID; ?>">选择作者...</option> <?php foreach ($users as $key => $value): $flg = $key == $author ? 'selected' : ''; ?> <option value="<?php echo $key; ?>" <?php echo $flg; ?>><?php echo $value['name']; ?></option> <?php endforeach; ?> </select> <? else: ?> <input type="hidden" name="author" id="author" value=<?php echo $author; ?>/> <?php endif; ?>
pro
1. admin/article.php
找到约19行新增
$users = $CACHE->readCache('user');
2. admin/views/article_write.php
找到约96行删除
<input type="hidden" name="author" id="author" value=<?php echo $author; ?>/>
在合适的地方新增,如:69行左右,即分类下面
<?php if (ROLE == ROLE_ADMIN): ?>
<div class="form-group">
<label>作者:</label>
<select name="author" id="author" class="form-control">
<option value="<?php echo $author; ?>">选择作者...</option>
<?php
foreach ($users as $key => $value):
$flg = $key == $author ? 'selected' : '';
?>
<option value="<?php echo $key; ?>" <?php echo $flg; ?>><?php echo $value['name']; ?></option>
<?php
endforeach;
?>
</select>
</div>
<? else: ?>
<input type="hidden" name="author" id="author" value=<?php echo $author; ?> />
<?php endif; ?>