images
4 months ago
templates
4 months ago
templates-provider
4 months ago
EditUser.php
6 years ago
admin.php
2 months ago
interim.php
6 years ago
style.css
4 months ago
upgrader.php
2 months ago
EditUser.php
72 lines
| 1 | <?php |
| 2 | /** @var $user WP_User */ |
| 3 | ?> |
| 4 | |
| 5 | <?php foreach (NextendSocialLogin::$enabledProviders AS $provider): ?> |
| 6 | <?php |
| 7 | $settings = $provider->settings; |
| 8 | if (!$provider->isUserConnected($user->ID)) continue; |
| 9 | $hasData = false; |
| 10 | ob_start(); |
| 11 | ?> |
| 12 | |
| 13 | <h2><?php echo $provider->getLabel(); ?></h2> |
| 14 | |
| 15 | <table class="form-table"> |
| 16 | <tbody> |
| 17 | <?php foreach ($provider->getSyncFields() AS $fieldName => $fieldData): ?> |
| 18 | <tr> |
| 19 | <?php |
| 20 | $meta_key = $settings->get('sync_fields/fields/' . $fieldName . '/meta_key'); |
| 21 | $value = get_user_meta($user->ID, $meta_key, true); |
| 22 | if (isset($value) && $value !== '') { |
| 23 | ?> |
| 24 | <th><label><?php echo $fieldData['label'] ?></label></th> |
| 25 | <td> |
| 26 | <?php |
| 27 | |
| 28 | $unSerialized = maybe_unserialize($value); |
| 29 | if (is_array($unSerialized) || is_object($unSerialized)) { |
| 30 | |
| 31 | echo "<pre>"; |
| 32 | print_r(formatUserMeta((array)$unSerialized)); |
| 33 | |
| 34 | echo "</pre>"; |
| 35 | } else { |
| 36 | echo esc_html($value); |
| 37 | } |
| 38 | $hasData = true; |
| 39 | ?> |
| 40 | </td> |
| 41 | <?php |
| 42 | } |
| 43 | ?> |
| 44 | </tr> |
| 45 | <?php endforeach; ?> |
| 46 | |
| 47 | </tbody> |
| 48 | </table> |
| 49 | <?php |
| 50 | if ($hasData) { |
| 51 | echo ob_get_clean(); |
| 52 | } else { |
| 53 | ob_end_clean(); |
| 54 | } |
| 55 | ?> |
| 56 | <?php endforeach; ?> |
| 57 | |
| 58 | <?php |
| 59 | |
| 60 | function formatUserMeta($user_meta, $level = '') { |
| 61 | $formatted_usermeta = ''; |
| 62 | if (is_array($user_meta)) { |
| 63 | foreach ($user_meta as $meta_key => $meta_value) { |
| 64 | $formatted_usermeta .= formatUserMeta($meta_value, $level . '[' . $meta_key . ']'); |
| 65 | } |
| 66 | } else { |
| 67 | $formatted_usermeta .= "\n" . $level . ' = ' . $user_meta; |
| 68 | } |
| 69 | |
| 70 | return $formatted_usermeta; |
| 71 | } |
| 72 |