Plugin Directory

Changeset 441437


Ignore:
Timestamp:
09/21/2011 12:57:08 PM (14 years ago)
Author:
mightyturtle
Message:

version 0.2 adds user interface improvements on the admin side

Location:
wp-e-commerce-style-email/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-e-commerce-style-email/trunk/functions.php

    r437441 r441437  
    55
    66global $ecse_email_content;
     7global $ecse_email_subject;
    78
    89
     
    1819
    1920
     21/**
     22 * Returns the subject of the email as formatted by WP E-Commerce.
     23 * @return String as generated by WP e-Commerce
     24 */
     25function ecse_get_email_subject() {
     26    global $ecse_email_subject;
     27    if(!is_string($ecse_email_subject)) $ecse_email_subject=''; //just to make sure it's a string
     28    return $ecse_email_subject;
     29}
     30
     31
    2032
    2133/**
     
    2840   
    2941    global $ecse_email_content;
     42    global $ecse_email_subject;
    3043    $ecse_email_content=''; //just in case. probably just being paranoid.
    3144   
     
    3750        case get_option( 'wpsc_trackingid_subject' ):
    3851        case __( 'The administrator has unlocked your file', 'wpsc' ):
    39             if(!get_option('ecse_is_active')) break;
     52            if(!get_option('ecse_is_active')) break; //we are in testing phase, don't do anything to customer emails.
    4053        case 'ECSE test email':
    4154            $ecse_email_content=str_ireplace("\n",'<br />',$message); //keep line-breaks in wp-e-commerce's content when moving to HTML
     55            $ecse_email_subject = $subject;
    4256            ob_start();
    4357            get_template_part('wpsc','email_style'); //the template page should output some stuff, and probabaly include a call to ecse_get_email_content()
     
    5064    }
    5165    $ecse_email_content=''; //clean up to reduce opportunities for data access outside the formatting template
     66    $ecse_email_subject='';
    5267   
    5368    return compact( 'to', 'subject', 'message', 'headers', 'attachments' );
  • wp-e-commerce-style-email/trunk/options_page.php

    r437441 r441437  
    99    width:400px;
    1010}
    11 .style-emails form#email-style-testing-form {
    12     border-top:solid 1px #cccccc;
     11.style-emails form#email-style-options-form {
     12    border-bottom:1px solid #CCCCCC;
    1313}
    1414.style-emails input {
    1515    margin-right:5px;
     16}
     17.style-emails textarea {
     18    width:400px;
     19    height:60px;
     20    margin-bottom:10px;
     21}
     22.style-emails form#email-style-wish-form input {
     23    display:inline-block;
     24}
     25.sent-message {
     26    color:red;
     27    margin-bottom:10px;
    1628}
    1729</style>
     
    2234    <h2>WP e-Commerce Style Emails</h2>
    2335   
    24     <form action="" method="post" id="email-style-options-form" name="email-style-options-form">
    25         <input type="checkbox" name="style-emails-active" id="style-emails-active" <?php if(get_option('ecse_is_active')) { echo 'checked="checked"';  }; ?> /><label for="style-emails-active">Style live customer emails</label>
    26         <input type="submit" value="Save" name="save-options-submit" />
     36    <br />
     37    <div style="width:400px">
     38        1. Create the 'wpsc-email_style.php' template file in your Wordpress theme.
     39        Here's a simple example of what you could put in it:<br />
     40        <br />
     41        <pre>
     42&lt;html>&lt;body>
     43&lt;h2>&lt;?php echo ecse_get_email_subject(); ?>&lt;/h2>
     44&lt;?php echo ecse_get_email_content(); ?>
     45&lt;/body>&lt;/html>
     46        </pre>
     47        2. Preview your styling.<br />
     48        <form action="" method="post" id="email-style-testing-form" name="email-style-testing-form">
     49            <input type="text" value="<?php bloginfo('admin_email'); ?>" name="send-email-address" />
     50            <input type="submit" value="Send a test styled email" name="send-email-submit" />
     51            <?php if(!empty($_POST['send-email-submit'])) echo '<span class="sent-message">Sent.</span>'; ?>
     52        </form>
     53        3. Turn on the live customer styling when you're satisfied.<br />
     54        <form action="" method="post" id="email-style-options-form" name="email-style-options-form">
     55            <input type="checkbox" name="style-emails-active" id="style-emails-active" <?php if(get_option('ecse_is_active')) { echo 'checked="checked"';  }; ?> /><label for="style-emails-active">Style live customer emails</label>
     56            <input type="submit" value="Save" name="save-options-submit" />
     57            <?php if(!empty($_POST['save-options-submit'])) echo '<span class="sent-message">Saved.</span>'; ?>
     58        </form>
     59    </div>
     60   
     61   
     62    <form action="" method="post" id="email-style-wish-form" name="email-style-wish-form">
     63        <h3>Contact this plugin's developer</h3>
     64        <?php if(!empty($_POST['send-wish-submit'])) echo '<div class="sent-message">Sent.</div>'; ?>
     65        <textarea name="send-wish-content">Write some constructive criticism or positive feedback</textarea>
     66        <input type="submit" value="Send" name="send-wish-submit" />
     67        or visit <a href="http://schwambell.com">his website</a>.
    2768    </form>
    2869   
    2970   
    3071   
    31     <form action="" method="post" id="email-style-testing-form" name="email-style-testing-form">
    32         <input type="text" value="<?php bloginfo('admin_email'); ?>" name="send-email-address" />
    33         <input type="submit" value="Send a styled email" name="send-email-submit" />
    34     </form>
    3572   
    3673</div>
  • wp-e-commerce-style-email/trunk/readme.txt

    r437441 r441437  
    44Requires at least: 3.2
    55Tested up to: 3.2.1
    6 Stable tag: 0.1
     6Stable tag: 0.2
    77
    88Style the emails that WP e-Commerce sends to your customers.
     
    1010== Description ==
    1111
    12     This plugin lets you style the emails that WP e-Commerce sends to your customers, using a simple theme template file.
    13 If you are using WP e-Commerce and want to make your automated customer emails a little more stylish, this is a good place to start.
    14 To use this plugin, you don't need to know how WP e-Commerce does its emailing.
    15 You do need to know how to edit your Wordpress theme, including what a theme template file is.
     12    This plugin lets you style the automated emails that WP e-Commerce sends to your customers, using a simple theme template file.
     13To use this plugin, you don't need to know how WP e-Commerce does its emailing, nor necessarily any php.
     14You DO need to know how to edit your Wordpress theme, including what a theme template file is.
    1615This plugin works with the WP e-Commerce customer emails for:
    1716
     
    2524It does NOT do anything to any other emails that Wordpress sends out (though this plugin could be adapted to do that).
    2625
    27 Create a template file in your theme named wpsc-email_style.php that generates the html email output.
    28 Use the template tag ecse_get_email_content() to dump WP e-Commerce's content into it (see the example below).
    2926You can adjust the content that WP e-Commerce creates for customer emails using the Admin tab of the Store settings.
    30 This plugin has an admin page where you can activate live email styling or send yourself a test styled email.
    31 Note that the format of your customer emails is now HTML, rather than the defaut plain text.
    32 In order to maintain readability, line breaks in the original content are automatically replaced with <br /> tags.
     27This plugin has an admin page where you can activate live email styling (after your private design testing) or send yourself a test styled email.
     28In order to maintain readability, line breaks in the original content are automatically replaced with &lt;br /> tags.
    3329
    34 Here's the simplest example of what you might put in the wpsc-email_style.php file:
     30Here's a simple example of what you might put in the wpsc-email_style.php theme template file:
    3531
    3632    <html><body>
     33    <h2><?php echo ecse_get_email_subject(); ?></h2>
    3734    <?php echo ecse_get_email_content(); ?><br />
    3835    </body></html>
    39 
     36 
     37 
    4038Of course, you'll want to add a lot more html, css and maybe even php to achieve your own style.
    41 You may want to consult the 'nets about how html works inside emails.
     39You may want to consult the 'nets about how html works inside emails. 
     40 
     41The plugin's other home on the web is over at <a href="http://schwambell.com/wp-e-commerce-style-email-plugin/">Schwambell</a>.
    4242
    4343
     
    47471. Install through the Wordpress 'Plugin' menu in Wordpress, or upload this plugin's folder to the `/wp-content/plugins/` directory
    48482. Activate the plugin through the 'Plugins' menu in WordPress
    49 3. Create the 'wpsc-email_style.php' template file and start styling.
    50 4. Go to the 'Store Email Style' options page and turn on the styling when you're done testing.
     493. Create the 'wpsc-email_style.php' template file in your theme and start styling.
     504. Go to the 'Store Email Style' options page and turn on the live customer styling when you're done testing.
    5151
    5252You probably need to have the WP e-Commerce plugin running on a Wordpress website for this plugin to be of use to you.
     
    5858
    5959If you haven't created the 'wpsc-email_style.php' template file and gone to work on it, this plugin will do nothing to your emails.
    60 Also, don't forget to go to the 'Store Email Style' options page and turn on the styling when you're done testing.
     60Also, don't forget to go to the 'Store Email Style' options page and turn on the live customer styling when you're done testing.
    6161
    6262= Can you help me with this? =
     
    7676After you've created your styling theme template file, you could:
    7777
    78 *   Create a fake customer with your email address on your e-Commerce website, and go through all the motions;
     78*   Create a fake customer with your email address on your e-Commerce website, and go through all the motions; or
    7979*   Go to the 'Store Email Style' options page and click to have a test styled email sent to you.
    8080
     
    8787== Changelog ==
    8888
     89= 0.2 =
     90* Improve admin settings page.
     91
    8992= 0.1 =
    9093* Initial public release.
    9194
    92 
  • wp-e-commerce-style-email/trunk/wp-e-commerce-style-email.php

    r437441 r441437  
    99Description: Style the emails that WP E-Commerce sends to your customers. Create a template file in your theme named wpsc-email_style.php that generates the email output, and use the template tag ecse_get_email_content() to dump WP E-Commerce's purchase report into it.
    1010Author: Jacob Schwartz
    11 Version: 0.1
     11Version: 0.2
    1212Author URI: http://schwambell.com
    1313*/
     
    4444
    4545/**
     46 * Add link to the settings page from the installed-plugins page
     47 * @param $links
     48 * @param $file
     49 * @return $links
     50 */
     51function add_settings_link($links,$file) {
     52    //$base = 'store-email-style-options';
     53    $base = plugin_basename(__FILE__);
     54    if($file==$base) {
     55        $links[] = '<a href="options-general.php?page=store-email-style-options">settings</a>';
     56    }
     57    return $links;
     58}
     59
     60add_filter('plugin_row_meta', 'add_settings_link',10,2);
     61
     62
     63
     64/**
    4665 * Load admin options page
    4766 * @return none
     
    6079    }
    6180   
     81    if(!empty($_POST['send-wish-submit'])) {
     82        $msg = $_POST['send-wish-content'].'
     83       
     84Sent from '.get_bloginfo('admin_email').' of '.get_bloginfo('siteurl');
     85        wp_mail('[email protected]','ECSE plugin wish',$msg);
     86    }
     87   
    6288    require_once('options_page.php');
    6389   
Note: See TracChangeset for help on using the changeset viewer.