Plugin Directory

Changeset 1284898


Ignore:
Timestamp:
11/12/2015 03:29:29 PM (10 years ago)
Author:
grumpytoaster
Message:

All config options are now available in the Wordpress Admin

Location:
contact-form-with-mailman/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • contact-form-with-mailman/trunk/mailman-contact.php

    r1202529 r1284898  
    33Plugin Name: Contact Form with Mailman
    44Description: Simple contact for with a check box to subscribe to a mailman mailing list
    5 Version: 1.1.2
     5Version: 2.0.0
    66Author: Jeff Craft
    77Author URI: http://jeffcraft.ca
     
    1212// Configuration
    1313function cfwm_get_config() {
    14     $config['list_name'] = ''; // eg. mylist
    15     $config['mailman_url'] = ''; // eg. http://lists.domain.com/mailman/admin/
    16     $config['list_password'] = ''; // Password you use to login to mailman admin
     14    //$config['list_name'] = ''; // eg. mylist
     15    //$config['mailman_url'] = ''; // eg. http://lists.domain.com/mailman/admin/
     16    //$config['list_password'] = ''; // Password you use to login to mailman admin
     17   
     18    $config['list_name'] = get_option('cfwm_list_name'); // eg. mylist
     19    $config['mailman_url'] = get_option('cfwm_mailman_url'); // eg. http://lists.domain.com/mailman/admin/
     20    $config['list_password'] = get_option('cfwm_list_password'); // Password you use to login to mailman admin
    1721   
    1822    return $config;
     
    2226// Do not edit past this line
    2327////////////////////////////////////////////////////////////////////////////////////////////////////
     28
     29// Create Settings Page
     30add_action('admin_menu', 'cfwm_plugin_settings');
     31
     32function cfwm_plugin_settings() {
     33    add_menu_page('Contact Form with Mailman Settings', 'Mailman Settings', 'administrator', 'cfwm_settings', 'cfwm_display_settings');
     34}
     35
     36function cfwm_display_settings() {
     37    $list_name = get_option('cfwm_list_name');
     38    $mailman_url = get_option('cfwm_mailman_url');
     39    $list_password = get_option('cfwm_list_password');
     40
     41    $html = '</pre>';
     42    $html .= '<div class="wrap"><form action="options.php" method="post" name="options">';
     43    $html .= '<h2>Contact Form with Mailman Settings</h2>';
     44    $html .= '<h3>Update Your Settings</h3>';
     45    $html .= wp_nonce_field('update-options');
     46
     47    $html .= '<table class="form-table" width="100%" cellpadding="10">';
     48    $html .= '<tbody>';
     49
     50    $html .= '<tr>';
     51    $html .= '<td scope="row" align="left">';
     52    $html .= '<label><strong>Mailman List Name:</strong></label><br /><input type="text" name="cfwm_list_name" value="'.$list_name.'" />';
     53    $html .= '</td>';
     54    $html .= '</tr>';
     55   
     56    $html .= '<tr>';
     57    $html .= '<td scope="row" align="left">';
     58    $html .= '<label><strong>Mailman List URL:</strong></label><br /><input type="text" name="cfwm_mailman_url" value="'.$mailman_url.'" />';
     59    $html .= '</td>';
     60    $html .= '</tr>';
     61   
     62    $html .= '<tr>';
     63    $html .= '<td scope="row" align="left">';
     64    $html .= '<label><strong>Mailman List Password:</strong></label><br /><input type="text" name="cfwm_list_password" value="'.$list_password.'" />';
     65    $html .= '</td>';
     66    $html .= '</tr>';
     67   
     68    $html .= '</tbody>';
     69    $html .= '</table>';
     70
     71    $html .= '<input type="hidden" name="action" value="update" />';
     72    $html .= '<input type="hidden" name="page_options" value="cfwm_list_name,cfwm_mailman_url,cfwm_list_password" />';
     73    $html .= '<input type="submit" name="Submit" value="Update" /></form></div>';
     74
     75    $html .= '<pre>';
     76
     77    echo $html;
     78}
    2479
    2580// Prevent direct script access
     
    4297    echo '<p>';
    4398    echo 'Subscribe to mailing list?<br />';
    44     echo '<input type="checkbox" name="cf-subscribe" checked />';
     99    echo '<input type="checkbox" name="cf-subscribe" />';
    45100    echo '</p>';
    46101    echo '<p>';
  • contact-form-with-mailman/trunk/readme.txt

    r1202514 r1284898  
    33Tags: contact,contact us,comment,mailman,form,contact form,comment form,Post,plugin,posts,shortcode,page
    44Requires at least: 3.1.0
    5 Tested up to: 4.2.2
     5Tested up to: 4.3.1
    66Stable tag: trunk
    77License: GPLv2 or later
     
    18183. Search for 'Contact Form with Mailman'
    19194. Click 'Activate'
    20 5. Click on 'Edit' under 'Contact Form with Mailman'
    21 6. Just under the plugin info there is a config function with 3 variables. Fill this in to match your mailman mailing list.
    22 7. Click 'Update File'
     205. Click on 'Mailman Settings' on the left.
     216. Fill in the 3 fields to match your mailman mailing list.
     227. Click 'Update'
    23238. Add the short code '[mailman_contact_form]' to any page or post you would like the form to display on.
    2424
     
    2929A: At the moment no but this will be coming in a future release.
    3030
     31Q: Will upgrading from version 1.x to version 2.x break it?
     32A: Yes! In version 1.x the mailman list information was stored in the main php file. With version 2.x the mailman list information is now accessable through the Wordpress Admin menu. Because version 2.x is looking for the list info in a different spot you will need to update the settings in the Wordpress Admin.
     33
    3134== Screenshots ==
    32351. This is what the output looks like.
    3336
     37== Upgrade Notice ==
     38= 2.0.0 =
     39In version 1.x the mailman list information was stored in the main php file. With version 2.x the mailman list information is now accessable through the Wordpress Admin menu. Because version 2.x is looking for the list info in a different spot you will need to update the settings in the Wordpress Admin.
     40
    3441== Changelog ==
     42= 2.0.0 =
     43* All config options are now available in the Wordpress Admin
     44
    3545= 1.1.2 =
    3646* Subscribe to mailing list checkbox is now checked by default.
Note: See TracChangeset for help on using the changeset viewer.