function ihc_print_locker_template($id = false, $meta_arr = false, $preview = false)
{
    //function that return html template for an id
    $str = '';
    if ($id && $id != -1) {
        $meta_arr = ihc_return_meta('ihc_lockers', $id);
    }
    //gettings metas for id
    if ($meta_arr) {
        $login = '';
        if ($meta_arr['ihc_locker_login_form']) {
            $meta_arr_login = ihc_return_meta_arr('login');
            if ($meta_arr['ihc_locker_additional_links']) {
                $meta_arr_login['ihc_login_remember_me'] = 0;
                $meta_arr_login['ihc_login_register'] = 1;
                $meta_arr_login['ihc_login_pass_lost'] = 1;
            } else {
                $meta_arr_login['ihc_login_remember_me'] = 0;
                $meta_arr_login['ihc_login_register'] = 0;
                $meta_arr_login['ihc_login_pass_lost'] = 0;
            }
            $meta_arr_login['ihc_login_template'] = 'ihc-login-template-7';
            //no template for login
            if (isset($meta_arr['ihc_locker_login_template']) && $meta_arr['ihc_locker_login_template']) {
                $meta_arr_login['ihc_login_template'] = $meta_arr['ihc_locker_login_template'];
            }
            if ($preview) {
                $meta_arr_login['preview'] = true;
            }
            $login = ihc_print_form_login($meta_arr_login);
        } elseif ($meta_arr['ihc_locker_additional_links']) {
            $login = ihc_print_links_login();
        }
        $meta_arr['ihc_locker_custom_content'] = ihc_format_str_like_wp($meta_arr['ihc_locker_custom_content']);
        $meta_arr['ihc_locker_custom_content'] = stripslashes($meta_arr['ihc_locker_custom_content']);
        $meta_arr['ihc_locker_custom_content'] = htmlspecialchars_decode($meta_arr['ihc_locker_custom_content']);
        $str = ihc_locker_layout($meta_arr['ihc_locker_template'], $login, $meta_arr['ihc_locker_custom_content']);
        $str = '<div class="ihc-locker-wrap">' . $str . '</div>';
        if ($meta_arr['ihc_locker_custom_css']) {
            $str = '<style>' . $meta_arr['ihc_locker_custom_css'] . '</style>' . $str;
        }
    }
    return $str;
    //if something goes wrong return blank string
}
function ihc_initiate_plugin()
{
    //and new role to users
    add_role('pending_user', 'Pending', array('read' => false, 'level_0' => true));
    //save the metas to db
    $values = array('payment', 'login', 'login-messages', 'general-defaults', 'general-msg', 'general-captcha', 'general-subscription', 'register', 'register-msg', 'register-custom-fields');
    foreach ($values as $value) {
        ihc_return_meta_arr($value);
    }
    //create tables
    global $wpdb;
    ////////// indeed_members_payments
    $table_name = $wpdb->prefix . 'indeed_members_payments';
    if ($wpdb->get_var("show tables like '{$table_name}'") != $table_name) {
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        $sql = "CREATE TABLE " . $table_name . " (\n\t\t\t\t\tid int(9) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t\t\ttxn_id VARCHAR(100) DEFAULT NULL,\n\t\t\t\t\tu_id int(9) DEFAULT NULL,\n\t\t\t\t\tpayment_data text DEFAULT NULL,\n\t\t\t\t\thistory TEXT,\n\t\t\t\t\tpaydate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP\n\t\t\t);";
        dbDelta($sql);
    }
}
示例#3
0
function ihc_login($url)
{
    global $ihc_login_msg;
    if (isset($_REQUEST['log']) && $_REQUEST['log'] != '' && isset($_REQUEST['pwd']) && $_REQUEST['pwd'] != '') {
        $arr['user_login'] = sanitize_user($_REQUEST['log']);
        $arr['user_password'] = $_REQUEST['pwd'];
        $arr['remember'] = isset($_REQUEST['rememberme']) == 'forever' ? true : false;
        $user = wp_signon($arr, false);
        if (!is_wp_error($user)) {
            if (isset($user->roles[0]) && $user->roles[0] == 'pending_user') {
                //pending user
                $ihc_login_msg = ihc_correct_text(get_option('ihc_login_pending', true));
                //ihc_register_pending_user_msg
                return;
            } else {
                global $wp;
                $redirect_p_id = get_option('ihc_general_login_redirect');
                if ($redirect_p_id) {
                    $url = get_permalink($redirect_p_id);
                }
                $arr_params = array('ihc_success_login' => 'true');
                $url = add_query_arg($arr_params, $url);
                wp_redirect($url);
                exit;
            }
        }
    }
    //login faild
    $ihc_login_msg = ihc_correct_text(get_option('ihc_login_error', true));
    if (empty($ihc_login_msg)) {
        $arr = ihc_return_meta_arr('login-messages', false, true);
        if (isset($arr['ihc_login_error']) && $arr['ihc_login_error']) {
            $ihc_login_msg = $arr['ihc_login_error'];
        } else {
            $ihc_login_msg = __('Error', 'ihc');
        }
    }
}
示例#4
0
    ?>
