Plugin Directory

Changeset 2253843


Ignore:
Timestamp:
03/03/2020 07:57:10 PM (6 years ago)
Author:
virtualinc
Message:

Added Formassembly integration

Location:
vforce-extensions/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • vforce-extensions/trunk/README.md

    r2253675 r2253843  
    11=== Plugin Name ===
    2 Contributors: iliveinaterminal
     2Contributors: Mike Conrad
    33Donate link: https://virtualinc.com
    4 Tags: comments, spam
     4Tags: vforce, salesforce, formassembly, virtual
    55Requires at least: 3.0.1
    66Tested up to: 3.4
    7 Stable tag: 4.3
     7Stable tag: 2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     10
    1011
    1112Vforce helper tool.  To be used by any organization on the Vforce platform.
     
    1819
    1920## Changelog
     21
     22### 1.1
     23* Added Formassembly integration.  Now you can simply insert the <code>[vforce_form formid='id']</code> shortcode into a page or post.  If you have issues with the form displaying, make sure that the id is in single qoutes.  The server url defaults to https://virtual.tfaforms.net.  You can change this under VForce Settings->Formassembly Settings.  This plugin will not override or interfere with the official Formassembly plugin.
    2024
    2125### 1.0
  • vforce-extensions/trunk/README.txt

    r2253675 r2253843  
    11=== Plugin Name ===
    2 Contributors: enxoco
     2Contributors: Mike Conrad
    33Donate link: https://virtualinc.com
    4 Tags: vforce, salesforce, formassembly
     4Tags: vforce, salesforce, formassembly, virtual
    55Requires at least: 3.0.1
    66Tested up to: 3.4
    7 Stable tag: 4.3
     7Stable tag: 2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1818
    1919== Changelog ==
     20### 1.1
     21* Added Formassembly integration.  Now you can simply insert the <code>[vforce_form formid='id']</code> shortcode into a page or post.  If you have issues with the form displaying, make sure that the id is in single qoutes.  The server url defaults to https://virtual.tfaforms.net.  You can change this under VForce Settings->Formassembly Settings.  This plugin will not override or interfere with the official Formassembly plugin.
     22
     23### 1.0
     24* Removed Plugin update checker
     25* Submitted to Wordpress Plugins Repo
     26* Added ACF dependency to allow for adding an Association ID override metabox to all pages/posts.
     27* All pages/posts now have an Association ID override box.  By default this box is empty.  There is a hook that runs just before each page is loaded.  This function is in the main plugin file.  It checks to see if a value has been set in the override box.  If so, it will use the value in the override meta box as the global association id, if not it will use the default site wide Association ID/
     28
     29// This function runs just before the requested page is loaded
     30add_action('template_redirect', 'vforce_hook_before_page_load');
     31function vforce_hook_before_page_load(){
     32  $vforce_helper = get_option('vforce_helper');
     33
     34    wp_enqueue_script( 'init-global', plugin_dir_url( __FILE__ ) . 'inc/js/init-global.js', array('jquery'), '1.0', true );
     35    /*
     36     Setting the association ID variable
     37     Check to see if a value has been entered into the Association Id override metabox of the page.
     38     If so, inject that into our init-global.js as the associationId variable.  If it has not been set,
     39     we then use the value entered into the plugin settings.
     40     The code for the metabox is in functions.php
     41    */
     42     wp_localize_script( 'init-global', 'associationId', (get_post_meta( get_the_ID(), 'vforce-metabox-settings-association_id', true) != "") ? get_post_meta( get_the_ID(), 'vforce-metabox-settings-association_id', true) : $vforce_helper['variable']['association-id']);
     43}
     44
     45* vforce_helper is now a multidimensional array.
     46
     47vforce_helper.variable
     48{association-id: "a00f400000VQ8E6AAL"}
     49vforce_helper.script
     50{formidable_add-to-cart: "true", fa_web-to-case: "true"}
    2051
    2152= 0.6 =
  • vforce-extensions/trunk/inc/admin-page.php

    r2253675 r2253843  
    5858   -->
    5959    <li id="li-for-panel-3">
    60         <label class="panel-label" for="panel-3-ctrl">Form Assembly Settings</label>
     60        <label class="panel-label" for="panel-3-ctrl">Formassembly Settings</label>
    6161    </li>
    6262    <label id="close-nav-label" for="nav-ctrl">Close</label>
     
    9393        <section id="panel-3">
    9494            <main>
    95             <?php vforce_create_input_element('Enable Web To Case Script', '', 'checkbox', 'fa_web-to-case', 'script') ;?>
    96             <?php vforce_create_input_element('Enable Ballot Hiding', '', 'checkbox', 'fa_ballot-hiding', 'script') ;?>
    97 
    98                 <hr class="mb-3">
    99                 <hr class="mb-3">
    100                 <div class="form-group-row my-3">
    101                     <?php wp_editor(get_option('form_assembly_ballot-message', $defaultBallotMessage), 'editFormAssemblyBallot', $wp_editor_settings); ?>
    102                     <a class="btn btn-primary" onclick="updateFormAssemblyBallotMessage()">Save</a>
     95            <?php vforce_create_input_element('Server Url', '', 'text', 'formassembly-server-url', 'variable') ;?>
    10396                </div>
    10497            </main>
  • vforce-extensions/trunk/inc/functions.php

    r2253675 r2253843  
    44*
    55*/
     6
    67function vforce_create_input_element($label, $placeholder, $inputType, $id, $optionType) {
    78    global $vforce_options;
     
    5657            <small>Enter the selector that identifies the hidden input that you want to hold the association id.  ie. <i>#tfa_34</i></small>   
    5758            <br>
    58 
     59            <br>
     60<!--
     61            <label for="form_assembly_form_id">Formassembly Form Id</label>
     62            <input name="form_assembly_form_id" type="text" value="<?php echo esc_html(get_post_meta($object->ID, "form_assembly_form_id", true)); ?>">
     63-->
    5964
    6065        </div>
     
    97102    update_post_meta($post_id, "form_assembly_hidden_input_id", $vforce_form_assembly_hidden_id);
    98103
     104    if(isset($_POST["form_assembly_form_id"]))
     105    {
     106        $vforce_form_assembly_hidden_id = sanitize_text_field($_POST["form_assembly_form_id"]);
     107    }   
     108    update_post_meta($post_id, "form_assembly_form_id", $vforce_form_assembly_hidden_id);
    99109}
    100110
  • vforce-extensions/trunk/vforce-extensions.php

    r2253675 r2253843  
    2828include 'inc/functions.php';
    2929include 'inc/admin-page.php';
     30include 'inc/formassembly_shortcodes.php';
    3031
    3132global $vforce_helper;
     
    123124
    124125}
    125   add_action('admin_enqueue_scripts', 'vforce_load_bootstrap_js');
     126add_action('admin_enqueue_scripts', 'vforce_load_bootstrap_js');
    126127
    127 
    128 ?>
    129 
    130 <?php
    131128add_action( 'admin_footer', 'vforce_process_setting_update_ajax' ); // Write our JS below here
    132129
     
    194191      'status' => 'Success'
    195192    );
    196     echo json_encode($response);
     193    return json_encode($response);
    197194 
    198195    wp_die(); // this is required to terminate immediately and return a proper response
Note: See TracChangeset for help on using the changeset viewer.