Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter edowney

    (@edowney)

    Huh, that’s great news if it works with 4.5.2. The admin section doesn’t work either which is theme independent. I don;t want to lose what I’ve already set up. Is there a way to reinstall without data loss? Right now when I click on File Manager I get a message that says “Unable to connect to backend”

    Forum: Hacks
    In reply to: Can't get $_POST data
    Thread Starter edowney

    (@edowney)

    Well, I guess if you peck at something long enough…I didn’t have a name in the input tag. Good grief…

    Forum: Hacks
    In reply to: Can't get $_POST data
    Thread Starter edowney

    (@edowney)

    Figured out where the permission where was coming from. Had to change the wp_redirect page to sd-admin-calendar-configuration. So that works now but I’m still not seeing any post data coming through. Sucks to be a newbie…

    Forum: Hacks
    In reply to: Can't get $_POST data
    Thread Starter edowney

    (@edowney)

    Ok, so I made some changes as you can see. Now when it posts I get a “You do not have sufficient permissions to access this page.”

    <?php
    /**
     * Created by PhpStorm.
     * User: eric.downey
     * Date: 10/31/2014
     * Time: 1:42 PM
     */
    
    function sdCalendarAdmintInit()
    {
        add_action ( 'admin_post_SaveEvent', 'processSaveEvent' );
    }
    
    function processSaveEvent()
    {
        global $wpdb;
    
        // Make sure this person can actually save this info...
        if ( !current_user_can( 'manage_options' ) ) wp_die ('Nope, Not allowed');
    
        $title = $_POST['eventTitle'];
    
        $tableName = $wpdb->prefix . sdEventTable;
    
        $wpdb->insert(
            $tableName,
            array(
                'title' => $title,
                'startTime' => current_time ('mysql'),
                'endTime' => current_time ('mysql'),
                'created' => current_time ('mysql'),
            ));
    
        // Redirect to the configuration form that was processed.
        wp_redirect ( add_query_arg( 'page', 'sdCalendar_menu_settings', admin_url('options-general.php') ) );
        exit();
    }
    
    function SDCalendarConfig()
    {
        $options = get_option( 'sdCalendar_options' );
    
        ?>
        <div class="wrap">
            <h2>Smith & Dow Calendar v<?php echo $options[ 'version' ] ?> Configuration</h2>
            <h3>Add/Edit an Event</h3>
            <form method="post" action='admin-post.php'>
                <input type="hidden" name="action" value="SaveEvent" />
                <?php wp_nonce_field( 'sdCalendar' ) ?>
                <table id="addEditEventTable">
                    <tr>
                        <td>
                            <label for="eventTitle" class="required">Title</label>
                        </td>
                        <td>
                            <input type="text" id="eventTitle" > <!--class="k-textbox" placeholder="Event title" required validationMessage="Please enter an event title" -->
                        </td>
                    </tr>
                    <tr>
                        <td>
                           <label for="startDateTimePicker">Start date/time</label>
                        </td>
                        <td>
                            <input id="startDateTimePicker" >
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="endDateTimePicker">End date/time</label>
                        </td>
                        <td>
                            <input id="endDateTimePicker" >
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="allday">All day?</label>
                        </td>
                        <td>
                            <input type="checkbox" id="allDay" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="holiday">Holiday?</label>
                        </td>
                        <td>
                            <input type="checkbox" id="holiday" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="cancelOnHoliday">Cancel on holidays?</label>
                        </td>
                        <td>
                            <input type="checkbox" id="cancelOnHoliday" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="location">Location</label>
                        </td>
                        <td>
                            <input type="text" id="location" >
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="category">Category</label>
                        </td>
                        <td>
                            <select id="category" placeholder="Select category...">
                                <option>Open gaming</option>
                                <option>Tournament</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <label for="description">Description</label>
                        </td>
                        <td>
                            <textarea id="description" rows="5" cols="15" style="width:475px;height:220px">
                            </textarea>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top"><label>Recurrence</label></td>
                        <td>
                            <div id="forecast">
                                <div id="tabstrip">
                                    <ul>
                                        <li class="k-state-active">
                                            None
                                        </li>
                                        <li>
                                            Daily
                                        </li>
                                        <li>
                                            Weekly
                                        </li>
                                        <li>
                                            Monthly
                                        </li>
                                        <li>
                                            Yearly
                                        </li>
                                    </ul>
                                    <div>
                                        <div class="recurrence" id="noOccurrence">
                                            <div style="margin: 10px auto 10px; width: 440px;">
                                                This event only occurs once.
                                            </div>
                                        </div>
                                    </div>
                                    <div>
                                        <div class="recurrence" id="dailyOccurrence">
                                            <div style="width: 440px;">
                                            <table>
                                                <tr>
                                                    <td>
                                                        <input type="radio" name="dailyType" value="everyXDays">Every <input id="dayNumberDaily" type="number" value="1" min="1" max="364" style="width: 70px;" /> day(s)
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <input type="radio" name="dailyType" value="everyDay">Every day
                                                    </td>
                                                </tr>
                                            </table>
                                            </div>
                                        </div>
                                    </div>
                                    <div>
                                        <div class="recurrence" id="weeklyOccurrence">
                                            <div style="width: 440px;">
                                            Recur every <input id="weekNumberWeekly" type="number" value="1" min="1" max="364" style="width: 70px;" /> week(s) on:<br />
                                            <table>
                                                <tr>
                                                    <td><input type="checkbox" id="sunday" /> Sunday</td>
                                                    <td><input type="checkbox" id="monday" /> Monday</td>
                                                    <td><input type="checkbox" id="tuesday" /> Tuesday</td>
                                                    <td><input type="checkbox" id="wednesday" /> Wednesday</td>
                                                </tr>
                                                <tr>
                                                    <td><input type="checkbox" id="thursday" /> Thursday</td>
                                                    <td><input type="checkbox" id="friday" /> Friday</td>
                                                    <td><input type="checkbox" id="saturday" /> Saturday</td>
                                                </tr>
                                            </table>
                                            </div>
                                        </div>
                                    </div>
                                    <div>
                                        <div class="recurrence" id="monthlyOccurrence">
                                            <div style="width: 440px;">
                                            <table>
                                                <tr>
                                                    <td>
                                                        <input type="radio" name="monthlyType" value="dayNumber"> Day
                                                        <input id="dayNumberMonthly" type="number" value="1" min="1" max="31" style="width: 60px;" />
                                                        of every
                                                        <input id="monthNumberMonthly" type="number" value="1" min="1" max="12" style="width: 60px;" />
                                                        month(s)
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <input type="radio" name="monthlyType" value="weekNumber">The
                                                        <select id="weekNumber" >
                                                            <option>first</option>
                                                            <option>second</option>
                                                            <option>third</option>
                                                            <option>fourth</option>
                                                        </select>
                                                        <select id="dayName" >
                                                            <option>Sunday</option>
                                                            <option>Monday</option>
                                                            <option>Tuesday</option>
                                                            <option>Wednesday</option>
                                                            <option>Thursday</option>
                                                            <option>Friday</option>
                                                            <option>Saturday</option>
                                                        </select>
                                                        of every
                                                        <input id="monthNumber2Monthly" type="number" value="1" min="1" max="12" style="width: 60px;" />
                                                        month(s)
                                                    </td>
                                                </tr>
                                            </table>
                                            </div>
                                        </div>
                                    </div>
                                    <div>
                                        <div class="recurrence" id="yearlyOccurrence">
                                            <div style="width: 440px;">
                                            <table
                                                <tr>
                                                    <td>
                                                        Recur every <input id="yearNumberYearly" type="number" value="1" min="1" max="99" style="width: 60px;" /> year(s)
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <input type="radio" name="yearlyType" value="specifyMonthDay">On:
                                                        <select id="monthNameYearly" >
                                                            <option>January</option>
                                                            <option>February</option>
                                                            <option>March</option>
                                                            <option>April</option>
                                                            <option>May</option>
                                                            <option>June</option>
                                                            <option>July</option>
                                                            <option>August</option>
                                                            <option>September</option>
                                                            <option>October</option>
                                                            <option>November</option>
                                                            <option>December</option>
                                                        </select>
                                                        <input id="dayNumberYearly" type="number" value="1" min="1" max="31" style="width: 60px;" />
    
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <input type="radio" name="yearlyType" value="specifyWeekMonth">On the:
                                                        <select id="weekNumberYearly" >
                                                            <option>first</option>
                                                            <option>second</option>
                                                            <option>third</option>
                                                            <option>fourth</option>
                                                        </select>
                                                        <select id="dayNameYearly" >
                                                            <option>Sunday</option>
                                                            <option>Monday</option>
                                                            <option>Tuesday</option>
                                                            <option>Wednesday</option>
                                                            <option>Thursday</option>
                                                            <option>Friday</option>
                                                            <option>Saturday</option>
                                                        </select>
                                                        of
                                                        <select id="monthNameYearly" >
                                                            <option>January</option>
                                                            <option>February</option>
                                                            <option>March</option>
                                                            <option>April</option>
                                                            <option>May</option>
                                                            <option>June</option>
                                                            <option>July</option>
                                                            <option>August</option>
                                                            <option>September</option>
                                                            <option>October</option>
                                                            <option>November</option>
                                                            <option>December</option>
                                                        </select>
                                                    </td>
                                                </tr>
                                            </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input class="k-button" type="submit" name="Submit" value="Save Event" />
                        </td>
                    </tr>
                </table>
            </form>
        </div>
        <style scoped>
            #addEditEventTable td { padding: 10px; }
    
             .k-textbox {
                 width: 11.8em;
             }
    
            label {
                display: inline-block;
                width: 100px;
                text-align: right;
            }
    
            .required {
                font-weight: bold;
            }
    
            .accept, .status {
                padding-left: 90px;
            }
    
            .valid {
                color: green;
            }
    
            .invalid {
                color: red;
            }
    
            span.k-tooltip {
                margin-left: 6px;
            }
        </style>
        <script>
            //$(document).ready(function () {
            jQuery(document).ready(function ($) {
                // Daily tab
                $("#dayNumberDaily").kendoNumericTextBox({ format: "0"});
    
                // Weekly tab
                $("#weekNumberWeekly").kendoNumericTextBox({ format: "0"});
    
                // Monthly tab
                $("#dayNumberMonthy").kendoNumericTextBox({ format: "0"});
                $("#monthNumberMonthy").kendoNumericTextBox({ format: "0"});
                $("#monthNumber2Monthy").kendoNumericTextBox({ format: "0"});
    
                // Yearly tab
                $("#yearNumberYearly").kendoNumericTextBox({ format: "0"});
    
                // create DateTimePicker from input HTML element
                $("#startDateTimePicker").kendoDateTimePicker({
                    value:new Date()
                });
                $("#endDateTimePicker").kendoDateTimePicker({
                    value:new Date()
                });
                $("#description").kendoEditor();
                $("#category").kendoComboBox();
                $("#tabstrip").kendoTabStrip({
                    animation:  {
                        open: {
                            effects: "fadeIn"
                        }
                    }
                });
    /*            var validator = $("#title").kendoValidator().data("kendoValidator"),
                    status = $(".status");
    
                $("button").click(function() {
                    if (validator.validate()) {
                        status.text("Event title accepted.")
                            .removeClass("invalid")
                            .addClass("valid");
                    } else {
                        status.text("An event title is required.")
                            .removeClass("valid")
                            .addClass("invalid");
                    }
                });*/
            });
        </script>
    
    <?php
    }
    Thread Starter edowney

    (@edowney)

    Wow, that did it! Thanks – you’re the best!

    Thread Starter edowney

    (@edowney)

    Sure! Here’s my initial plugin file that registers the css and js files. It’s still very preliminary.

    function sdCalendar_menu_settings()
    {
        add_options_page('SD Admin Calendar Configuration', 'SD Calendar Config', 'manage_options', 'sd-admin-calendar-configuration', 'SDCalendarConfig');
    }
    
    function my_enqueue($hook) {
    /*    if ( 'sdAddEditEvent.php' != $hook ) {
            return;
        }*/
    
        wp_register_style( 'custom_wp_admin_css1', plugin_dir_url( __FILE__ ) . 'kendo.common.min.css', false, '1.0.0' );
        wp_enqueue_style( 'custom_wp_admin_css1' );
    
        wp_register_style( 'custom_wp_admin_css12', plugin_dir_url( __FILE__ ) . 'kendo.rtl.min.css', false, '1.0.0' );
    
        wp_enqueue_style( 'custom_wp_admin_css2' );
    
        wp_register_style( 'custom_wp_admin_css3', plugin_dir_url( __FILE__ ) . 'kendo.default.min.css', false, '1.0.0' );
        wp_enqueue_style( 'custom_wp_admin_css3' );
    
        wp_enqueue_script( 'my_custom_script', plugin_dir_url( __FILE__ ) . 'kendo.web.min.js' );
    }
    
    include_once dirname( __FILE__ ) . '/sdCalendarDefaultOptions.php';
    include_once dirname( __FILE__ ) . '/sdAddEditEvent.php';
    
    register_activation_hook(__FILE__, 'sdCalendarDefaultOptions');
    
    add_action( 'admin_menu', 'sdCalendar_menu_settings');
    
    add_action( 'admin_enqueue_scripts', 'my_enqueue' );

    And here’s the code in the admin config file. Right now I’m just trying to get the first input called datetimepicker to fire off – thanx!

    function SDCalendarConfig()
    {
        $options = get_option( 'sdCalendar_options' );
    
        ?>
        <div class="wrap">
            <h2>Smith & Dow Calendar v<?php echo $options[ 'version' ] ?> Configuration</h2>
            <h3>Add/Edit an Event</h3>
            <form>
                <table>
                    <tr>
                        <td>
                            Start date/time
                        </td>
                        <td>
                            <div id="example" class="k-content">
                                <div id="to-do">
                                    <input id="datetimepicker" >
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            End date/time
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>
                            Is all day?
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>
                            Location
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>
                            Category
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>
                            Description
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>
                            Holiday?
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>
                            Cancel on holidays?
                        </td>
                        <td></td>
                    </tr>
                </table>
            </form>
        </div>
        <script>
            $(document).ready(function () {
                // create DateTimePicker from input HTML element
                $("#datetimepicker").kendoDateTimePicker({
                    value:new Date()
                });
            });
        </script>
        <style scoped>
            #to-do {
                height: 52px;
                width: 221px;
                margin: 30px auto;
                padding: 91px 0 0 188px;
                background: url('todo.png') transparent no-repeat 0 0;
            }
        </style>
    Thread Starter edowney

    (@edowney)

    I think my original post to this got lost in the interweb…uuugghhh…

    Anyway, I want to have a menu option called Register and when you click on it you go to the registration page. Very simple. No multiple events or what not. Thanx!

    Thread Starter edowney

    (@edowney)

    Ah, yep you are quite right about turning off the login. Anyway, what I need to be able to do is setup a registration page for a tournament my gaming club is running. I created the event but I get this Event menu with drop downs for Categories, Locations, My Bookings and Tags. All I really want is for a menu option called Register that when clicked takes you directly to the registration page. With the login part turned off that’s a big part of what I wanted to clear up. The format is a bit meh for the page. Everything is thrown to the left. Is there also a way to play for the format and adding additional content to the page? Thanx!

    Thread Starter edowney

    (@edowney)

    It goes to the root wordpress install. Are you running the same versions of WP and the plugin that I am? (See original post).

    Thread Starter edowney

    (@edowney)

    Thanks! I use GoDaddy to register my domain names and IX Webhosting for my websites. Does that matter in your scenario?

Viewing 10 replies - 1 through 10 (of 10 total)