</textarea>
							<div class="ihc-wrapp-submit-bttn">
								<input type="submit" value="<?php 
    _e('Save', 'ihc');
    ?>
" name="ihc_save" class="button button-primary button-large" />
							</div>	
						</div>
					</div>
				</div>			
			</form>		
		<?php 
} else {
    ihc_save_update_metas('login-messages');
    $meta_arr = ihc_return_meta_arr('login-messages');
    ?>
			<form action="" method="post" >	
				<div class="ihc-stuffbox">
					<h3><?php 
    _e('Messages:', 'ihc');
    ?>
</h3>
					<div class="inside">
						<div style="display: inline-block; width: 45%;">	
							<h2><?php 
    _e('Login Messages', 'ihc');
    ?>
</h2>		
							<div>
								<div class="iump-labels-special"><?php 
示例#5
0
<?php

if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
include plugin_dir_path(__FILE__) . 'utilities.php';
$values = array('payment', 'login', 'login-messages', 'general-defaults', 'general-msg', 'general-captcha', 'general-subscription', 'register', 'register-msg', 'register-custom-fields');
foreach ($values as $value) {
    $data = ihc_return_meta_arr($value, true);
    foreach ($data as $k => $v) {
        delete_option($k);
    }
}
delete_option('ihc_levels');
//delete the levels
delete_option('ihc_lockers');
//delete the lockers
//delete table indeed_members_payments
global $wpdb;
$table_name = $wpdb->prefix . "indeed_members_payments";
$sql = "DROP TABLE IF EXISTS {$table_name};";
$wpdb->query($sql);
//delete user levels nataly
$users_obj = new WP_User_Query(array('meta_query' => array('relation' => 'OR', array('key' => $wpdb->get_blog_prefix() . 'capabilities', 'value' => 'subscriber', 'compare' => 'like'), array('key' => $wpdb->get_blog_prefix() . 'capabilities', 'value' => 'pending_user', 'compare' => 'like'))));
$users = $users_obj->results;
if (!empty($users)) {
    foreach ($users as $user) {
        delete_user_meta($user->data->ID, 'ihc_user_levels');
    }
}
示例#6
0
						</div>					
					</div>
				</div>	
								
			</form>
			<script>
				jQuery(document).ready(function(){
					ihcRegisterLockerPreview();
				});
			</script>					
		<?php 
        break;
    case 'msg':
        ihc_save_update_metas('register-msg');
        //save update metas
        $meta_arr = ihc_return_meta_arr('register-msg');
        //getting metas
        ?>
			<form method="post" action="">
				<div class="ihc-stuffbox">
					<h3><?php 
        _e('Custom Messages', 'ihc');
        ?>
</h3>
					<div class="inside">	
						
						<div style="display:inline-block;width: 45%;">
							<div>
								<div class="iump-labels-special"><?php 
        _e('Error - Username is taken:', 'ihc');
        ?>
<?php

ihc_save_update_metas('payment');
//save update metas
$meta_arr = ihc_return_meta_arr('payment');
//getting metas
$pages = ihc_get_all_pages();
//getting pages
echo ihc_check_default_pages_set();
//set default pages message
?>
<div class="iump-page-title">Ultimate Membership Pro - 
							<span class="second-text">
								<?php 
_e('Payments Services', 'ihc');
?>
							</span>
						</div>
<form action="" method="post">
		<div class="ihc-stuffbox">
			<h3><?php 
_e('Currency Settings:', 'ihc');
?>
</h3>
			<div class="inside">		
				<div class="iump-form-line">
					<select name="ihc_currency">
						<?php 
$currency_arr = array('AUD' => 'Australian Dollar (A $)', 'CAD' => 'Canadian Dollar (C $)', 'EUR' => 'Euro (&#8364;)', 'GBP' => 'British Pound (&#163;)', 'JPY' => 'Japanese Yen (&#165;)', 'USD' => 'U.S. Dollar ($)', 'NZD' => 'New Zealand Dollar ($)', 'CHF' => 'Swiss Franc', 'HKD' => 'Hong Kong Dollar ($)', 'SGD' => 'Singapore Dollar ($)', 'SEK' => 'Swedish Krona', 'DKK' => 'Danish Krone', 'PLN' => 'Polish Zloty', 'NOK' => 'Norwegian Krone', 'HUF' => 'Hungarian Forint', 'CZK' => 'Czech Koruna', 'ILS' => 'Israeli New Shekel', 'MXN' => 'Mexican Peso', 'BRL' => 'Brazilian Real (only for Brazilian members)', 'MYR' => 'Malaysian Ringgit (only for Malaysian members)', 'PHP' => 'Philippine Peso', 'TWD' => 'New Taiwan Dollar', 'THB' => 'Thai Baht', 'TRY' => 'Turkish Lira (only for Turkish members)', 'RUB' => 'Russian Ruble');
foreach ($currency_arr as $k => $v) {
    ?>
示例#8
0
function ihc_save_update_metas($group)
{
    if (isset($_REQUEST['ihc_save'])) {
        $data = ihc_return_meta_arr($group, true);
        foreach ($data as $k => $v) {
            if (isset($_REQUEST[$k])) {
                $data_db = get_option($k);
                if ($data_db !== FALSE) {
                    update_option($k, $_REQUEST[$k]);
                } else {
                    add_option($k, $_REQUEST[$k]);
                }
            }
        }
    }
}
示例#9
0
" name="ihc_save" class="button button-primary button-large">
								</div>	
							</div>
						</div>					
					</form>
					<script>
						 jQuery(document).ready(function(){
							 ihc_preview_select_levels();
						 });
					</script>
				<?php 
        break;
    case 'msg':
        ihc_save_update_metas('general-msg');
        //save update metas
        $meta_arr = ihc_return_meta_arr('general-msg');
        //getting metas
        echo ihc_check_default_pages_set();
        //set default pages message
        ?>
					<form action="" method="post">
						<div class="ihc-stuffbox">
							<h3><?php 
        _e('Custom Messages', 'ihc');
        ?>
</h3>
							<div class="inside">		
								<div>
									<div class="iump-labels-special"><?php 
        _e('Update Successfully Message:', 'ihc');
        ?>
示例#10
0
function ihc_lost_pass_form($attr = false)
{
    $str = '';
    if (!is_user_logged_in()) {
        $meta_arr = ihc_return_meta_arr('login');
        $str .= ihc_print_form_password($meta_arr);
        global $ihc_reset_pass;
        if ($ihc_reset_pass) {
            if ($ihc_reset_pass == 1) {
                //reset ok
                return get_option('ihc_reset_msg_pass_ok');
            } else {
                //reset error
                $str .= get_option('ihc_reset_msg_pass_err');
            }
        }
    }
    return $str;
}
 public function save_update_user()
 {
     //settings the user data, in case of new user, set the array only with keys
     $this->userdata();
     // setting the meta register array, values selected in dashboard, register tab
     $this->register_metas = array_merge(ihc_return_meta_arr('register'), ihc_return_meta_arr('register-msg'), ihc_return_meta_arr('register-custom-fields'));
     //register fields, function available in utilities.php,
     //return something $arr[] = array('display'=>'', 'name'=>'', 'label'=>'', 'type'=>'', 'order'=>'', 'native_wp' => '', 'req' => '' );
     $this->set_register_fields();
     $this->check_username();
     $this->check_password();
     $this->check_email();
     $this->check_tos();
     $this->check_captcha();
     $this->set_roles();
     foreach ($this->register_fields as $value) {
         $name = $value['name'];
         if (isset($_REQUEST[$name])) {
             if ($value['req'] && $_REQUEST[$name] == '') {
                 $this->errors[] = $this->register_metas['ihc_register_err_req_fields'] . ' ' . $value['label'];
             }
             if ($value['native_wp'] == 1) {
                 //wp standard info
                 $this->fields[$name] = $_REQUEST[$name];
             } else {
                 //custom meta user
                 $custom_meta_user[$name] = $_REQUEST[$name];
             }
         }
     }
     if ($this->errors) {
         //print the error and exit
         $this->return_errors();
         return FALSE;
     }
     //wp native user
     if ($this->type == 'create') {
         //add new user
         $this->user_id = wp_insert_user($this->fields);
     } else {
         //update user
         $this->fields['ID'] = $this->user_id;
         wp_update_user($this->fields);
     }
     $this->do_opt_in();
     //custom user meta
     if (isset($custom_meta_user)) {
         foreach ($custom_meta_user as $k => $v) {
             update_user_meta($this->user_id, $k, $v);
         }
         if ($this->type == 'create') {
             update_user_meta($this->user_id, 'indeed_user', 1);
             //add a meta for user registered from our plugin
         }
     }
     $this->notify_admin();
     $this->set_levels();
     //USER LEVELS
     $this->update_level_expire();
     if ($this->is_public) {
         $this->succes_message();
     }
 }
示例#12
0
<?php

ihc_save_update_metas('opt_in');
//save update metas
$meta_arr = ihc_return_meta_arr('opt_in');
//getting metas
echo ihc_check_default_pages_set();
//set default pages message
?>
			<form action="" method="post">
				
				<div class="ihc-stuffbox">
					<h3><?php 
_e('Additional Main E-Mail', 'ihc');
?>
</h3>
					<div class="inside">	
						<input type="text" name="ihc_main_email" value="<?php 
echo $meta_arr['ihc_main_email'];
?>
" style="min-width: 300px;" />
						<div style="margin-top: 15px;">
							<input type="submit" value="<?php 
_e('Save', 'ihc');
?>
" name="ihc_save" class="button button-primary button-large" />
						</div>		
					</div>
				</div>
				
				<div class="ihc-stuffbox">