Custom Plugin Help Needed (1 post)

  1. 90Design
    Posted 3 years ago #

    Hi everyone,

    I'm having some problems creating a custom plugin that allows me to display if I'm available or away for a certain period in the sidebar.

    Now I've got the menu to show up in the Admin Panel and I got the datepicker to function. Now here is where I could use some help. I should mention I'm no expert coder by any stretch of the imagination so some more detailed help would be kind :)

    I have 2 options, A is a radio button with a fixed value and B is a combination of 2 user inputs (I'm not available from X until Y) Where X and Y are the dates selected in the date fields. I would like to display either option A or B depending on the form and be able to change this if needed.

    I'm not sure if I'm going at this the right way and any help would be greatly appreciated.



    Here are my files:

    The main plugin file.

    	Plugin Name: Name
    	Description: Description
    	Author: Me
    	Version: 1.0
    	Author URI: http://www.google.com
    	function afw_admin() {
    	function afw_admin_actions() {
    		add_menu_page("Afwezigheid Module", "Afwezigheid Module", 1, "Afwezigheid_Module", "afw_admin");
    	add_action('admin_menu', 'afw_admin_actions');


    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/themes/redmond/jquery-ui.css" />
    <div class="wrap">
        <div id="icon-options-general" class="icon32">
        <br />
    <h2>Afwezigheid Instellen</h2>
    	if($_POST['hidden-check']=='Y') {
    	//Form data sent
    	echo '<div class="updated"><p><strong>Instelling opgeslagen</strong></p></div>';
    	//echo saved message
    	else {
            //Normal page display
    <form name="afwezigzijn" action="afwezigheid-include.php" method="post">
    	<input type="hidden" name="hidden-check" value="Y">
        <input type="radio" id="geenafwezig" name="groep" value="geen-afwezigheid" /> Geen Afwezigheid<br />
        <input type="radio" id="welaanwezig" name="groep" value="data-selecteren"> Data selecteren:<br />
        <div id="data">
            <p>Van: <input type="text" class="datepicker" name="datevan" /></p>
            <p>Tot: <input type="text" class="datepicker" name="datetot" /></p>
        <p class="submit">
        <input type="submit" name="Submit" value="Submit" />
        <script src="http://code.jquery.com/jquery-1.8.2.js"></script>
        <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
    	$(function () {
     	$(function () {
        	$('#geenafwezig').click(function () {
    	$('#welaanwezig').click(function () {
        $(function() {
            $( ".datepicker" ).datepicker();

    And the include (I think I need?)

    $aanwezig = $_POST['groep'];
    $van = $_POST['datevan'];
    $tot = $_POST['datetot'];
        if ($aanwezig == "geen-afwezigheid") {
            echo 'Geen afwezigheid';
        else {
    		echo "Afwezig van ". $van . " tot en met " . $tot . ".";

Topic Closed

This topic has been closed to new replies.

About this Topic