Ejemplo n.º 1
0
 public function GenerateMappingsUI($tableWidth, $mergeVars)
 {
     // Need to query data in the BuddyPress extended profile table
     global $wpdb;
     $wishlist_table_name = $wpdb->prefix . 'wlm_options';
     $sql = "SELECT option_name,option_value FROM {$wishlist_table_name} WHERE `option_name` LIKE 'CUSTOMREGFORM-%' ORDER BY `option_name` ASC";
     $fields = $wpdb->get_results($sql, ARRAY_A);
     // Create a hidden field just to signal that the user can save their preferences
     print '<br />' . PHP_EOL . '<input type="hidden" name="wishlist_running" />' . PHP_EOL;
     if ($fields) {
         foreach ($fields as $field) {
             $data = unserialize($field['option_value']);
             $formFields = explode(',', $data['fields']);
             $rowCode = '';
             foreach ($formFields as $formField) {
                 // Skip firstname and lastname.  Those are handled automatically.
                 // Having them here will just confuse people and will certainly
                 // mess things up if the user has multiple forms.
                 if ($this->FilterUnusedFields($formField)) {
                     continue;
                 }
                 // Generate a select box for this particular field
                 $fieldNameTag = AC_EncodeUserOptionName(AUTOCHIMP_WISHLIST_MEMBER_DB_FIELD_MAPPING, $formField);
                 $selectBox = AC_GenerateSelectBox($fieldNameTag, WP88_IGNORE_FIELD_TEXT, $mergeVars);
                 $rowCode .= '<tr class="alternate">' . PHP_EOL . '<td width="65%">' . $formField . '</td>' . PHP_EOL . '<td width="35%">' . $selectBox . '</td>' . PHP_EOL . '</tr>' . PHP_EOL;
             }
             $formName = $data['form_name'];
             print AC_GenerateFieldMappingCode("Wishlist Form '{$formName}'", $rowCode);
             print '<br />';
         }
     }
     return $finalText;
 }
Ejemplo n.º 2
0
 public function GenerateMappingsUI($tableWidth, $mergeVars)
 {
     // This data is serializd but get_option will unserialize it, it seems.
     $fields = get_option(WP_MEMBERS_FIELDS);
     if (FALSE !== $fields) {
         // The data is an array of arrays.  Each array represents a field.  The elements:
         //
         // 0 - Order #
         // 1 - Caption text
         // 2 - Name of the option (we care about this)
         // 3 - Option type (we care about this)
         //
         // There are other items as well which are described below as needed.
         print '<br />' . PHP_EOL . '<input type="hidden" name="wpmembers_running" />' . PHP_EOL;
         foreach ($fields as $field) {
             // Check that there's a string.  Sometimes WP-Members will have
             // empty arrays.
             if (0 == strlen($field[2])) {
                 continue;
             }
             // Generate a select box for this particular field
             $fieldNameTag = AC_EncodeUserOptionName(WP_MEMBERS_FIELD_DB_MAPPING, $field[2]);
             $selectBox = AC_GenerateSelectBox($fieldNameTag, WP88_IGNORE_FIELD_TEXT, $mergeVars);
             $rowCode .= '<tr class="alternate">' . PHP_EOL . '<td width="65%">' . $field[2] . '</td>' . PHP_EOL . '<td width="35%">' . $selectBox . '</td>' . PHP_EOL . '</tr>' . PHP_EOL;
         }
         print AC_GenerateFieldMappingCode('WP-Members', $rowCode);
     }
 }
