Plugin to allow visitor contributions to WordPress posts, wiki style.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.8KB

  1. <?php
  2. $options=[];
  3. if(isset($_POST["save_settings"])){
  4. $options=[
  5. "admin_email"=>$_POST["admin_email"],
  6. "notify_admin"=>$_POST["notify_admin"],
  7. "advanced_merge"=>$_POST["advanced_merge"],
  8. "admin_notif_message"=>$_POST["admin_notif_message"],
  9. "visitor_notif_message"=>$_POST["visitor_notif_message"],
  10. "edit_notify_message"=>$_POST["edit_notify_message"],
  11. "propose_edit_link"=>html_entity_decode($_POST["propose_edit_link"])
  12. ];
  13. update_option( "visitors_edits_options", $options );
  14. flashMessage("Settings saved.","");
  15. }else{
  16. $options=get_option( "visitors_edits_options", [
  17. "admin_email"=>"",
  18. "notify_admin"=>null,
  19. "advanced_merge"=>null,
  20. "visitor_notif_message"=>"Your suggestion was submitted.",
  21. "admin_notif_message"=>"A new suggestion was submitted.",
  22. "edit_notify_message"=>"Thanks for your contribution to our blog, your contribution was reviewed and approved.",
  23. "propose_edit_link"=>"<p><a href='#post_link#'>Propose an edit</a></p>"
  24. ]);
  25. }
  26. ?>
  27. <div class="visitors_edits_admin">
  28. <h2>Settings</h2>
  29. <form action="" method="post">
  30. <div class="control">
  31. <label>Propose an edit link</label>
  32. <input type="text" name="propose_edit_link" value="<?php echo htmlentities(stripcslashes($options['propose_edit_link'])) ?>">
  33. </div>
  34. <div class="control">
  35. <label>Admin notification message</label>
  36. <textarea name="admin_notif_message" class="notif_message" value=""><?php echo $options['admin_notif_message'] ?></textarea>
  37. </div>
  38. <div class="control">
  39. <label>Visitor notification message (On Submit)</label>
  40. <textarea name="visitor_notif_message" class="notif_message" value=""><?php echo $options['visitor_notif_message'] ?></textarea>
  41. </div>
  42. <div class="control">
  43. <label>Visitor notification message (On Review)</label>
  44. <textarea name="edit_notify_message" class="notif_message" value=""><?php echo $options['edit_notify_message'] ?></textarea>
  45. </div>
  46. <div class="control">
  47. <label>Admin email</label>
  48. <input type="text" placeholder="Email" name="admin_email" value="<?php echo $options['admin_email'] ?>">
  49. </div>
  50. <div class="control">
  51. <label><input type="checkbox" name="notify_admin" <?php echo (($options['notify_admin']==null) ? "" : "checked")?>>Notify me on new submits.</label>
  52. </div>
  53. <div class="control">
  54. <label><input type="checkbox" name="advanced_merge" <?php echo (($options['advanced_merge']==null) ? "" : "checked")?>>Use deep merging.</label>
  55. </div>
  56. <div class="control">
  57. <input type="submit" class="save_btn button-primary" value="Save settings" name="save_settings">
  58. </div>
  59. </form>
  60. </div>
  61. <?php
  62. function flashMessage($msg,$type){
  63. ?>
  64. <div class="visitors_flashMessage <?php echo $type ?>">
  65. <p>
  66. <?php echo $msg ;?>
  67. </p>
  68. </div>
  69. <?php
  70. }
  71. ?>