예제 #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;
 }
예제 #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);
     }
 }
예제 #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);
     }
 }
예제 #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;
}
예제 #5
0
     //
     //	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.';
     }
     print "<p><strong>Latest mailing list activity:</strong>  <em>{$lastMessage}</em></p>";
 } else {
     print '<p><em>Unable to retrieve your lists with this key!</em>  Did you paste it in correctly?  Visit <a href="?page=autochimp.php&tab=api_key">the API Key tab</a> and try again, just in case.  If you know it is correct, make sure you\'re connected to the internet and not working offline.</p>';