Ejemplo n.º 3
0
 public function GenerateMappingsUI($tableWidth, $mergeVars)
 {
     // Need to query data in the BuddyPress extended profile table
     global $wpdb;
     // Temporary variable for helping generate UI
     $rowCode = $finalText = '';
     $xprofile_table_name = $wpdb->prefix . 'bp_xprofile_fields';
     $fields = $wpdb->get_results("SELECT name,type FROM {$xprofile_table_name} WHERE type != 'option'", ARRAY_A);
     // Create a hidden field just to signal that the user can save their preferences
     print '<br />' . PHP_EOL . '<input type="hidden" name="buddypress_running" />' . PHP_EOL;
     if ($fields) {
         foreach ($fields as $field) {
             // Generate a select box for this particular field
             $fieldNameTag = AC_EncodeUserOptionName(WP88_BP_XPROFILE_FIELD_MAPPING, $field['name']);
             $selectBox = AC_GenerateSelectBox($fieldNameTag, WP88_IGNORE_FIELD_TEXT, $mergeVars);
             $rowCode .= '<tr class="alternate">' . PHP_EOL . '<td width="65%">' . $field['name'] . '</td>' . PHP_EOL . '<td width="35%">' . $selectBox . '</td>' . PHP_EOL . '</tr>' . PHP_EOL;
         }
         print AC_GenerateFieldMappingCode('BuddyPress', $rowCode);
     }
 }
Ejemplo n.º 4
0
function AC_GenerateCimyMappingsUI($tableWidth, $mergeVars)
{
    // Need to query data in the BuddyPress extended profile table
    global $wpdb;
    // Temporary variable for helping generate UI
    $rowCode = $finalText = '';
    $cimy_table_name = $wpdb->prefix . 'cimy_uef_fields';
    $sql = "SELECT NAME,TYPE FROM {$cimy_table_name}";
    $fields = $wpdb->get_results($sql, ARRAY_A);
    // Create a hidden field just to signal that the user can save their preferences
    $finalText = '<br />' . PHP_EOL . '<input type="hidden" name="cimy_running" />' . PHP_EOL;
    if ($fields) {
        foreach ($fields as $field) {
            // Generate a select box for this particular field
            $fieldNameTag = AC_EncodeUserOptionName(WP88_CIMY_FIELD_MAPPING, $field['NAME']);
            $selectBox = AC_GenerateSelectBox($fieldNameTag, WP88_IGNORE_FIELD_TEXT, $mergeVars);
            $rowCode .= '<tr class="alternate">' . PHP_EOL . '<td width="65%">' . $field['NAME'] . '</td>' . PHP_EOL . '<td width="35%">' . $selectBox . '</td>' . PHP_EOL . '</tr>' . PHP_EOL;
        }
        $finalText .= AC_GenerateFieldMappingCode('Cimy', $rowCode);
    }
    return $finalText;
}
Ejemplo n.º 5
0
 if (empty($mergeVars)) {
     print "<p><em><strong>Problem: </strong>AutoChimp could not retrieve your MailChimp Merge Variables. Make sure you have a selected mailing list.</em></p>";
 }
 //
 //	Start:	Generate a table for WordPress mappings
 //
 global $wpUserDataArray;
 foreach ($wpUserDataArray as $userField) {
     $fieldNameTag = AC_EncodeUserOptionName(WP88_WORDPRESS_FIELD_MAPPING, $userField);
     $selectBox = AC_GenerateSelectBox($fieldNameTag, WP88_IGNORE_FIELD_TEXT, $mergeVars);
     $output .= '<tr class="alternate">' . PHP_EOL . '<td width="65%">' . $userField . '</td>' . PHP_EOL . '<td width="35%">' . $selectBox . '</td>' . PHP_EOL . '</tr>' . PHP_EOL;
 }
 // This static field used to belong to the BuddyPress Sync UI, but has since
 // been moved to the main UI.  It's still represented by a DB value that makes
 // it look like it belongs to BuddyPress, so heads up.
 $selectBox = AC_GenerateSelectBox(WP88_MC_STATIC_FIELD, WP88_IGNORE_FIELD_TEXT, $mergeVars);
 $staticText = get_option(WP88_MC_STATIC_TEXT);
 $output .= '<tr class="alternate"><td width="65%">Static Text: <input type="text" name="static_select" value="' . $staticText . '"size="18" /></td><td width="30%">' . $selectBox . '</td></tr>';
 $tableCode = AC_GenerateFieldMappingCode('WordPress', $output);
 print $tableCode;
 //
 // END:		Generate a table for WordPress Mappings
 //
 // Show UI for any active AutoChimp plugins
 $syncPlugins = new ACSyncPlugins();
 $syncPlugins->GenerateMappingsUI($tableWidth, $mergeVars);
 // Show the user the last message
 $lastMessage = get_option(WP88_MC_LAST_MAIL_LIST_ERROR);
 if (empty($lastMessage)) {
     $lastMessage = 'No mailing list activity yet.';
 }
