foreach ($urlList as $url) {
// If there's no input for an existing url record
- if (!isset($_REQUEST['socialUrl'][$url['social']]) || trim($_REQUEST['socialUrl'][$url['social']]) == '') {
+ if ( !isset($_REQUEST['socialUrl'][$url['social']])
+ || trim($_REQUEST['socialUrl'][$url['social']]) == ''
+ ) {
// delete record here
$this->wpdb->delete(
foreach ($socialList as $socialData) {
// Was there any input for this social media type
- if (isset($_REQUEST['socialUrl'][$socialData['id']]) && trim($_REQUEST['socialUrl'][$socialData['id']]) != '') {
+ if ( isset($_REQUEST['socialUrl'][$socialData['id']])
+ && trim($_REQUEST['socialUrl'][$socialData['id']]) != ''
+ ) {
$url = $_REQUEST['socialUrl'][$socialData['id']];
$this->wpdb->update(
$this->table,
array('url' => $url),
- array( 'ref_type' => $this->config['ref_type_numb']['MemberInfo'], 'ref_dest' => $memberID, 'social' => $socialData['id']),
+ array(
+ 'ref_type' => $this->config['ref_type_numb']['MemberInfo'],
+ 'ref_dest' => $memberID,
+ 'social' => $socialData['id']
+ ),
array('%s'),
array('%d', '%d', '%s' )
);
--- /dev/null
+<?php
+/**
+ * list.php
+ *
+ * This the Member Social plugin model for front end output of members social urls
+ */
+require_once(GLM_MEMBERS_SOCIAL_PLUGIN_CLASS_PATH.'/data/dataSocialUrls.php');
+class GlmMembersFront_social_list extends GlmDataSocialUrls
+{
+ public $wpdb;
+ public $config;
+
+ /**
+ * __construct
+ *
+ * @param mixed $wpdb The main Word Press DB Object
+ * @param mixed $config The main Config
+ *
+ * @access public
+ * @return void
+ */
+ public function __construct($wpdb, $config)
+ {
+ $this->wpdb = $wpdb;
+ $this->config = $config;
+
+ parent::__construct(false, false);
+ }
+
+ /**
+ * modelAction
+ *
+ * @param bool $actionData Action Data passed to the modelAction
+ *
+ * @access public
+ * @return void
+ */
+ public function modelAction($actionData = false)
+ {
+ $status = null;
+ $action = '';
+ $settings = $urlList = array();
+ $view = 'list.html';
+
+ $memberID = filter_var( $actionData['request']['id'], FILTER_VALIDATE_INT);
+ if ($memberID) {
+ $urlList = $this->getList("ref_dest = " . $memberID);
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'socials' => $urlList,
+ 'memberID' => $memberID,
+ );
+
+ error_reporting(E_ALL ^ E_NOTICE);
+ return array(
+ 'status' => $status,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'front/social/' . $view,
+ 'data' => $templateData,
+ 'settings' => $settings
+ );
+ }
+}
*
* *** Also note that parameters will be in the context of the main front controller constructor. ***
*/
+if (isset($this->config['addOns']['glm-member-db'])) {
+ // Add internal page content links to member detail page
+ add_filter('glm-member-db-front-members-social-list', function($content, $id) {
+ $socialData = do_shortcode('[glm-members-social-list id='.$id.']');
+ $content .= $socialData;
+ return $content;
+ },
+ 10,
+ 2
+ );
+}
*/
$glmMembersSocialShortcodes = array(
+ 'glm-members-social-list' => array(
+ 'plugin' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG,
+ 'menu' => 'social',
+ 'action' => 'list',
+ 'table' => false,
+ 'attributes' => array(
+ 'id' => false
+ )
+
+ ),
);
-$glmMembersSocialShortcodesDescription = '';
+$glmMembersSocialShortcodesDescription = '<tr>
+ <th>[glm-members-social-list]</th>
+ <td> </td>
+ <td width="50%">
+ Displays a list of social url\'s.
+ </td>
+ </tr>';
)
),
'frontActions' => array(
-/*
'social' => array(
'list' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG,
- 'detail' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG
+ // 'detail' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG
)
-*/
)
);
-?>
\ No newline at end of file
+?>
<form action="{$thisUrl}?page={$thisPage}&glm_action=social&member={$memberID}" method="post" enctype="multipart/form-data">
<input type="submit" class="button glm-button submit" value="submit" name='submit'>
<input type="hidden" name="option" value="submit">
+ {foreach from=$socials key=k item=socialItem}
+ {if !$socialItem.active.value}
+ <input type="hidden" name="socialUrl[{$socialItem.id}]" value="{if isset($socialItem.url)}{$socialItem.url}{/if}">
+ {/if}
+ {/foreach}
<table class="wp-list-table striped glm-admin-table">
<tr><th>Social Media Type</th><th>Icon</th><th>URL</th></tr>
{foreach from=$socials key=k item=socialItem}
- {if $socialItem.active}
+ {if $socialItem.active.value}
{$socialField = $socialItem.name|lower}
<tr>
<th>
--- /dev/null
+{if $memberID}
+ {foreach $socials as $social}
+ <a href="{$social.url}" target="_blank" title="{$social.social_name}">
+ <img alt="{$social.social_name}" src="data:image/png;base64,{$social.social_b64icon}">
+ </a>
+ {/foreach}
+{/if}