/** * Add a "PMP Pushed" date to the meta actions box. * * @param $post object the WP_Post object to use for rendering the PMP last modified meta info. * @since 0.2 */ function pmp_last_modified_meta($post) { // Only show meta if this post came from the PMP $pmp_guid = get_post_meta($post->ID, 'pmp_guid', true); $pmp_mod = get_post_meta($post->ID, 'pmp_modified', true); if (empty($pmp_guid)) { return; } // Format similar to WP's published date $pmp_local = get_date_from_gmt(date('Y-m-d H:i:s', strtotime($pmp_mod)), 'M n, Y @ G:i'); ?> <div id="pmp-publish-meta"> <div class="misc-pub-section curtime"> <span id="timestamp">PMP guid: <b><a target="_blank" href="<?php echo pmp_get_support_link($pmp_guid); ?> "><?php echo substr($pmp_guid, 0, 8); ?> <span class="ext-link dashicons dashicons-external"></span></a></b></span> </div> <div class="misc-pub-section curtime"> <span id="timestamp">PMP modified: <b><?php echo $pmp_local; ?> </b></span> </div> </div> <?php }
/** * Static field for currently connected user * * @since 0.3 */ function pmp_user_title_input() { $options = get_option('pmp_settings'); if (empty($options['pmp_api_url']) || empty($options['pmp_client_id']) || empty($options['pmp_client_secret'])) { echo '<p><em>Not connected</em></p>'; } else { try { $sdk = new SDKWrapper(); $me = $sdk->fetchUser('me'); $title = $me->attributes->title; $link = pmp_get_support_link($me->attributes->guid); echo "<p><a target='_blank' href='{$link}'>{$title}</a></p>"; } catch (\Pmp\Sdk\Exception\AuthException $e) { echo '<p style="color:#a94442"><b>Unable to connect - invalid Client-Id/Secret</b></p>'; } catch (\Pmp\Sdk\Exception\HostException $e) { echo '<p style="color:#a94442"><b>Unable to connect - ' . $options['pmp_api_url'] . ' is unreachable</b></p>'; } } }