Exemplo n.º 1
0
:</b>
				</span>
			</div>
		</div>
		<div class="row">		
			<div class="cell textalignleft ">
				<?php 
//issue #1234
if ($data['custom_field']['name'] == 'subscription_options') {
    $data['input_types'] = array('select' => 'Select (Drop down box)', 'radio' => 'Radio');
}
?>

				<select name="type" id="type">
					<?php 
echo mgm_make_combo_options($data['input_types'], $data['custom_field']['type'], MGM_KEY_VALUE);
?>

				</select>
			</div>
		</div>	
		
		<?php 
// issue #1239
if ($data['custom_field']['name'] != 'display_name') {
    ?>

		<div class="row displaynone">
			<div class="cell width120px">
				<span class="required-field">
					<b><?php 
Exemplo n.º 2
0
				</div>
	    		<div class="cell textalignleft">
		    		<input type="text" name="setting[mailchimp][apikey]" value="<?php 
echo $data['module']->setting['apikey'];
?>
"  size="40"/>
				</div>
			</div>
	  		<div class="row">
	    		<div class="cell width26 textalignleft">
		    		<b><?php 
_e('Opt-in', 'mgm');
?>
</b>
				</div>
	    		<div class="cell width2 textaligncenter">
		    		<b>:</b>
				</div>
	    		<div class="cell textalignleft">
					<select name="setting[mailchimp][double_optin]" class="width100px">
						<?php 
echo mgm_make_combo_options(array('1' => __('Double opt-in', 'mgm'), '0' => __('Single opt-in', 'mgm')), $data['module']->setting['double_optin'], MGM_KEY_VALUE);
?>

					</select>						
				</div>
			</div>
			
		</div>
	</div>		
</div>
Exemplo n.º 3
0
				</div>
	    		<div class="cell textalignleft">
					<input type="text" name="setting[icontact][specialid]" value="<?php 
echo $data['module']->setting['specialid'];
?>
"  size="40"/>
				</div>
			</div>
	  		<div class="row">
	    		<div class="cell width26 textalignleft">
		    		<b><?php 
_e('Doubleopt Id', 'mgm');
?>
</b>
				</div>
	    		<div class="cell width2 textaligncenter">
		    		<b>:</b>
				</div>
	    		<div class="cell textalignleft">
					<select name="setting[icontact][doubleopt]" class="width100px">
						<?php 
echo mgm_make_combo_options(array('1' => __('Yes', 'mgm'), '0' => __('No', 'mgm')), $data['module']->setting['doubleopt'], MGM_KEY_VALUE);
?>

					</select>						
				</div>
			</div>
		</div>	
		
	</div>
</div>
Exemplo n.º 4
0
	<div class="table">
  		<div class="row">
    		<div class="cell width30">
				<p><b><?php 
_e('Redirection Method', 'mgm');
?>
:</b></p>
    		</div>
		</div>
  		<div class="row">
    		<div class="cell width70">
				<p>
					<select name="redirection_method" class="width150px">
						<?php 
echo mgm_make_combo_options(array('header' => 'header', 'javascript' => 'javascript', 'meta' => 'meta'), $data['system_obj']->get_setting('redirection_method'), MGM_VALUE_ONLY);
?>
	
					</select>				
				</p>
				<p><div class="tips width90"><?php 
_e('Redirection method.<br/>Default: Wordpress wp_redirect<br/>Javascript: Javascript redirection<br/>Meta: Html Meta tag redirection', 'mgm');
?>
</div></p>				
    		</div>
		</div>
	</div>	
	<?php 
mgm_box_bottom();
?>
/**
 * the meta box for post/page purchase
 *
 */
function mgm_post_setup_meta_box_form($post)
{
    // get object
    $post_obj = mgm_get_post($post->ID);
    $datepickerformat = mgm_get_datepicker_format();
    // set default price
    if ($post_obj->purchase_cost == 0) {
        if (mgm_get_module('mgm_paypal', 'payment')->setting['purchase_price']) {
            $post_obj->purchase_cost = mgm_get_module('mgm_paypal', 'payment')->setting['purchase_price'];
        } else {
            $post_obj->purchase_cost = mgm_get_class('system')->setting['post_purchase_price'];
        }
    }
    // protect
    $protect_content = mgm_protect_content();
    //issue#: 414(changed id submitpost => submitpost_member for the below div )
    ?>

	<div class="submitbox" id="submitpost_member">	
		<div class="misc-pub-section">
			<p id="howto">
				<?php 
    _e('Select which membership types will have access to read this post/page.', 'mgm');
    ?>

				<?php 
    _e('Note: The private parts of the post should be inside the following tags: <strong>[private]</strong> <em>your text</em> <strong>[/private]</strong>', 'mgm');
    ?>

			</p>
			<p>
				<div class="mgm_post_setup_meta_box_div">
					<input type="checkbox" name="check_all" value="mgm_post[access_membership_types][]" /> <span><?php 
    _e('Select all', 'mgm');
    ?>
</span>
				</div>
			</p>
			<p>
				<?php 
    echo mgm_make_checkbox_group('mgm_post[access_membership_types][]', mgm_get_class('membership_types')->get_membership_types(), $post_obj->access_membership_types, MGM_KEY_VALUE);
    ?>
				
			</p>
			<?php 
    if ($protect_content == false) {
        ?>

			<div class="information mgm_width_230px"><?php 
        echo sprintf(__('<a href="%s">Content Protection</a> is <b>%s</b>. Make sure its enabled to Protect Post/Page.', 'mgm'), 'admin.php?page=mgm/admin', $protect_content ? 'enabled' : 'disabled');
        ?>
</div>			
			<?php 
    }
    ?>

		</div>	
		
		<div class="misc-pub-section">
			<b><?php 
    _e('Pay Per Post', 'mgm');
    ?>
:</b>
			<a href="#payperpost" class="mgm-toggle"><?php 
    _e('Edit');
    ?>
</a>
			<div id="payperpostdiv" class="hide-if-js">
				<div class="mgm_padding_5px">				
					<p class="postpurhase-heading"><?php 
    _e('Purchasable Settings', 'mgm');
    ?>
:</p>
					<ul class="mgm_post_setup_meta_box_ul">
						<li>
							<label><?php 
    _e('If the user doesn\'t have access, is this post/page available to buy?', 'mgm');
    ?>
</label><br/>	
							<input type="radio" class="radio" name="mgm_post[purchasable]" value='N' <?php 
    mgm_check_if_match('N', $post_obj->purchasable);
    ?>
/>
							<label><?php 
    _e('No', 'mgm');
    ?>
</label>
							<input type="radio" class="radio" name="mgm_post[purchasable]" value='Y' <?php 
    mgm_check_if_match('Y', $post_obj->purchasable);
    ?>
/> 
							<label><?php 
    _e('Yes', 'mgm');
    ?>
</label>
						</li>
						<li>
							<label><?php 
    _e('Cost of Post?', 'mgm');
    ?>
 </label><br>
							<input type="text" name="mgm_post[purchase_cost]" class="mgm_width_55px" value="<?php 
    echo $post_obj->purchase_cost;
    ?>
"/> <?php 
    echo mgm_get_setting('currency');
    ?>
							
						</li>
						<li>
							<label><?php 
    _e('The date that the ability to buy this page/post expires (Leave blank for indefinate).', 'mgm');
    ?>
</label><br />
							<input type="text" name="mgm_post[purchase_expiry]" class="date_input mgm_width_100px" value="<?php 
    echo intval($post_obj->purchase_expiry) > 0 ? date(MGM_DATE_FORMAT_INPUT, strtotime($post_obj->purchase_expiry)) : '';
    ?>
"/>
							<span class="mgm_font_size_8px">(<?php 
    echo $datepickerformat;
    ?>
)</span>							
						</li>
						<li>
							<label><?php 
    _e('The number of days that the buyer will have access for (0 for indefinate).', 'mgm');
    ?>
</label><br />
							<input type="text" name="mgm_post[access_duration]" class="mgm_width_50px" value="<?php 
    echo $post_obj->get_access_duration();
    ?>
"/>
						</li>
						<li>
							<label><?php 
    _e('The number of times that the buyer will have access for, "PAY PER VIEW" (0 for unlimited views).', 'mgm');
    ?>
</label><br />
							<input type="text" name="mgm_post[access_view_limit]" class="mgm_width_50px" value="<?php 
    echo $post_obj->get_access_view_limit();
    ?>
"/>
						</li>	
					</ul>
					
					<?php 
    if ($addons = mgm_get_all_addon_combo()) {
        ?>

					<p class="postpurhase-heading"><?php 
        _e('Addon Settings', 'mgm');
        ?>
:</p>
					<ul class="mgm_post_setup_meta_box_ul">		
						<li>
							<label><?php 
        _e('Allow Addons?', 'mgm');
        ?>
</label>	<br />
							<select name="mgm_post[addons][]" class="mgm_width_50px">
								<option value="">-</option>
								<?php 
        echo mgm_make_combo_options($addons, $post_obj->get_addons(), MGM_KEY_VALUE);
        ?>

							</select>							
						</li>					
					</ul>	
					<?php 
    }
    ?>


					<p class="postpurhase-heading"><?php 
    _e('Payment Settings', 'mgm');
    ?>
:</p>	
					<p class="fontweightbold"><?php 
    _e('Allow Modules', 'mgm');
    ?>
:</p>
					<?php 
    if ($payment_modules = mgm_get_class('system')->get_active_modules('payment')) {
        $modue_i = 0;
        foreach ($payment_modules as $payment_module) {
            if (!in_array($payment_module, array('mgm_trial'))) {
                ?>

					<input type="checkbox" name="mgm_post[allowed_modules][<?php 
                echo $modue_i;
                ?>
]" value="<?php 
                echo $payment_module;
                ?>
" <?php 
                echo in_array($payment_module, $post_obj->get_allowed_modules()) ? 'checked' : '';
                ?>
/> 
					<label><?php 
                echo mgm_get_module($payment_module)->name;
                ?>
</label><br/>
					<?php 
                $modue_i++;
            }
        }
    } else {
        ?>
				
					<b class="mgm_color_red"><?php 
        _e('No payment module is active.', 'mgm');
        ?>
</b>		
					<?php 
    }
    ?>

					<?php 
    // init
    $payment_settings = '';
    // product id mapping
    if ($payment_modules) {
        foreach ($payment_modules as $payment_module) {
            if ($module = mgm_is_valid_module($payment_module, 'payment', 'object')) {
                if ($module->has_product_map()) {
                    $payment_settings .= $module->settings_post_purchase($post_obj);
                }
            }
        }
    }
    // print
    if (!empty($payment_settings)) {
        echo $payment_settings;
    }
    ?>

					
					<?php 
    do_action('mgm_widget_payperpost_options', $post->ID);
    ?>
												
				</div>	
			</div>
		</div>			
		<div class="misc-pub-section misc-pub-section-last">
			<b><?php 
    _e('Post Delay (sequential posts)', 'mgm');
    ?>
:</b>
			<a href="#postdelay" class="mgm-toggle"><?php 
    _e('Edit');
    ?>
</a>
			<div id="postdelaydiv" class="hide-if-js">
				<div class="mgm_padding_5px">				
					<p id="howto"><?php 
    _e('How long should the user have been a member to see this content?', 'mgm');
    ?>
</p>
					<div class="div_table mgm_width_100pr">
					<?php 
    foreach (mgm_get_class('membership_types')->membership_types as $type_code => $type_name) {
        $val = isset($post_obj->access_delay[$type_code]) ? (int) $post_obj->access_delay[$type_code] : 0;
        ?>

						<div class="row">
							<div class="cell mgm_width_100px mgm_font_size_11px"><?php 
        echo $type_name;
        ?>
</div>
							<div class="cell mgm_font_size_11px">
								<input type="text" name="mgm_post[access_delay][<?php 
        echo $type_code;
        ?>
]" value="<?php 
        echo $val;
        ?>
" class="mgm_width_50px"/> Day(s)
							</div>
						</div>
					<?php 
    }
    ?>

					</div>		
				</div>	
			</div>
		</div>				
	</div>	
	
	<script language="javascript">
		jQuery(document).ready(function(){			
			jQuery('.mgm-toggle').bind('click', function(){
				if(jQuery(this).html() == '<?php 
    _e('Edit', 'mgm');
    ?>
'){
					jQuery(jQuery(this).attr('href')+'div').slideDown();
					jQuery(this).html('<?php 
    _e('Close', 'mgm');
    ?>
')
				}else{
					jQuery(jQuery(this).attr('href')+'div').slideUp();
					jQuery(this).html('<?php 
    _e('Edit', 'mgm');
    ?>
')
				}
			});
			// check bind
			jQuery("#submitpost_member :checkbox[name='check_all']").bind('click',function(){
				// check
				jQuery("#submitpost_member :checkbox[name='"+jQuery(this).val()+"']").attr('checked', (jQuery(this).attr('checked')=='checked') );
				// label
				if(jQuery(this).attr('checked')){
					jQuery(this).next().html('<?php 
    _e('Deselect all', 'mgm');
    ?>
');
				}else{
					jQuery(this).next().html('<?php 
    _e('Select all', 'mgm');
    ?>
');
				}
			});	

			// bind module allow
			jQuery(":checkbox[name^='mgm_post[allowed_modules]']").bind('click',function() {		
				var _m = jQuery(this).val().replace('mgm_', '');
				
				if(jQuery(this).attr('checked')){				
					jQuery('#settings_postpurchase_package_' + _m).slideDown('slow');
				}else{				
					jQuery('#settings_postpurchase_package_' + _m).slideUp('slow');
				}
			});
			// date		
			try{	
				mgm_date_picker('.date_input', false, {yearRange:"<?php 
    echo mgm_get_calendar_year_range();
    ?>
", dateFormat: "<?php 
    echo $datepickerformat;
    ?>
"});
			}catch(ex){}	
		});
	</script>
	<?php 
}
Exemplo n.º 6
0
							<b><?php 
_e('Trial Duration', 'mgm');
?>
:</b>
						</span> 
					</div>
				</div>
				<div class="row">	
					<div class="cell">
						<input type="text" name="value_is[sub_pack_trial][duration_unit]" size="10" maxlength="50" value="<?php 
echo $data['value_is']['sub_pack_trial']['duration_unit'];
?>
"/>
						<select name="value_is[sub_pack_trial][duration_type]" class="width80px">
							<?php 
echo mgm_make_combo_options(array('d' => 'Day', 'm' => 'Month', 'y' => 'Year', 'l' => 'Lifetime'), $data['value_is']['sub_pack_trial']['duration_type'], MGM_KEY_VALUE);
?>

						</select>
					</div>
				</div>	
				<div class="row">
					<div class="cell">
						<span class="required">
							<b><?php 
_e('Trial Occurrences', 'mgm');
?>
:</b>
						</span> 
					</div>
				</div>
		</td>							
		<td valign='top'>	
			<input autocomplete='off' type='text' size='4' value='' name='mgm_card_code' id='mgm_card_code' maxlength='4' class='input {required: true, minlength:3, maxlength:4, digits:true}'/>
		</td>
	</tr>
	<tr>
		<td valign='top'>	
			<label for='mgm_card_type'><?php 
_e('Card Type', 'mgm');
?>
 <span class='required'>*</span></label>
		</td>
		<td valign='top'>		
			<select name='mgm_card_type' id='mgm_card_type' class='select'>
			<?php 
echo mgm_make_combo_options($data['card_types'], '', MGM_KEY_VALUE);
?>

			</select>
		</td>	
	</tr>
	<tr>
		<td></td>
		<td valign='top'>	
			<input class="button" type="submit" value="<?php 
_e('Submit', 'mgm');
?>
" onClick="return mgm_submit_cc_payment('<?php 
echo $data['code'];
?>
')">
/**
 * generate members list - short code content
 */
function mgm_generate_member_list($args = array())
{
    global $wpdb, $post;
    //issue #1327
    $show_level = isset($args['show_level']) ? $args['show_level'] : null;
    $show_level_members = array();
    if (!empty($show_level) && $show_level != null) {
        $show_level = explode(',', $show_level);
        $show_level_count = count($show_level);
        for ($i = 0; $i < $show_level_count; $i++) {
            $level_match_members = mgm_get_members_with('membership_type', $show_level[$i]);
            if (!empty($level_match_members)) {
                $show_level_members = array_merge($show_level_members, $level_match_members);
            }
        }
        if (!empty($show_level_members)) {
            $show_level_members = array_unique($show_level_members);
        }
    }
    // current url
    $current_url = get_permalink($post->ID);
    // append ? why?
    // if( !strpos($current_url,'?') !== false) $current_url = ($current_url . '?');
    // echo $current_url;
    // init pager
    $pager = new mgm_pager();
    // init data
    $data = $custom_search_fields = $custom_sort_fields = $custom_user_list = $user_list = array();
    // css group
    $css_group = mgm_get_css_group();
    // html
    $html = '';
    // check
    if ($css_group != 'none') {
        // expand this if needed
        $css_link_format = '<link rel="stylesheet" href="%s" type="text/css" media="all" />';
        $css_file = MGM_ASSETS_URL . 'css/' . $css_group . '/mgm.pages.css';
        $html .= sprintf($css_link_format, $css_file);
    }
    // search fields
    $data['search_fields'] = array('' => __('Select', 'mgm'), 'username' => __('Username', 'mgm'), 'id' => __('User ID', 'mgm'), 'email' => __('User Email', 'mgm'), 'first_name' => __('First Name', 'mgm'), 'last_name' => __('Last Name', 'mgm'), 'membership_type' => __('Membership Type', 'mgm'), 'reg_date' => __('Registration Date', 'mgm'), 'last_payment' => __('Last Payment', 'mgm'), 'expire_date' => __('Expiration Date', 'mgm'), 'fee' => __('Fee', 'mgm'), 'status' => __('Status', 'mgm'));
    // sort fields
    $data['sort_fields'] = array('id' => __('User ID', 'mgm'), 'username' => __('Username', 'mgm'), 'email' => __('User Email', 'mgm'), 'reg_date' => __('Registration Date', 'mgm'));
    // order fields
    $data['order_fields'] = array('desc' => __('DESC', 'mgm'), 'asc' => __('ASC', 'mgm'));
    // custom_fields
    $custom_fields = mgm_get_class('member_custom_fields');
    // getting custom fileds and skip the search fields if allready exists.
    foreach ($custom_fields->custom_fields as $custom_field) {
        if (!array_key_exists($custom_field['name'], $data['search_fields'])) {
            $custom_search_fields[$custom_field['name']] = $custom_field['label'];
        }
    }
    // getting custom fileds and skip the sort fields if allready exists.
    foreach ($custom_fields->custom_fields as $custom_field) {
        if (!array_key_exists($custom_field['name'], $data['sort_fields'])) {
            if ($custom_field['name'] != 'status') {
                $custom_sort_fields[$custom_field['name']] = $custom_field['label'];
            }
        }
    }
    // filter
    $sql_filter = $data['search_field_name'] = $data['search_field_value'] = '';
    // field value
    if (isset($_REQUEST['query'])) {
        $search_field_value = $_REQUEST['query'];
    } else {
        $search_field_value = '';
    }
    // field name
    if (isset($_REQUEST['by'])) {
        $search_field_name = $_REQUEST['by'];
    } else {
        $search_field_name = '';
    }
    // sort field
    if (isset($_REQUEST['sort_field'])) {
        $sort_field_name = $_REQUEST['sort_field'];
    } else {
        $sort_field_name = '';
    }
    // sort order type //order_type
    if (isset($_REQUEST['sort_order'])) {
        $sort_order_type = $_REQUEST['sort_order'];
    } else {
        $sort_order_type = '';
    }
    // members
    $active_members = mgm_get_members_with('status', MGM_STATUS_ACTIVE);
    // wrongly called,use constant
    // check
    if (!empty($search_field_name)) {
        // clean
        $search_field_value = mgm_escape($search_field_value);
        // for sql
        $search_field_name = mgm_escape($search_field_name);
        // for sql
        // view data
        $data['search_field_name'] = $search_field_name;
        $data['search_field_value'] = trim($search_field_value);
        // current date
        $curr_date = mgm_get_current_datetime();
        $current_date = $curr_date['timestamp'];
        // check
        if (array_key_exists($search_field_name, $custom_search_fields)) {
            // members
            $members = mgm_get_members_with_customfiled($search_field_name, $search_field_value);
            //issue #1327
            if (!empty($show_level_members)) {
                $members = array_intersect($show_level_members, $members);
            }
            //check
            $members_in = count($members) == 0 ? 0 : implode(',', $members);
            // set filter
            $sql_filter = " AND `ID` IN ({$members_in})";
        } else {
            // by field
            switch ($search_field_name) {
                case 'username':
                    // issue#: 347(LIKE SEARCH)
                    $filter = " AND `user_login` LIKE '%{$search_field_value}%'";
                    // matched
                    $matched_members = mgm_get_members_with_sql_filter($filter);
                    //issue #1327
                    if (!empty($show_level_members)) {
                        $matched_members = array_intersect($show_level_members, $matched_members);
                    }
                    // common
                    $members = array_intersect($active_members, $matched_members);
                    // check
                    $members_in = count($members) == 0 ? 0 : implode(',', $members);
                    // set filter
                    $sql_filter = " AND `ID` IN ({$members_in})";
                    break;
                case 'id':
                    // filter
                    $filter = " AND `ID` = '" . (int) $search_field_value . "'";
                    // match
                    $matched_members = mgm_get_members_with_sql_filter($filter);
                    //issue #1327
                    if (!empty($show_level_members)) {
                        $matched_members = array_intersect($show_level_members, $matched_members);
                    }
                    // common
                    $members = array_intersect($active_members, $matched_members);
                    // check
                    $members_in = count($members) == 0 ? 0 : implode(',', $members);
                    // set filter
                    $sql_filter = " AND `ID` IN ({$members_in})";
                    break;
                case 'email':
                    // issue#: 347(LIKE SEARCH)
                    $filter = " AND `user_email` LIKE '%{$search_field_value}%'";
                    // match
                    $matched_members = mgm_get_members_with_sql_filter($filter);
                    //issue #1327
                    if (!empty($show_level_members)) {
                        $matched_members = array_intersect($show_level_members, $matched_members);
                    }
                    // common
                    $members = array_intersect($active_members, $matched_members);
                    // check
                    $members_in = count($members) == 0 ? 0 : implode(',', $members);
                    // set filter
                    $sql_filter = " AND `ID` IN ({$members_in})";
                    break;
                case 'membership_type':
                    // match
                    $matched_members = mgm_get_members_with('membership_type', $search_field_value);
                    //issue #1327
                    if (!empty($show_level_members)) {
                        $matched_members = array_intersect($show_level_members, $matched_members);
                    }
                    // common
                    $members = array_intersect($active_members, $matched_members);
                    // check
                    $members_in = count($members) == 0 ? 0 : implode(',', $members);
                    // set filter
                    $sql_filter = " AND `ID` IN ({$members_in})";
                    break;
                case 'reg_date':
                    // check
                    if (empty($search_field_value)) {
                        $search_field_value = date('Y-m-d', $current_date);
                    }
                    // convert
                    $search_field_value = mgm_format_inputdate_to_mysql($search_field_value);
                    // set filter
                    $filter = " AND DATE_FORMAT(`user_registered`,'%Y-%m-%d') = '{$search_field_value}'";
                    // match
                    $matched_members = mgm_get_members_with_sql_filter($filter);
                    //issue #1327
                    if (!empty($show_level_members)) {
                        $matched_members = array_intersect($show_level_members, $matched_members);
                    }
                    // common
                    $members = array_intersect($active_members, $matched_members);
                    // check
                    $members_in = count($members) == 0 ? 0 : implode(',', $members);
                    // set filter
                    $sql_filter = " AND `ID` IN ({$members_in})";
                    break;
                case 'last_payment':
                    // check
                    if (empty($search_field_value)) {
                        $search_field_value = date('Y-m-d', $current_date);
                    }
                    // convert
                    $search_field_value = mgm_format_inputdate_to_mysql($search_field_value);
                    // match
                    $matched_members = mgm_get_members_with('last_pay_date', $search_field_value);
                    //issue #1327
                    if (!empty($show_level_members)) {
                        $matched_members = array_intersect($show_level_members, $matched_members);
                    }
                    // common
                    $members = array_intersect($active_members, $matched_members);
                    // check
                    $members_in = count($members) == 0 ? 0 : implode(',', $members);
                    // set filter
                    $sql_filter = " AND `ID` IN ({$members_in})";
                    break;
                case 'expire_date':
                    // check
                    if (empty($search_field_value)) {
                        $search_field_value = date('Y-m-d', $current_date);
                    }
                    // convert
                    $search_field_value = mgm_format_inputdate_to_mysql($search_field_value);
                    // match
                    $matched_members = mgm_get_members_with('expire_date', $search_field_value);
                    //issue #1327
                    if (!empty($show_level_members)) {
                        $matched_members = array_intersect($show_level_members, $matched_members);
                    }
                    // common
                    $members = array_intersect($active_members, $matched_members);
                    // check
                    $members_in = count($members) == 0 ? 0 : implode(',', $members);
                    // set filter
                    $sql_filter = " AND `ID` IN ({$members_in})";
                    break;
                case 'fee':
                    // match
                    $matched_members = mgm_get_members_with('amount', $search_field_value);
                    //issue #1327
                    if (!empty($show_level_members)) {
                        $matched_members = array_intersect($show_level_members, $matched_members);
                    }
                    // common
                    $members = array_intersect($active_members, $matched_members);
                    // check
                    $members_in = count($members) == 0 ? 0 : implode(',', $members);
                    // set filter
                    $sql_filter = " AND `ID` IN ({$members_in})";
                    break;
                    /*				
                    case 'status':
                    	// members
                    	$members    = mgm_get_members_with('status', $search_field_value);
                    	// check
                    	$members_in = (count($members)==0) ? 0 : (implode(',', $members));
                    	// set filter
                    	$sql_filter = " AND `ID` IN ({$members_in})";
                    break;
                    */
                /*				
                case 'status':
                	// members
                	$members    = mgm_get_members_with('status', $search_field_value);
                	// check
                	$members_in = (count($members)==0) ? 0 : (implode(',', $members));
                	// set filter
                	$sql_filter = " AND `ID` IN ({$members_in})";
                break;
                */
                case 'first_name':
                case 'last_name':
                    // members
                    $matched_members = mgm_get_members_with($search_field_name, $search_field_value);
                    //issue #1327
                    if (!empty($show_level_members)) {
                        $matched_members = array_intersect($show_level_members, $matched_members);
                    }
                    // common
                    $members = array_intersect($active_members, $matched_members);
                    // check
                    $members_in = count($members) == 0 ? 0 : implode(',', $members);
                    // set filter
                    $sql_filter = " AND `ID` IN ({$members_in})";
                    break;
            }
        }
    }
    // filters via shortcode args
    $use_field = isset($args['use_field']) ? $args['use_field'] : null;
    $use_filter = isset($args['use_filter']) ? $args['use_filter'] : '';
    $sort_by = isset($args['sort_by']) ? $args['sort_by'] : null;
    $sort_type = isset($args['sort_type']) ? $args['sort_type'] : null;
    // use shortcode field
    if (!empty($use_field)) {
        $use_field = explode(',', $use_field);
    }
    // use shortcode flter
    if (!empty($use_filter)) {
        $use_filter = explode(',', $use_filter);
    }
    // use shortcode sort
    if (!empty($sort_by)) {
        $sort_by = explode(',', $sort_by);
    }
    // use shortcode sort order
    if (!empty($sort_type)) {
        $sort_type = explode(',', $sort_type);
    }
    //setting up the default list fiedls
    if (empty($use_field)) {
        $use_field = array('image', 'first_name', 'last_name', 'email');
    }
    // check length
    $use_field_len = count($use_field);
    //getting user fillter options from short code.
    $arr_filter_search = array();
    if (!empty($use_filter)) {
        $use_filter_len = count($use_filter);
        for ($k = 0; $k < $use_filter_len; $k++) {
            if (array_key_exists($use_filter[$k], $data['search_fields'])) {
                $arr_filter_search[$use_filter[$k]] = $data['search_fields'][$use_filter[$k]];
            } elseif (array_key_exists($use_filter[$k], $custom_search_fields)) {
                $arr_filter_search[$use_filter[$k]] = $custom_search_fields[$use_filter[$k]];
            }
        }
        $data['search_fields'] = $arr_filter_search;
    }
    //getting sort by options from short code.
    $arr_sort_search = array();
    if (!empty($sort_by)) {
        $use_sort_len = count($sort_by);
        for ($k = 0; $k < $use_sort_len; $k++) {
            if (array_key_exists($sort_by[$k], $data['sort_fields'])) {
                $arr_sort_search[$sort_by[$k]] = $data['sort_fields'][$sort_by[$k]];
            } elseif (array_key_exists($sort_by[$k], $custom_sort_fields)) {
                $arr_sort_search[$sort_by[$k]] = $custom_sort_fields[$sort_by[$k]];
            }
        }
        $data['sort_fields'] = $arr_sort_search;
    }
    //getting sort type options from short code.
    $arr_sort_type = array();
    if (!empty($sort_type)) {
        $use_sort_type_len = count($sort_by);
        for ($k = 0; $k < $use_sort_type_len; $k++) {
            if (array_key_exists($sort_type[$k], $data['order_fields'])) {
                $arr_sort_type[$sort_type[$k]] = $data['order_fields'][$sort_type[$k]];
            }
        }
        $data['order_fields'] = $arr_sort_type;
    }
    //issue #1301
    //setting default sort order field as sort fields first value
    if (empty($sort_field_name)) {
        $sort_field_name = array_shift(array_keys($data['sort_fields']));
    }
    //setting default sort order type as sort order fields first value
    if (empty($sort_order_type)) {
        $sort_order_type = array_shift(array_keys($data['order_fields']));
    }
    //setting page limit
    $page_limit = isset($args['page_limit']) ? (int) $args['page_limit'] : 20;
    // page limit
    $data['page_limit'] = isset($_REQUEST['page_limit']) ? (int) $_REQUEST['page_limit'] : $page_limit;
    // page no
    $data['page_no'] = isset($_REQUEST['page_no']) ? (int) $_REQUEST['page_no'] : 1;
    // limit
    $sql_limit = $pager->get_query_limit($data['page_limit']);
    // order
    $sql_order = $data['sort_field'] = $data['sort_type'] = '';
    // sort
    $sort_field_name = mgm_escape($sort_field_name);
    // for sql
    $sort_order_type = mgm_escape($sort_order_type);
    // for sql
    // check
    if (isset($sort_field_name)) {
        // set
        $data['sort_field'] = $sort_field_name;
        $data['sort_type'] = $sort_order_type;
        // init
        $custom_sort = false;
        // check
        if (array_key_exists($sort_field_name, $custom_sort_fields)) {
            $show_level_member = array_intersect($active_members, $show_level_members);
            // members
            $sql_order_by = mgm_userlist_customfield_sort($sort_field_name, $sort_order_type, $sql_filter, $show_level_member);
            // limit
            $lim = str_replace('LIMIT', '', $sql_limit);
            $lim = explode(',', $lim);
            // init
            $temp_array = array();
            // loop
            for ($i = trim($lim[0]); $i < $lim[0] + $lim[1]; $i++) {
                if (!empty($sql_order_by[$i])) {
                    $temp_array[] = $sql_order_by[$i];
                }
            }
            //check for active members
            //$temp_array = array_intersect ($active_members,$temp_array);
            $in_order = count($temp_array) == 0 ? 0 : implode(',', $temp_array);
            // order
            //$in_order = implode(',',$temp_array);
            if (!empty($temp_array)) {
                // set
                $sql_order = " ORDER BY FIELD( ID, {$in_order} ) ";
            } else {
                $sql_order = '';
            }
            // sql
            $sql = "SELECT * FROM `{$wpdb->users}` WHERE ID != 1 AND `ID` IN ({$in_order}) {$sql_order}";
            //  list
            $custom_user_list = $wpdb->get_results($sql);
            // flag
            $custom_sort = true;
        } else {
            // by name
            switch ($sort_field_name) {
                case 'username':
                    $sql_order_by = "user_login";
                    break;
                case 'id':
                    $sql_order_by = "ID";
                    break;
                case 'email':
                    $sql_order_by = "user_email";
                    break;
                case 'membership_type':
                    break;
                case 'reg_date':
                    $sql_order_by = "user_registered";
                    break;
            }
            // set
            if (isset($sql_order_by)) {
                $sql_order = " ORDER BY {$sql_order_by} {$sort_order_type}";
            }
        }
    }
    // default
    if (!isset($sql_order_by)) {
        $sql_order = " ORDER BY ID desc";
    }
    //default active members ids
    if (empty($sql_filter)) {
        //issue #1327
        if (!empty($show_level_members)) {
            // common
            $members = array_intersect($active_members, $show_level_members);
            $members_in = count($members) == 0 ? 0 : implode(',', $members);
        } else {
            $members_in = count($active_members) == 0 ? 0 : implode(',', $active_members);
        }
        // set filter
        $sql_filter = " AND `ID` IN ({$members_in})";
    }
    // get members
    $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM `{$wpdb->users}` WHERE ID != 1 {$sql_filter} {$sql_order} {$sql_limit}";
    // users
    $user_list = $wpdb->get_results($sql);
    // echo $wpdb->last_query;
    // set
    if ($custom_sort) {
        $data['users'] = $custom_user_list;
    } else {
        $data['users'] = $user_list;
    }
    // page url
    $data['page_url'] = add_query_arg(array('query' => $search_field_value, 'by' => $search_field_name, 'sort_field' => $sort_field_name, 'sort_order' => $sort_order_type), $current_url);
    //$url.'query='.$search_field_value.'&by='.$search_field_name.'&sort_field='.$sort_field_name.'&order_type='.$order_type;
    // get page links
    $data['page_links'] = $pager->get_pager_links($data['page_url']);
    // total pages
    $data['page_count'] = $pager->get_page_count();
    // total rows/results
    $data['row_count'] = $pager->get_row_count();
    //sort by filed
    $sort_field_html = sprintf('<select id="sort_field" name="sort_field" class="width100px">%s</select>', mgm_make_combo_options($data['sort_fields'], $data['sort_field'], MGM_KEY_VALUE));
    //order by asc/desc
    $sort_order_html = sprintf('<select id="sort_order" name="sort_order" class="width100px">%s</select>', mgm_make_combo_options($data['order_fields'], $data['sort_type'], MGM_KEY_VALUE));
    //search by
    $search_by_html = sprintf('<select id="by" name="by" class="width100px">%s</select>', mgm_make_combo_options($data['search_fields'], $data['search_field_name'], MGM_KEY_VALUE));
    //search box
    $html = '<div>
				<form method="get" action="' . $current_url . '">
					<h5>' . __('Search Our Members', 'mgm') . ':</h5>
					<input type="text" id="query" name="query" value="' . $data['search_field_value'] . '" /> 
					' . __('in', 'mgm') . ' ' . $search_by_html . ' ' . __('sort by', 'mgm') . ' ' . $sort_field_html . ' ' . $sort_order_html . '					
					<input class="button" type="submit" id="submit" value="' . __('Submit', 'mgm') . '" />
					<input type="hidden" name="search" id="search" value="search" />
				</form>
			</div>';
    $html .= '<div><table><tr>';
    for ($i = 0; $i < $use_field_len; $i++) {
        $html .= sprintf('<th class="th_div mgm_text_align_left mgm_column_%s" id="mgm_column_%s"><label><b>%s</b></label></th>', $use_field[$i], $use_field[$i], ucwords(str_replace('_', ' ', $use_field[$i])));
    }
    $html .= '</tr>';
    $enable_public_profile = mgm_get_class('system')->get_setting('enable_public_profile');
    if (!empty($data['users'])) {
        foreach ($data['users'] as $user) {
            // user object
            $user = get_userdata($user->ID);
            // mgm member object
            $member = mgm_get_member($user->ID);
            $html .= '<tr>';
            for ($i = 0; $i < $use_field_len; $i++) {
                $app_user_filed = 'user_' . $use_field[$i];
                if (isset($member->custom_fields->{$use_field}[$i]) || isset($user->{$use_field}[$i]) || isset($user->{$app_user_filed}) || $use_field[$i] == 'image') {
                    if ($use_field[$i] == 'image') {
                        //is_multisite,network_home_url
                        $html .= sprintf('<td align="left" valign="top" class="mgm_%s_value">', $use_field[$i]);
                        if (bool_from_yn($enable_public_profile)) {
                            //$profile_url = add_query_arg(array('username'=>$user->user_login), site_url('userprofile'));
                            $profile_url = network_site_url() . '/userprofile/?username='******'<a class="tern_wp_member_gravatar" href="%s">%s</a>', $profile_url, get_avatar($user->ID, 60));
                        } else {
                            $html .= sprintf('<a href="javascript://">%s</a>', get_avatar($user->ID, 60));
                        }
                        $html .= '</td>';
                    } else {
                        //getting data from user object
                        if (isset($user->{$use_field}[$i])) {
                            $member->custom_fields->{$use_field}[$i] = $user->{$use_field}[$i];
                        }
                        //getting data from user object
                        if ($use_field[$i] == 'email') {
                            $member->custom_fields->{$use_field}[$i] = $user->{$app_user_filed};
                        }
                        // val unserialize
                        $val = maybe_unserialize($member->custom_fields->{$use_field}[$i]);
                        // array to string
                        if (is_array($val)) {
                            $val = implode(', ', $val);
                        }
                        // set
                        $html .= sprintf('<td align="left" valign="top" class="mgm_%s_value"><b>%s</b></td>', $use_field[$i], $val);
                    }
                }
            }
            $html .= '</tr>';
        }
    } else {
        $html .= '<tr><td colspan="' . $use_field_len . '" align="center">' . __('No members found', 'mgm') . ' ...! </td></tr>';
    }
    $html .= '</table></div><br/>';
    $html .= '<div class="mgm_page_links_div">';
    if ($data['page_links']) {
        $html .= '<div class="pager-wrap">' . $data['page_links'] . '</div><div class="clearfix"></div>';
    }
    $html .= '</div><br/>';
    //issue #1635
    $users_list_html = '<div class="mgm_user_list_container">' . $html . '</div>';
    return $users_list_html;
}
 function field_type_select($field, $name, $value, $options = NULL, $type = MGM_VALUE_ONLY, $sel_match = 'DEFAULT', $size = 1)
 {
     // get options
     $options = $options ? $options : preg_split('/[;,]+/', $field['options']);
     // value
     $value = $this->_filtered_value($field, $name, $value);
     // make options
     $options = mgm_make_combo_options($options, $value, $type, false, $sel_match);
     // readonly
     $readonly = isset($field['attributes']) && $field['attributes']['readonly'] ? 'readonly="readonly"' : '';
     // options
     if (isset($field['attributes']) && $field['attributes']['readonly'] && is_array($options) && isset($options[$value]) && !empty($options[$value])) {
         $options = array(array_search($value, $options) => $value);
     }
     // classes, default name
     $classes = array($name);
     // required
     if (isset($field['attributes']) && $field['attributes']['required']) {
         $classes[] = 'required';
     }
     // extra
     if (isset($field['attributes']) && isset($field['attributes']['class'])) {
         $classes[] = $field['attributes']['class'];
     }
     // join
     $class = implode(' ', $classes);
     // multiple
     $multiple = '';
     if ($size > 1) {
         $multiple = sprintf('multiple size="%d"', $size);
         // return
         return sprintf('<select name="%s[]" class="%s" %s %s>%s</select>', $this->_get_element_name($field, $name), $class, $readonly, $multiple, $options);
     }
     // return
     return sprintf('<select name="%s" class="%s" %s %s>%s</select>', $this->_get_element_name($field, $name), $class, $readonly, $multiple, $options);
 }
Exemplo n.º 10
0
_e('Add new Posts to this Pack', 'mgm');
?>
</b>
				</div>
			</div>
			<div class="row brBottom">
				<div class="cell width10 textalignleft">
		    		<?php 
_e('Post', 'mgm');
?>
 : 
				</div>
				<div class="cell width70 textalignleft">
					<select name="posts[]" class="width80">
						<?php 
echo mgm_make_combo_options(mgm_get_purchasable_posts($data['exclude_posts']), '', MGM_KEY_VALUE);
?>

					</select>
					<div class="tips">
						<?php 
_e("This dropdown will populate with posts as you mark them as purchasable", "mgm");
?>

					</div>			    		
				</div>
				<div class="cell width20 textalignright">
					<input class="button" type="button" onclick="mgm_postpack_post_add()" value="<?php 
_e('Save', 'mgm');
?>
" />	&nbsp;&nbsp;    		
Exemplo n.º 11
0
					<?php 
echo mgm_make_combo_options(array(20, 40, 50, 100), $data['page_limit'], MGM_VALUE_ONLY);
?>

				</select>
			</div>
		</div>
		<div class="row">
			<div class="cell width55">
				<?php 
_e('Search By', 'mgm');
?>
: 
				<select name='search_field_name' class='width135px'>					
					<?php 
echo mgm_make_combo_options($data['search_fields'], $data['search_field_name'], MGM_KEY_VALUE);
?>

				</select>				
				<span id="fld_wrapper">
					<input type="text" name="search_field_value" value="<?php 
echo $data['search_field_value'];
?>
">
				</span>					
				<span id="fld_wrapper_two">
					<input type="text" name="search_field_value_two" value="<?php 
echo $data['search_field_value_two'];
?>
">
				</span>
Exemplo n.º 12
0
			<input type="checkbox" name="remove_membership_type[]" value="<?php 
        echo $membership_type['code'];
        ?>
" />
			<?php 
        _e('Delete and move this membership type\'s members to ', 'mgm');
        ?>
<br />
			<select name="move_membership_type_to[<?php 
        echo $membership_type['code'];
        ?>
]" class="width40" disabled="disabled">
				<option value="none">--none--</option>
				<?php 
        echo mgm_make_combo_options($data['membership_types_combo'], '', MGM_KEY_VALUE, array('guest', 'trial', $membership_type['code']));
        ?>

			</select> 
			<?php 
    }
    ?>
<br /><br /> 			
			<?php 
    $login_redirect_url = strlen($membership_type['login_redirect']) > 7 ? $membership_type['login_redirect'] : '';
    ?>

			<input type="checkbox" name="update_login_redirect_url[]" value="<?php 
    echo $membership_type['code'];
    ?>
" <?php 
/**
 * edit custom fields
 */
function mgm_edit_custom_fields($user_ID = false, $submit_row = false, $return = false)
{
    // get user
    if (!$user_ID) {
        $user_ID = mgm_get_user_id();
    }
    // get form object
    if (is_object($user_ID)) {
        $user_ID = $user_ID->ID;
    }
    //check logged in user is super admin:
    $is_admin = is_super_admin() ? true : false;
    // system
    $system_obj = mgm_get_class('system');
    // get custom_fields
    $profile_fields = mgm_get_config('default_profile_fields', array());
    // get active custom fields on profile page
    //$cf_profile_page = mgm_get_class('member_custom_fields')->get_fields_where(array('display'=>array('on_profile'=>true)));
    //issue #844 - get active custom fields for profile page
    $cf_profile_pg = mgm_get_class('member_custom_fields');
    $cf_profile_page = array();
    foreach (array_unique($cf_profile_pg->sort_orders) as $id) {
        foreach ($cf_profile_pg->custom_fields as $field) {
            // issue #954: show the field only if it is enabled for profile page
            if ($field['id'] == $id && ($field['display']['on_profile'] || $is_admin)) {
                $cf_profile_page[] = $field;
            }
        }
    }
    $member = mgm_get_member($user_ID);
    //this is a fix for issue#: 589, see the notes for details:
    //This is to read saved coupons as array in order to fix the fatal error on some servers.
    //This will change the object on each users profile view.
    //Also this will avoid using patch for batch update,
    $arr_coupon = array('upgrade', 'extend');
    $oldcoupon_found = 0;
    foreach ($arr_coupon as $cpn_type) {
        if (isset($member->{$cpn_type}['coupon']) && is_object($member->{$cpn_type}['coupon'])) {
            $member->{$cpn_type}['coupon'] = (array) $member->{$cpn_type}['coupon'];
            $oldcoupon_found++;
        }
    }
    if ($oldcoupon_found) {
        $member->save();
    }
    // user
    $user = get_userdata($user_ID);
    // init
    $html = '';
    // capture
    $fields = array();
    //default and readonly fields:
    $default_readonly = array();
    $arr_images = array();
    //issue #844
    $skip_fileds = array('subscription_introduction', 'coupon', 'privacy_policy', 'payment_gateways', 'terms_conditions', 'subscription_options', 'autoresponder', 'captcha', 'show_public_profile');
    // loop fields
    foreach ($cf_profile_page as $field) {
        // issue#: 255
        if (in_array($field['name'], array_keys($profile_fields))) {
            //if custom field = defualt field, is read only
            if ($field['attributes']['readonly'] && !$is_admin) {
                $default_readonly[] = $profile_fields[$field['name']]['id'];
                //email and url id is different than custom fields:
                if (in_array($field['name'], array('email', 'url'))) {
                    $default_readonly[] = $field['name'];
                }
            }
            continue;
        }
        //issue #844
        if (in_array($field['name'], $skip_fileds)) {
            continue;
        }
        // init value
        $value = '';
        //disable readonly for admin user(issue#: 515)
        $ro = $field['attributes']['readonly'] == true && !$is_admin ? 'readonly="readonly"' : false;
        // value
        if (isset($member->custom_fields->{$field}['name'])) {
            $value = $member->custom_fields->{$field}['name'];
        }
        // date
        if ($field['name'] == 'birthdate') {
            if ($value) {
                //convert saved date to input field format
                $value = mgm_get_datepicker_format('date', $value);
            } else {
                $value = '';
            }
            $element = '<input type="text" name="mgm_profile_field[' . $field['name'] . ']" value="' . $value . '" ' . $ro . ' class="text ' . ($ro ? '' : 'mgm_date') . ' mgm_custom_profile_birthdate"/>';
        } else {
            if ($field['name'] == 'country') {
                $countries = mgm_field_values(TBL_MGM_COUNTRY, 'code', 'name');
                if ($ro) {
                    $countries = !empty($value) ? array($value => $countries[$value]) : array(" " => "&nbsp;");
                }
                //issue #1782
                $value = !empty($value) ? $value : 'US';
                $options = mgm_make_combo_options($countries, $value, MGM_KEY_VALUE);
                $element = '<select name="mgm_profile_field[' . $field['name'] . ']" > ' . $options . ' </select>';
            } else {
                if ($field['type'] == 'text') {
                    $element = '<input type="text" name="mgm_profile_field[' . $field['name'] . ']" value="' . $value . '" ' . $ro . ' class="text mgm_custom_profile_password"/>';
                } else {
                    if ($field['type'] == 'password') {
                        continue;
                    } else {
                        if ($field['type'] == 'textarea') {
                            $element = '<textarea name="mgm_profile_field[' . $field['name'] . ']" cols="40" rows="5" ' . $ro . '>' . $value . '</textarea>';
                        } else {
                            if ($field['type'] == 'checkbox') {
                                $options = preg_split('/[;,]/', $field['options']);
                                //$values  = preg_split('/[;,\s]/', $value);
                                $values = @unserialize($value);
                                // pass " " as value to prevent the default value getting selected, if no option is selected
                                $values = empty($values) ? " " : $values;
                                //Issue # 694
                                $element = mgm_make_checkbox_group('mgm_profile_field[' . $field['name'] . '][]', $options, $values, MGM_VALUE_ONLY, '', 'div');
                            } else {
                                if ($field['type'] == 'checkboxg') {
                                    $options = preg_split('/[;,]/', $field['options']);
                                    if (!is_array($value)) {
                                        $values = @unserialize($value);
                                    } else {
                                        $values = $value;
                                    }
                                    $values = empty($values) ? " " : $values;
                                    $element = mgm_make_checkbox_group('mgm_profile_field[' . $field['name'] . '][]', $options, $values, MGM_VALUE_ONLY, '', 'div');
                                } else {
                                    if ($field['type'] == 'radio') {
                                        $options = preg_split('/[;,]/', $field['options']);
                                        $element = mgm_make_radio_group('mgm_profile_field[' . $field['name'] . ']', $options, $value, MGM_VALUE_ONLY);
                                    } else {
                                        if ($field['type'] == 'select') {
                                            $element = '<select name="mgm_profile_field[' . $field['name'] . ']" ' . $ro . '>';
                                            $options = preg_split('/[;,]/', $field['options']);
                                            if ($ro) {
                                                $options = !empty($value) ? array($value => $value) : array(" " => "&nbsp;");
                                            }
                                            $element .= mgm_make_combo_options($options, $value, MGM_VALUE_ONLY);
                                            $element .= '</select>';
                                        } else {
                                            if ($field['type'] == 'selectm') {
                                                $element = '<select name="mgm_profile_field[' . $field['name'] . '][]" ' . $ro . ' multiple>';
                                                $options = preg_split('/[;,]/', $field['options']);
                                                if ($ro) {
                                                    $options = !empty($value) ? array($value => $value) : array(" " => "&nbsp;");
                                                }
                                                $element .= mgm_make_combo_options($options, $value, MGM_VALUE_ONLY);
                                                $element .= '</select>';
                                            } else {
                                                if ($field['type'] == 'html') {
                                                    $element = '';
                                                    $element .= '<div class="mgm_custom_subs_introduction">' . html_entity_decode(mgm_stripslashes_deep($field['value'])) . '</div>';
                                                } else {
                                                    if ($field['type'] == 'image') {
                                                        $form_fields = new mgm_form_fields();
                                                        $element = $form_fields->get_field_element($field, 'mgm_profile_field', $value);
                                                        if (!in_array($field['name'], $arr_images)) {
                                                            $arr_images[] = $field['name'];
                                                        }
                                                        //issue #1258
                                                    } else {
                                                        if ($field['type'] == 'label') {
                                                            $form_fields = new mgm_form_fields();
                                                            $element = $form_fields->get_field_element($field, 'mgm_profile_field', $value);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        // set array
        if ($element) {
            $fields[] = array('name' => $field['name'], 'label' => $field['label'], 'field' => $element);
        }
    }
    // if fields - issue #1782
    if (count($fields)) {
        $html .= '<table class="form-table">';
        foreach ($fields as $i => $row) {
            $html .= '<tr><th><label>' . mgm_stripslashes_deep($row['label']) . '</label></th>';
            $html .= '<td>' . $row['field'] . '</td></tr>';
        }
        // button
        if ($submit_row) {
            $html .= '<tr>
				<td colspan="2">
					<input class="button" type="submit" name="submit" value="' . __('Update your profile', 'mgm') . '"/>
					<input type="hidden" name="update_mgm_custom_fields_submit" value="1" />
			</td></tr>';
        }
        $html .= '</table>';
        $html .= mgm_attach_scripts(true, array());
        $yearRange = mgm_get_calendar_year_range();
        //include scripts for image upload:
        if (!empty($arr_images)) {
            $html .= mgm_upload_script_js('your-profile', $arr_images);
        }
        $html .= '<script language="javascript">jQuery(document).ready(function(){try{mgm_date_picker(".mgm_date",false,{yearRange:"' . $yearRange . '", dateFormat: "' . mgm_get_datepicker_format() . '"});}catch(x){}});</script>';
    }
    if (!empty($default_readonly)) {
        $html .= '<script language="javascript">';
        $html .= 'jQuery(document).ready(function(){try{';
        $html .= 'jQuery.each(' . json_encode($default_readonly) . ', function(){jQuery("#"+this).attr("readonly", true)})';
        $html .= '}catch(x){}})';
        $html .= '</script>';
    }
    // return
    if ($return) {
        return $html;
    } else {
        echo $html;
    }
}
Exemplo n.º 14
0
][cost]" id="packs_cost_<?php 
echo $data['pack_ctr'] - 1;
?>
" value="<?php 
echo $data['pack']['cost'];
?>
" size="10" maxlength="15"/>
						<select name="packs[<?php 
echo $data['pack_ctr'] - 1;
?>
][currency]" id="<?php 
echo $data['pack_ctr'] - 1;
?>
_currency" class="width200px">
							<?php 
echo mgm_make_combo_options(mgm_get_currencies(), $data['pack']['currency'], MGM_KEY_VALUE);
?>

						</select>						
						<?php 
//echo $data['pack']['currency'];
?>

					</div>
				</div>
			</div>
			
			<div class="row">
				<div class="cell">
					<div class="marginleft10px">	
						<p class="fontweightbold"><?php 
Exemplo n.º 15
0
_e('Value', 'mgm');
?>
</b>
				</div>
			</div>
			<div class="row brBottom">
				<div class="cell width50 textalignleft ">
					<p><b><?php 
_e('Enable', 'mgm');
?>
?</b></p>
				</div>
				<div class="cell textalignleft width50 brCellBorderLeft">
					<select name="enabled" class="width100px">
						<?php 
echo mgm_make_combo_options(array('Y' => __('Yes', 'mgm'), 'N' => __('No', 'mgm')), $data['module']->is_enabled('string'), MGM_KEY_VALUE);
?>

					</select>						
				</div>
			</div>	
		</div>		

		<p><div class="tips width95"><?php 
_e('Enable/Disable the GVO module.', 'mgm');
?>
</div></p>
		<p>&nbsp;</p>
				
		<h3><b><?php 
_e('Primary Settings', 'mgm');
Exemplo n.º 16
0
?>
"/>					
			</div>
		</div>
	
		<div class="row brBottom">
			<div class="cell width120px">
				<span class="required"><?php 
_e('Level', 'mgm');
?>
</span>: 
			</div>
			<div class="cell textalignleft">
				<select name="level" class="width50px">
					<?php 
echo mgm_make_combo_options($data['levels'], $data['key']->level, MGM_VALUE_ONLY);
?>

				</select>					
			</div>	
		</div>
		<div class="row brBottom">
			<div class="cell width120px">
				<?php 
_e('Create Date', 'mgm');
?>
</span>: 
			</div>
			<div class="cell textalignleft">
				<?php 
echo date(mgm_get_date_format('date_format'), strtotime($data['key']->create_dt));
Exemplo n.º 17
0
		</tbody>
	</table>
	<div class="clearfix"></div>
	<?php 
if (count($data['users']) > 0) {
    ?>

	<div class="mgm_bulk_actions_div">
		<select name="bulk_actions" id="bulk_actions" class="width150px">
			<option value=""><?php 
    _e('Bulk Actions', 'mgm');
    ?>
</option>
			<?php 
    echo mgm_make_combo_options(array('check_rebill_status' => __('Check Rebill Status', 'mgm'), 'delete' => __('Delete', 'mgm')), $data['bulk_actions'], MGM_KEY_VALUE);
    ?>

		</select>
		<input type="button" name="apply_btn" class="button" value="<?php 
    _e('Apply', 'mgm');
    ?>
" onclick="mgm_member_bulk_actions()"/>
	</div>	
	<div class="mgm_page_links_div">
		<?php 
    if ($data['page_links']) {
        ?>
<div class="pager-wrap"><?php 
        echo $data['page_links'];
        ?>
Exemplo n.º 18
0
							<input type="text" name="purchase_shortcode_argument" value="" id="purchase_shortcode_argument"/>
						</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td><input class="button" type="button" id="purchase_shortcode_insert" name="purchase_shortcode_insert" value="' . __('Insert', 'mgm') . '" /></td>
					</tr>						
				</table>
			</fieldset><br/>';
$html .= '<fieldset>
				<legend>' . __('Other Shortcodes', 'mgm') . '</legend>
				<table cellpadding="0" cellspacing="0" border="0">
					<tr id="othershortcode">
						<td>' . __('Select Shortcode : ', 'mgm') . ':</td>
						<td>
							<select name="other_shortcode" id="other_shortcode" class="width130px;">' . mgm_make_combo_options($data['other_shortcodes'], '', 2) . '</select>
						</td>
					</tr>
					<tr>
						<td colspan="2">&nbsp;</td>
					</tr>
					
					<tr id="otherargument" style="display:none;">
						<td>' . __('Shortcode Argument : ', 'mgm') . '</td>
						<td>
							<input type="text" name="other_shortcode_argument" value="" id="other_shortcode_argument"/>
						</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td><input class="button" type="button" id="other_shortcode_insert" name="other_shortcode_insert" value="' . __('Insert', 'mgm') . '" /></td>
function mgm_time_select($name = "time", $properties = "")
{
    $default = array("hour" => date('g'), "minute" => date('i'), "second" => date('s'), "meridian" => date('A'), "readonly" => false);
    $properties = is_array($properties) ? $properties : $default;
    # make vars
    extract($properties);
    $readonly = $readonly ? "disabled class='readonly'" : "";
    echo "<select name='hour[{$name}]' {$readonly}>";
    echo mgm_make_combo_options(array_merge(array("00"), range(1, 12)), $hour, MGM_VALUE_ONLY);
    echo "</select>";
    echo "<select name='minute[{$name}]' {$readonly}>";
    echo mgm_make_combo_options(array_merge(array("00"), range(1, 60)), $minute, MGM_VALUE_ONLY);
    echo "</select>";
    /*
    echo "<select name='second' {$readonly_class}>";
    echo mgm_make_combo_options(range(1,60),$second,MGM_VALUE_ONLY);
    echo "</select>"; 
    */
    echo "<select name='meridian[{$name}]' {$readonly}>";
    echo mgm_make_combo_options(array('AM', 'PM'), $meridian, MGM_VALUE_ONLY);
    echo "</select>";
}
Exemplo n.º 20
0
	<form name="frmcoreenv" id="frmcoreenv" action="admin-ajax.php?action=mgm_admin_ajax_action&page=mgm/admin/tools&method=core_setup" method="post">
	<div class="table form-table">
		<div class="row">
    		<div class="cell">	
    			<b><?php 
_e('Please Select a jQueryUI version :', 'mgm');
?>
</b>
    		</div>
    	</div>
		<div class="row">
    		<div class="cell">	
				<select name="jqueryui_version" class="width150px">
				<?php 
echo mgm_make_combo_options(mgm_get_jquery_ui_versions(), get_option('mgm_jqueryui_version'), MGM_VALUE_ONLY);
?>

				</select>
				<div class="information" class="width85"><?php 
_e('jQuery UI version to use, for best performance, version 1.8.2 is recommended if that works with your WP environment.', 'mgm');
?>
</div>
    		</div>
    	</div>
		<div class="row">
    		<div class="cell">	
    			<b><?php 
_e('Disable Core jQuery On Site:', 'mgm');
?>
</b>
Exemplo n.º 21
0
foreach ($data['downloads'] as $obj) {
    $list[$obj->id] = $obj->title;
}
// url
$url = MGM_ASSETS_URL . 'js/editor/plugins/downloads/download.php';
// html
$html = '';
// check
if (count($list) > 0) {
    $html .= '<fieldset>
					<legend>' . __('From Downloads', 'mgm') . '</legend>
					<table cellpadding="0" cellspacing="0" border="0">
						<tr>
							<td>' . __('Select', 'mgm') . ':</td>
							<td>
								<select name="download_link" id="download_link" class="width130px;">' . mgm_make_combo_options($list, '', 2) . '</select>
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<input type="hidden" name="download_hook" value="' . $data['download_hook'] . '" id="download_hook" />
							</td>
						</tr>
						<tr>
							<td>
								<input type="radio" name="download_option" value="link" id="link" checked="true" />
							</td>
							<td>' . __('Download link', 'mgm') . '</td>
						</tr>
						<tr>
							<td>
Exemplo n.º 22
0
?>
: 
			<select name="page_no_s" id="page_no_s" class="width50px">					
				<?php 
echo mgm_make_combo_options($data['page_count'] > 1 ? range(1, $data['page_count']) : array(1), $data['page_no'], MGM_VALUE_ONLY);
?>
			</select>
		</div>
	    <div class="cell width50 textalignright">
			<?php 
_e('Records Per Page', 'mgm');
?>
: 
			<select name="page_limit" id="page_limit" class="width50px">
				<?php 
echo mgm_make_combo_options(array(20, 40, 50, 100), $data['page_limit'], MGM_VALUE_ONLY);
?>
			</select>
			<input type="hidden" name="export_format" value="xls" />
	    
		</div>
	</div>
</div>

<?php 
mgm_box_bottom();
mgm_box_top('Payment History.');
?>
<div class="table widefatDiv form-table">
	<div class="row headrow">
		<div class="cell theadDivCell width125px textalignleft maxwidth125px">
Exemplo n.º 23
0
			</div>
			<div class="row">
				<div class="cell width120px">
					<span class="required-field">
						<b><?php 
_e('Input Type', 'mgm');
?>
:</b>
					</span>
				</div>
			</div>
			<div class="row">		
				<div class="cell textalignleft ">
					<select name="type" id="type">
						<?php 
echo mgm_make_combo_options($data['input_types'], 'text', MGM_KEY_VALUE);
?>

					</select>
				</div>
			</div>
			<div class="row displaynone">
				<div class="cell width120px">
					<span class="required-field">
						<b><?php 
_e('Value', 'mgm');
?>
:</b>
					</span>
				</div>
			</div>
Exemplo n.º 24
0
_e('Add Coupon', 'mgm');
?>
</b>
			</div>
		</div>
		<div class="row" >
			<div class="cell">&nbsp;</div>
		</div>		
		<div class="row">
			<div class="cell"> <b>&nbsp;<?php 
_e('Genarate coupon ', 'mgm');
?>
 : </b>
				<select name="coupon_choice" id="coupon_choice" >		
					<?php 
echo mgm_make_combo_options(array('single' => __('single', 'mgm'), 'multiple' => __('multiple', 'mgm')));
?>
		
				</select>
			</div>
		</div>		
		<div class="row">
			<div class="cell">
				<span class="required">
					<b id="coupon_choice_label"><?php 
_e('Coupon code : ', 'mgm');
?>
</b>
				</span> 
			</div>
		</div>
Exemplo n.º 25
0
_e('Restrict via Post/Page Access', 'mgm');
?>

					<div class="tips width90">
						<?php 
_e('If checked, only users of the appropriate access level can access the file. User level is calculated by checking access to a certain post or posts.', 'mgm');
?>

					</div>
					<p id="members_only_posts" class="<?php 
echo bool_from_yn($data['download']->members_only) ? "displayblock" : 'displaynone';
?>
">
						<select name="link_to_post_id[]" multiple size="10" class="height250px width820px">
							<?php 
echo mgm_make_combo_options($data['posts'], $data['download_posts'], MGM_KEY_VALUE);
?>

						</select>
					</p>
					<p>
						<input type="checkbox" name="restrict_acces_ip" id="restrict_acces_ip" <?php 
echo bool_from_yn($data['download']->restrict_acces_ip) ? "checked='checked'" : '';
?>
/> <?php 
_e('Restrict Download to IP', 'mgm');
?>

						<div class="tips">
							<?php 
_e('If checked, download will be locked to particular IP address, if download limit is set, either of user or IP restriction must be set.', 'mgm');
Exemplo n.º 26
0
		
			</div>
		</div>
		<div class="clearfix"></div>
		<?php 
if (count($data['coupons']) > 0) {
    ?>

		<div class="mgm_bulk_actions_div">
			<select name="bulk_actions" id="bulk_actions" class="width150px">
				<option value=""><?php 
    _e('Bulk Actions', 'mgm');
    ?>
</option>
				<?php 
    echo mgm_make_combo_options(array('delete' => __('Delete', 'mgm')), $data['bulk_actions'], MGM_KEY_VALUE);
    ?>

			</select>
			<input class="button" type="button" name="apply_btn" value="<?php 
    _e('Apply', 'mgm');
    ?>
" onclick="mgm_coupon_bulk_actions()"/>
		</div>	
		<div class="mgm_page_links_div">
			<?php 
    if (isset($data['page_links'])) {
        ?>
<div class="pager-wrap"><?php 
        echo $data['page_links'];
        ?>
Exemplo n.º 27
0
</div></p>
				</div>
			</div>
			<div class="row">
				<div class="cell">
					<p><b><?php 
_e('Test/Live Switch', 'mgm');
?>
:</b></p>
				</div>
			</div>
			<div class="row">
				<div class="cell">
					<select name="status" class="width100px">
						<?php 
echo mgm_make_combo_options(array('test' => __('TEST', 'mgm'), 'live' => __('LIVE', 'mgm')), $data['module']->status, MGM_KEY_VALUE);
?>

					</select>						
					<p><div class="tips"><?php 
_e('Switch between TEST/LIVE mode to test your payments. Not all modules supports this feature.', 'mgm');
?>
</div></p>
				</div>
			</div>
			<div class="row">
				<div class="cell">
					<p><b><?php 
_e('Custom Thankyou URL', 'mgm');
?>
:</b></p>
Exemplo n.º 28
0
echo bool_from_yn($download->members_only) ? "checked='checked'" : '';
?>
 /> <?php 
_e('Restrict via Post/Page Access', 'mgm');
?>
					
					<div class="tips width90">
						<?php 
_e('If checked, only users of the appropriate access level can access the file. User level is calculated by checking access to a certain post or posts.', 'mgm');
?>

					</div>						
					<p id="members_only_posts" class="displaynone">
						<select name="link_to_post_id[]" multiple size="10" class="height250px width820px">
							<?php 
echo mgm_make_combo_options($data['posts'], '', MGM_KEY_VALUE);
?>

						</select>
					</p>
					<p>
						<input type="checkbox" name="restrict_acces_ip" id="restrict_acces_ip" /> <?php 
_e('Restrict Download to IP', 'mgm');
?>

						<div class="tips">
							<?php 
_e('If checked, download will be locked to particular IP address, if download limit is set, either of user or IP restriction must be set.', 'mgm');
?>

						</div>
Exemplo n.º 29
0
				</span>
			</div>
			<div class="cell width45">
				<?php 
_e('Sort By', 'mgm');
?>
: 
				<select name='sort_field_name' class='width135px'>					
					<?php 
echo mgm_make_combo_options($data['sort_fields'], $data['sort_field'], MGM_KEY_VALUE);
?>

				</select>		
				<select name='sort_type'>					
					<?php 
echo mgm_make_combo_options(array('desc' => 'DESC', 'asc' => 'ASC'), $data['sort_type'], MGM_VALUE_ONLY);
?>

				</select>				
				<input type="hidden" name="export_format" value="xls" />
				<input type="button" name="show_post_pur_btn" class="button" value="<?php 
_e('Show', 'mgm');
?>
" onclick="mgm_post_purchase_list_search(true)" />
				<a href="javascript:mgm_post_purchase_list()" title="<?php 
_e('Refresh List', 'mgm');
?>
"><img src="<?php 
echo MGM_ASSETS_URL;
?>
images/icons/arrow_refresh.png" /></a>
Exemplo n.º 30
0
echo mgm_create_token();
?>
"/>					
				</div>
			</div>
	  		<div class="row brBottom">
	    		<div class="cell width120px">
		    		<span class="required"><?php 
_e('Level', 'mgm');
?>
</span>: 
				</div>
	    		<div class="cell textalignleft">
		    		<select name="level" class="width50px">
						<?php 
echo mgm_make_combo_options($data['levels'], 1, MGM_VALUE_ONLY);
?>

					</select>					

				</div>
			</div>
	  		<div class="row brBottom">
	    		<div class="cell">
					<div class="floatleft">			
						<input class="button" type="submit" name="save_key" value="<?php 
_e('Save', 'mgm');
?>
" />	
						<input class="button" type="button" name="cancel_save_key" value="<?php 
_e('Cancel', 'mgm');