Ejemplo n.º 6
0
function AC_GenerateCategoryMappingRow($index, $selectPrefix, $categories, $selectedCat, $lists, $selectedList, $javaScript, $groups, $selectedGroup, $templates, $selectedTemplate)
{
    $out = '<tr><td>' . PHP_EOL;
    $selectBox = AC_GenerateSelectBox($selectPrefix . $index . WP88_CATEGORY_SUFFIX, WP88_ANY, $categories, $selectedCat);
    $out .= $selectBox . '</td>' . PHP_EOL . '<td>campaigns go to</td><td>';
    // Assemble the final Javascript
    $groupSelectName = $selectPrefix . $index . WP88_GROUP_SUFFIX;
    $javaScript .= "switchInterestGroups('{$groupSelectName}',this.value,groupsHash);\"";
    $selectBox = AC_GenerateSelectBox($selectPrefix . $index . WP88_LIST_SUFFIX, WP88_NONE, $lists, $selectedList, $javaScript);
    $out .= $selectBox . '</td>' . PHP_EOL . '<td>and group</td><td>';
    // Start assembling the group select box
    $selectBox = AC_GenerateSelectBox($groupSelectName, WP88_ANY, $groups[$selectedList], $selectedGroup);
    $out .= $selectBox . '</td>' . PHP_EOL . '<td>using</td><td>';
    // Assemble the final select box - templates
    $selectBox = AC_GenerateSelectBox($selectPrefix . $index . WP88_TEMPLATE_SUFFIX, WP88_NONE, $templates, $selectedTemplate);
    $out .= $selectBox . '</td>' . PHP_EOL;
    // Create the delete button
    $out .= '<td><button type="submit" name="' . $selectPrefix . $index . WP88_DELETE_MAPPING_SUFFIX . '" value="' . $selectPrefix . $index . '" onClick="return confirm(\'Are you sure?\');">X</button></td></tr>';
    return $out;
}
Ejemplo n.º 7
0
     $categoryOptionName = AC_EncodeUserOptionName(WP88_CATEGORY_LIST_MAPPING, $category->name);
     $categoryOptionGroupName = $categoryOptionName . WP88_CATEGORY_GROUP_SUFFIX;
     $categoryOptionTemplateName = $categoryOptionName . WP88_CATEGORY_TEMPLATE_SUFFIX;
     // Assemble the final Javascript
     $finalJavaScript = $javaScript . "switchInterestGroups('{$categoryOptionGroupName}',this.value,intGroupHash);\"";
     // Assemble the first select box's HTML
     print '<tr><td><em>' . $category->name . '</em> campaigns go to</td>' . PHP_EOL . '<td>';
     $selectBox = AC_GenerateSelectBox($categoryOptionName, WP88_NO_MAILING_LIST, $listHash, $finalJavaScript);
     print $selectBox . '</td>' . PHP_EOL;
     // Start assembling the second select box
     print '<td>and group</td><td>';
     $selectedlist = get_option($categoryOptionName);
     $selectBox = AC_GenerateSelectBox($categoryOptionGroupName, WP88_ANY_GROUP, $groupHash[$selectedlist]);
     print $selectBox . '</td>' . PHP_EOL;
     print '<td>using</td><td>';
     $selectBox = AC_GenerateSelectBox($categoryOptionTemplateName, WP88_NO_TEMPLATE, $templatesHash);
     print $selectBox . '</td></tr>' . PHP_EOL;
 }
 print '</table></fieldset></p>';
 // Create a checkbox asking the user if they want to send campaigns right away
 print '<p><input type=CHECKBOX value="on_send_now" name="on_send_now" ';
 if ('0' === $sendNow || empty($sendNow)) {
 } else {
     print 'checked';
 }
 print '> Send campaign <em>as soon as</em> a post is published. Not checking this option will save a draft version of your new MailChimp campaign.</p>';
 // Create a checkbox asking if the user wants to generate only excerpts
 print '<p><input type=CHECKBOX value="on_excerpt_only" name="on_excerpt_only"';
 if ('1' === $excerptOnly) {
     echo 'checked';
 }