Update for connections
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 25 Sep 2018 17:23:33 +0000 (13:23 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 25 Sep 2018 17:23:59 +0000 (13:23 -0400)
check logo's

models/admin/management/development.php
views/admin/management/development.html

index 58034d1..0adb63f 100644 (file)
@@ -152,6 +152,58 @@ class GlmMembersAdmin_management_development
 
             break;
 
+            case 'updateImages':
+                $sql = "
+                SELECT id,organization,options
+                  FROM ".$this->wpdb->prefix."connections
+                 WHERE options != ''
+                ORDER BY id";
+                $connection_members = $this->wpdb->get_results($sql, ARRAY_A);
+
+                foreach ( $connection_members as $member ) {
+                    // Update the email for the member_info record
+                    // Need to get the member_info id based on the ref_dest
+                    $options_data = unserialize( $member['options'] );
+                    if ( $options_data['logo'] ) {
+                        // echo '<pre>$options_data: logo ' . print_r( $options_data['logo'], true ) . '</pre>';
+                    } else if ( $options_data['image'] ) {
+                        // echo '<pre>$options_data: image ' . print_r( $options_data['image'], true ) . '</pre>';
+                    }
+                    $memberInfoId = $this->wpdb->get_var(
+                        $this->wpdb->prepare(
+                            "SELECT logo
+                               FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_info
+                              WHERE member = ( SELECT id
+                                                 FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members
+                                                 HERE old_member_id = %d
+                                            )",
+                            $member['id']
+                        )
+                    );
+                    echo '<pre>$memberInfoId: ' . print_r( $memberInfoId, true ) . '</pre>';
+                    // $email = '';
+                    // if ( is_array( $options_data ) ) {
+                    //     reset( $options_data );
+                    //     $eData = current( $options_data );
+                    //     $email = $eData['address'];
+                    // }
+                    // if ( $email ) {
+                    //     $this->wpdb->query(
+                    //         $this->wpdb->prepare(
+                    //             "UPDATE " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_info
+                    //                 SET email = %s
+                    //               WHERE member = ( SELECT id
+                    //                                  FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members
+                    //                                 WHERE old_member_id = %d
+                    //                                 )",
+                    //             $email,
+                    //             $member['id']
+                    //         )
+                    //     );
+                    // }
+                }
+                break;
+
             case 'import_connections':
 
                 // Load Member Info Data Class and get info data for later use
index eed511f..4360e60 100644 (file)
                         <a href="{$thisUrl}?page={$thisPage}&glm_action=development&option=updateEmails">Update Emails for Connection Import</a>
                     </p>
 
+                    <p>
+                        <a href="{$thisUrl}?page={$thisPage}&glm_action=development&option=updateImages">Update Images for Connection Import</a>
+                    </p>
+
                     <p>
                         <a href="{$thisUrl}?page={$thisPage}&glm_action=development&option=import_connections">Import data from "Connections" business directory</a>