Plugin to allow visitor contributions to WordPress posts, wiki style.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

71 righe
2.8 KiB

<?php
$options=[];
if(isset($_POST["save_settings"])){
$options=[
"admin_email"=>$_POST["admin_email"],
"notify_admin"=>$_POST["notify_admin"],
"advanced_merge"=>$_POST["advanced_merge"],
"admin_notif_message"=>$_POST["admin_notif_message"],
"visitor_notif_message"=>$_POST["visitor_notif_message"],
"edit_notify_message"=>$_POST["edit_notify_message"],
"propose_edit_link"=>$_POST["propose_edit_link"]
];
update_option( "visitors_edits_options", $options );
flashMessage("Settings saved.","");
}else{
$options=get_option( "visitors_edits_options", [
"admin_email"=>"",
"notify_admin"=>null,
"advanced_merge"=>null,
"visitor_notif_message"=>"Your suggestion was submitted.",
"admin_notif_message"=>"A new suggestion was submitted.",
"edit_notify_message"=>"Thanks for your contribution to our blog, your contribution was reviewed and approved.",
"propose_edit_link"=>"<p><a href='#post_link#'>Propose an edit</a></p>"
]);
}
?>
<div class="visitors_edits_admin">
<h2>Settings</h2>
<form action="" method="post">
<div class="control">
<label>Propose an edit link</label>
<input type="text" name="propose_edit_link" value="<?php echo stripcslashes($options['propose_edit_link']) ?>">
</div>
<div class="control">
<label>Admin notification message</label>
<textarea name="admin_notif_message" class="notif_message" value=""><?php echo $options['admin_notif_message'] ?></textarea>
</div>
<div class="control">
<label>Visitor notification message (On Submit)</label>
<textarea name="visitor_notif_message" class="notif_message" value=""><?php echo $options['visitor_notif_message'] ?></textarea>
</div>
<div class="control">
<label>Visitor notification message (On Review)</label>
<textarea name="edit_notify_message" class="notif_message" value=""><?php echo $options['edit_notify_message'] ?></textarea>
</div>
<div class="control">
<label>Admin email</label>
<input type="text" placeholder="Email" name="admin_email" value="<?php echo $options['admin_email'] ?>">
</div>
<div class="control">
<label><input type="checkbox" name="notify_admin" <?php echo (($options['notify_admin']==null) ? "" : "checked")?>>Notify me on new submits.</label>
</div>
<div class="control">
<label><input type="checkbox" name="advanced_merge" <?php echo (($options['advanced_merge']==null) ? "" : "checked")?>>Use deep merging.</label>
</div>
<div class="control">
<input type="submit" class="save_btn button-primary" value="Save settings" name="save_settings">
</div>
</form>
</div>
<?php
function flashMessage($msg,$type){
?>
<div class="visitors_flashMessage <?php echo $type ?>">
<p>
<?php echo $msg ;?>
</p>
</div>
<?php
}
?>