Exemplo n.º 1
0
 static function getInstance()
 {
     if (empty(self::$_this)) {
         self::$_this = new Emember_Config();
         self::$_this->loadConfig();
         return self::$_this;
     }
     return self::$_this;
 }
function shortlogin_callback()
{
    $emember_config = Emember_Config::getInstance();
    if (wp_emember_is_member_logged_in()) {
        $emember_auth = Emember_Auth::getInstance();
        //        _pre($emember_auth);
        $str = '<div class="eMember_compact_login">Hello, ' . $emember_auth->getUserInfo('first_name') . ' ' . $emember_auth->getUserInfo('last_name') . '  | <a href="' . get_logout_url() . '">Logout</a></div>';
    } else {
        $str = '<div class="eMember_compact_login"><a href="' . $emember_config->getValue('login_page_url') . '"> LoginEmpleados</a></div>';
    }
    return $str;
}
Exemplo n.º 3
0
 function widget($args, $instance)
 {
     // outputs the content of the widget
     extract($args);
     $emember_config = Emember_Config::getInstance();
     $widget_title = $emember_config->getValue('wp_eMember_widget_title');
     if (empty($widget_title)) {
         $widget_title = EMEMBER_MEMBER_LOGIN;
     }
     echo $before_widget;
     echo $before_title . $widget_title . $after_title;
     echo eMember_login_widget();
     echo $after_widget;
 }
function custom_comnpact_login()
{
    $emember_config = Emember_Config::getInstance();
    $join_url = $emember_config->getValue('eMember_payments_page');
    $auth = Emember_Auth::getInstance();
    $output = "";
    $output .= "<div class='eMember_compact_login'>";
    if ($auth->isLoggedIn()) {
        $output .= EMEMBER_HELLO;
        $name = $auth->getUserInfo('first_name') . " " . $auth->getUserInfo('last_name');
        $output .= $name;
        if (!empty($show_profile_link)) {
            $output .= ' | ';
            $edit_profile_page = $emember_config->getValue('eMember_profile_edit_page');
            $output .= '<a href="' . $edit_profile_page . '">' . EMEMBER_EDIT_PROFILE . '</a>';
        }
        $logout = get_logout_url();
        $output .= ' | ';
        $output .= '<a href="' . $logout . '">' . EMEMBER_LOGOUT . '</a>';
    } else {
        if (is_search()) {
            return get_login_link();
        }
        $output .= 'Returning Users: ';
        $eMember_enable_fancy_login = $emember_config->getValue('eMember_enable_fancy_login');
        if ($eMember_enable_fancy_login) {
            $output .= '<a id="' . microtime(true) . '" class="emember_fancy_login_link" href="javascript:void(0);">' . EMEMBER_LOGIN . '</a>';
            ob_start();
            include_once 'fancy_login.php';
            $output_fancy_jquery = ob_get_contents();
            ob_end_clean();
            $output .= $output_fancy_jquery;
        } else {
            $login_url = $emember_config->getValue('login_page_url');
            $output .= '<a href="' . $login_url . '">' . EMEMBER_LOGIN . '</a>';
        }
        $output .= '.   New Customers: ';
        $join_url = $emember_config->getValue('eMember_payments_page');
        $output .= '<a href="' . $join_url . '">Create an Account</a>';
    }
    $output .= "</div>";
    return $output;
}
Exemplo n.º 5
0
function eMember_log_cronjob_debug($message, $success, $end = false)
{
    global $emember_config;
    $emember_config = Emember_Config::getInstance();
    $debug_enabled = false;
    if ($emember_config->getValue('eMember_enable_debug') == 1) {
        $debug_enabled = true;
    }
    if (!$debug_enabled) {
        return;
    }
    //Debug is not enabled
    $debug_log_file_name = dirname(__FILE__) . '/eMember_debug_cronjob.log';
    // Timestamp
    $text = '[' . date('m/d/Y g:i A') . '] - ' . ($success ? 'SUCCESS :' : 'FAILURE :') . $message . "\n";
    if ($end) {
        $text .= "\n------------------------------------------------------------------\n\n";
    }
    // Write to log
    $fp = fopen($debug_log_file_name, 'a');
    fwrite($fp, $text);
    fclose($fp);
    // close file
}
Exemplo n.º 6
0
 function set_status()
 {
     if (!isset($_REQUEST['action2']) || empty($_REQUEST['action2'])) {
         return;
     }
     if (!isset($_REQUEST['members']) || empty($_REQUEST['members'])) {
         return;
     }
     $action = $_REQUEST['action2'] == -1 ? $_REQUEST['action'] : $_REQUEST['action2'];
     $status = '';
     $notify = false;
     switch ($action) {
         case 'bulk_active_notify':
             $notify = true;
         case 'bulk_active':
             $status = 'active';
             break;
         case 'bulk_inactive':
             $status = 'inactive';
             break;
         case 'bulk_pending':
             $status = 'pending';
             break;
         case 'bulk_expired':
             $status = 'expired';
             break;
     }
     if (empty($status)) {
         return;
     }
     $ids = implode(',', array_map('absint', $_REQUEST['members']));
     if (empty($ids)) {
         return;
     }
     global $wpdb;
     $query = "UPDATE " . $wpdb->prefix . "wp_eMember_members_tbl " . " SET account_state = '" . $status . "' WHERE member_id in (" . $ids . ")";
     $wpdb->query($query);
     if ($notify) {
         $emember_config = Emember_Config::getInstance();
         $login_url = $emember_config->getValue('login_page_url');
         $emails = $wpdb->get_col("SELECT email FROM " . $wpdb->prefix . "wp_eMember_members_tbl " . " WHERE member_id IN ( {$ids}  ) ");
         $subject = EMEMBER_BULK_ACTIVATION_EMAIL_SUBJECT;
         $body = EMEMBER_BULK_ACTIVATION_EMAIL_BODY;
         $headers = 'From: ' . get_option('admin_email') . "\r\n";
         $headers .= 'bcc: ' . implode(',', $emails) . "\r\n";
         wp_mail(array(), $subject, $body, $headers);
         eMember_log_debug("Bulk activation email notification sent.", true);
     }
 }
Exemplo n.º 7
0
function access_list_ajax()
{
    if (!current_user_can('manage_options')) {
        die("Access Forbidden");
    }
    $emember_config = Emember_Config::getInstance();
    $items_per_page = $emember_config->getValue('eMember_rows_per_page');
    $items_per_page = trim($items_per_page);
    $items_per_page = !empty($items_per_page) && is_numeric($items_per_page) ? $items_per_page : 30;
    $count = 0;
    $tab = $_REQUEST['tab'];
    $levelId = $_REQUEST['level'];
    if (emember_is_ajax()) {
        global $wpdb;
        switch ($_REQUEST['tab']) {
            case 'comments':
                $num_comm = get_comment_count();
                $count = $num_comm['approved'];
                break;
            case 'posts':
                $query = "SELECT count(*) from {$wpdb->posts} WHERE post_status='publish' AND post_type='post'";
                $count = $wpdb->get_var($query);
                break;
            case 'pages':
                $count = wp_count_posts('page');
                $count = $count->publish;
                break;
            case 'categories':
                $count = wp_count_terms('category');
                break;
            case 'attachments':
                $query = "SELECT count(*) from {$wpdb->posts} WHERE post_status='inherit' AND post_type='attachment'";
                $count = $wpdb->get_var($query);
                break;
            case 'custom-posts':
                $args = array('public' => true, '_builtin' => false);
                $post_types = get_post_types($args);
                $arg = "'" . implode('\',\'', $post_types) . "'";
                if (empty($arg)) {
                    $count = 0;
                } else {
                    $query = "SELECT count(*) from {$wpdb->posts} WHERE (post_status='inherit' OR post_status='publish') AND post_type IN (" . $arg . ")";
                    $count = $wpdb->get_var($query);
                }
                break;
        }
        ob_start();
        include 'js/membership_level.php';
        $output = ob_get_contents();
        ob_end_clean();
        echo $output;
    }
    exit(0);
}
Exemplo n.º 8
0
function wp_emember_initialize_db()
{
    include_once 'emember_config.php';
    $emember_config = Emember_Config::getInstance();
    $wp_eMember_rego_field_default_settings_ver = 1;
    $currently_installed_ver = get_option("wp_eMember_rego_field_default_settings_ver");
    if ($currently_installed_ver < $wp_eMember_rego_field_default_settings_ver) {
        //TODO - remove @v9
        //$emember_config->loadConfig();
        $emember_config->setValue('eMember_reg_firstname', "checked='checked'");
        $emember_config->setValue('eMember_reg_lastname', "checked='checked'");
        $emember_config->setValue('eMember_edit_firstname', "checked='checked'");
        $emember_config->setValue('eMember_edit_lastname', "checked='checked'");
        $emember_config->setValue('eMember_edit_company', "checked='checked'");
        $emember_config->setValue('eMember_edit_email', "checked='checked'");
        $emember_config->setValue('eMember_edit_phone', "checked='checked'");
        $emember_config->setValue('eMember_edit_street', "checked='checked'");
        $emember_config->setValue('eMember_edit_city', "checked='checked'");
        $emember_config->setValue('eMember_edit_state', "checked='checked'");
        $emember_config->setValue('eMember_edit_zipcode', "checked='checked'");
        $emember_config->setValue('eMember_edit_country', "checked='checked'");
        $emember_config->saveConfig();
        add_option("wp_eMember_rego_field_default_settings_ver", $wp_eMember_rego_field_default_settings_ver);
    }
    /*     * * Settings default values at activation time ** */
    $senders_email_address = get_bloginfo('name') . " <" . get_bloginfo('admin_email') . ">";
    $eMember_email_subject = "Complete your registration";
    $eMember_email_body = "Dear {first_name} {last_name}" . "\n\nThank you for joining us!" . "\n\nPlease complete your registration by visiting the following link:" . "\n\n{reg_link}" . "\n\nThank You";
    add_option('senders_email_address', stripslashes($senders_email_address));
    add_option('eMember_email_subject', stripslashes($eMember_email_subject));
    add_option('eMember_email_body', stripslashes($eMember_email_body));
    $admin_email = get_option('admin_email');
    $emember_config->addValue('eMember_admin_notification_email_address', $admin_email);
    $emember_config->addValue('eMember_account_upgrade_email_subject', "Member Account Upgraded");
    $emember_config->addValue('eMember_account_upgrade_email_body', "Hi, Your account profile has been updated according to your latest payment.\n\nPlease log into your member profile to view the details.\n\nThank You");
    $emember_config->addValue('eMember_autoupgrade_senders_email_address', $senders_email_address);
    $emember_config->addValue('eMember_autoupgrade_email_subject', "Your Membership Details");
    $eMember_autoupgrade_email_body = "Hi,\nYour membership account has been upgraded." . "\nPlease log into your member profile to view the details." . "\n\nThank You";
    $emember_config->addValue('eMember_autoupgrade_email_body', $eMember_autoupgrade_email_body);
    $emember_config->addValue('eMember_status_change_email_subject', "Account Status Updated!");
    $eMember_status_change_email_body = 'Hi, Your account status has been updated.\\n\\nPlease log into your member profile to view the details.\\n\\nThank You';
    $emember_config->addValue('eMember_status_change_email_body', $eMember_status_change_email_body);
    /*     * * Setting default values at upgrade time ** */
    $emember_config->addValue('eMember_profile_thumbnail', "checked='checked'");
    $secrete_code = uniqid();
    $emember_config->addValue('wp_eMember_secret_word_for_post', $secrete_code);
    $emember_config->addValue('emember_members_menu_pagination_value', 50);
    $emember_config->setValue('wp_eMember_plugin_activation_check_flag', '1');
    /*     * * Create the mandatory configuration pages ** */
    // Check and create the member login page
    $create_login_page = '';
    if (!array_key_exists('login_page_url', $emember_config->configs)) {
        $create_login_page = '1';
    } else {
        if (array_key_exists('login_page_url', $emember_config->configs)) {
            if ($emember_config->getValue('login_page_url') == "") {
                $create_login_page = '1';
            }
        }
    }
    if ($create_login_page == '1') {
        // Create a new page object for Collect-Details page
        $eMember_login_page = array('post_type' => 'page', 'post_title' => 'Member Login', 'post_content' => '[wp_eMember_login]', 'post_status' => 'publish');
        $page_id = wp_insert_post($eMember_login_page);
        $eMember_login_page_permalink = get_permalink($page_id);
        $emember_config->setValue('login_page_url', $eMember_login_page_permalink);
    }
    // Check and create the member join us page
    $create_join_page = '';
    if (!array_key_exists('eMember_payments_page', $emember_config->configs)) {
        $create_join_page = '1';
    } else {
        if (array_key_exists('eMember_payments_page', $emember_config->configs)) {
            if ($emember_config->getValue('eMember_payments_page') == "") {
                $create_join_page = '1';
            }
        }
    }
    if ($create_join_page == '1') {
        // Create a new page object for Collect-Details page
        $eMember_join_page_content = '<p style="color:red;font-weight:bold;">This page and the content has been automatically generated for you to give you a basic idea of how a Join Us page should look like. You can customize this page however you like it by editing this page from your WordPress page editor.</p>';
        $eMember_join_page_content .= '<p style="font-weight:bold;">If you end up changing the URL of this page then make sure to update the URL value in the pages/forms settings menu of the plugin.</p>';
        $eMember_join_page_content .= '<p style="border-top:1px solid #ccc;padding-top:10px;margin-top:10px;"></p>
			<strong>Free Membership</strong>
			<br />
			You get unlimited access to free membership content
			<br />
			<em><strong>Price: Free!</strong></em>
			<br /><br />Link the following image to go to the Registration Page if you want your visitors to be able to create a free membership account<br /><br />
			<img title="Join Now" src="' . WP_EMEMBER_URL . '/images/join-now-button-image.gif" alt="Join Now Button" width="277" height="82" />
			<p style="border-bottom:1px solid #ccc;padding-bottom:10px;margin-bottom:10px;"></p>';
        $eMember_join_page_content .= '<p><strong>You can register for a Free Membership or pay for one of the following membership options</strong></p>';
        $eMember_join_page_content .= '<p style="border-top:1px solid #ccc;padding-top:10px;margin-top:10px;"></p>
			[ ==> Insert Payment Button For Your Paid Membership Levels Here <== ]
			<p style="border-bottom:1px solid #ccc;padding-bottom:10px;margin-bottom:10px;"></p>';
        $eMember_join_page = array('post_type' => 'page', 'post_title' => 'Join Us', 'post_content' => $eMember_join_page_content, 'post_status' => 'publish');
        $join_page_id = wp_insert_post($eMember_join_page);
        $eMember_join_page_permalink = get_permalink($join_page_id);
        $emember_config->setValue('eMember_payments_page', $eMember_join_page_permalink);
        // Create registration page
        $eMember_rego_page = array('post_type' => 'page', 'post_title' => 'Registration', 'post_content' => '[wp_eMember_registration]', 'post_parent' => $join_page_id, 'post_status' => 'publish');
        $rego_page_id = wp_insert_post($eMember_rego_page);
        $eMember_rego_page_permalink = get_permalink($rego_page_id);
        $emember_config->setValue('eMember_registration_page', $eMember_rego_page_permalink);
        add_option('eMember_registration_page', $eMember_rego_page_permalink);
    }
    /*     * * end of mandatory configuration page creation ** */
    //Save the data
    $emember_config->saveConfig();
    wp_emember_migrate_protection_list();
    emember_update_profile_image_migration();
}
Exemplo n.º 9
0
function wp_eMember_general_settings()
{
    $emember_config = Emember_Config::getInstance();
    if (isset($_POST['wp_emember_reset_logfile'])) {
        if (wp_emember_reset_log_files()) {
            echo '<div id="message" class="updated fade"><p><strong>Debug log files have been reset!</strong></p></div>';
        } else {
            echo '<div id="message" class="updated fade"><p><strong>Debug log files could not be reset!</strong></p></div>';
        }
    } else {
        if (isset($_POST['info_update'])) {
            $msg = '';
            if ($_POST['eMember_enable_free_membership']) {
                if (empty($_POST["eMember_free_membership_level_id"])) {
                    $msg .= 'Please set free membership ID.<br />';
                } else {
                    if ($_POST["eMember_free_membership_level_id"] == 1) {
                        $msg .= 'Membership level with the given ID is reserved ! <br / > Please use different one.<br />';
                    } else {
                        if (is_numeric($_POST["eMember_free_membership_level_id"])) {
                            $l = dbAccess::find(WP_EMEMBER_MEMBERSHIP_LEVEL_TABLE, " id='" . $_POST["eMember_free_membership_level_id"] . "' ");
                            if ($l) {
                                $emember_config->setValue('eMember_enable_free_membership', 'checked="checked"');
                                $emember_config->setValue('eMember_free_membership_level_id', (string) $_POST["eMember_free_membership_level_id"]);
                            } else {
                                $msg .= 'Membership level with the given ID is not defined! <br / > Please correct it.<br />';
                            }
                        } else {
                            $msg .= 'Membership level with the given ID is not a number! <br / > Please correct it.<br />';
                        }
                    }
                }
            } else {
                $emember_config->setValue('eMember_enable_free_membership', '');
                $emember_config->setValue('eMember_free_membership_level_id', '');
            }
            if (!empty($_POST['eMember_login_limit'])) {
                if (is_numeric($_POST['eMember_login_limit'])) {
                    $emember_config->setValue('eMember_login_limit', (string) $_POST["eMember_login_limit"]);
                } else {
                    $msg .= 'Login Limit must be a number! <br / > Please correct it.<br />';
                    $emember_config->setValue('eMember_login_limit', '');
                }
            } else {
                $emember_config->setValue('eMember_login_limit', '');
            }
            $emember_config->setValue('eMember_free_members_must_confirm_email', isset($_POST["eMember_free_members_must_confirm_email"]) ? 1 : '');
            $emember_config->setValue('wp_eMember_widget_title', (string) $_POST["wp_eMember_widget_title"]);
            $emember_config->setValue('wp_eMember_auto_logout', (string) $_POST["wp_eMember_auto_logout"]);
            $emember_config->setValue('eMember_language', (string) $_POST["eMember_language"]);
            //$emember_config->setValue('non_members_error_page',(string)$_POST["non_members_error_page"]);
            //$emember_config->setValue('wrong_membership_level', (string)$_POST["wrong_membership_level"]);
            $emember_config->setValue('eMember_rows_per_page', (string) $_POST["eMember_rows_per_page"]);
            $emember_config->setValue('eMember_enable_more_tag', isset($_POST["eMember_enable_more_tag"]) ? 1 : '');
            $emember_config->setValue('eMember_enable_redirection', isset($_POST["eMember_enable_redirection"]) ? 1 : '');
            $emember_config->setValue('eMember_enable_auto_login_after_rego', isset($_POST["eMember_enable_auto_login_after_rego"]) ? 1 : '');
            $emember_config->setValue('eMember_create_wp_user', isset($_POST["eMember_create_wp_user"]) ? 1 : '');
            $emember_config->setValue('eMember_signin_wp_user', isset($_POST["eMember_signin_wp_user"]) ? 1 : '');
            $emember_config->setValue('eMember_enable_bookmark', isset($_POST["eMember_enable_bookmark"]) ? 1 : '');
            $emember_config->setValue('eMember_enable_bookmark_for_loggedin', isset($_POST["eMember_enable_bookmark_for_loggedin"]) ? 1 : '');
            $emember_config->setValue('eMember_allow_expired_account', isset($_POST["eMember_allow_expired_account"]) ? "checked='checked'" : '');
            $emember_config->setValue('eMember_account_upgrade_url', isset($_POST["eMember_account_upgrade_url"]) ? $_POST["eMember_account_upgrade_url"] : '');
            $emember_config->setValue('eMember_signin_emem_user', isset($_POST["eMember_signin_emem_user"]) ? 1 : '');
            $emember_config->setValue('eMember_preserve_wp_user_role', isset($_POST["eMember_preserve_wp_user_role"]) ? 1 : '');
            $emember_config->setValue('eMember_auto_affiliate_account', isset($_POST["eMember_auto_affiliate_account"]) ? 1 : '');
            $emember_config->setValue('eMember_auto_affiliate_account_login', isset($_POST["eMember_auto_affiliate_account_login"]) ? 1 : '');
            $emember_config->setValue('wp_eMember_affiliate_account_restriction_list', trim($_POST["wp_eMember_affiliate_account_restriction_list"]));
            $emember_config->setValue('eMember_enable_debug', isset($_POST["eMember_enable_debug"]) ? 1 : '');
            $emember_config->setValue('eMember_enable_sandbox', isset($_POST["eMember_enable_sandbox"]) ? 1 : '');
            $emember_config->setValue('eMember_enable_public_profile', isset($_POST["eMember_enable_public_profile"]) ? 1 : '');
            $emember_config->setValue('eMember_allow_account_removal', isset($_POST["eMember_allow_account_removal"]) ? 1 : '');
            $emember_config->setValue('eMember_allow_wp_account_removal', isset($_POST["eMember_allow_wp_account_removal"]) ? 1 : '');
            $emember_config->setValue('eMember_secure_rss', isset($_POST["eMember_secure_rss"]) ? 1 : '');
            $emember_config->setValue('eMember_show_link_to_after_login_page', isset($_POST["eMember_show_link_to_after_login_page"]) ? 1 : '');
            $emember_config->setValue('eMember_enable_fancy_login', isset($_POST["eMember_enable_fancy_login"]) ? $_POST["eMember_enable_fancy_login"] : '');
            $emember_config->setValue('emember_disable_bookmark_by_page', isset($_POST['emember_disable_bookmark_by_page']) ? $_POST['emember_disable_bookmark_by_page'] : array());
            $emember_config->setValue('emember_disable_bookmark_by_type', isset($_POST['emember_disable_bookmark_by_type']) ? $_POST['emember_disable_bookmark_by_type'] : array());
            $emember_config->setValue('eMember_disable_inline_login', isset($_POST["eMember_disable_inline_login"]) ? 1 : '');
            $emember_config->setValue('eMember_enable_domain_lockdown', isset($_POST["eMember_enable_domain_lockdown"]) ? $_POST["eMember_enable_domain_lockdown"] : 0);
            $emember_config->setValue('eMember_use_gravatar', isset($_POST["eMember_use_gravatar"]) ? "checked='checked'" : '');
            $emember_config->setValue('eMember_override_avatar', isset($_POST["eMember_override_avatar"]) ? "checked='checked'" : '');
            $emember_config->setValue('eMember_custom_field', isset($_POST["eMember_custom_field"]) ? "checked='checked'" : '');
            $emember_config->setValue('eMember_email_notification', isset($_POST["eMember_email_notification"]) ? "checked='checked'" : '');
            $emember_config->setValue('eMember_protect_comments_separately', isset($_POST["eMember_protect_comments_separately"]) ? "checked='checked'" : '');
            $emember_config->setValue('eMember_enable_secondary_membership', isset($_POST["eMember_enable_secondary_membership"]) ? "checked='checked'" : '');
            $emember_config->setValue('eMember_secondary_membership_migrate', isset($_POST["eMember_secondary_membership_migrate"]) ? "checked='checked'" : '');
            $emember_config->setValue('eMember_manually_approve_member_registration', isset($_POST["eMember_manually_approve_member_registration"]) ? 1 : '');
            $emember_config->setValue('eMember_member_can_comment_only', isset($_POST["eMember_member_can_comment_only"]) ? 1 : '');
            $emember_config->setValue('eMember_google_first_click_free', isset($_POST["eMember_google_first_click_free"]) ? 1 : '');
            $tmpmsg = htmlentities(stripslashes($_POST['eMember_google_first_click_free_custom_msg']), ENT_COMPAT, "UTF-8");
            $emember_config->setValue('eMember_google_first_click_free_custom_msg', $tmpmsg);
            $emember_config->setValue('eMember_format_post_page_protected_msg', isset($_POST["eMember_format_post_page_protected_msg"]) ? 1 : '');
            $emember_config->setValue('eMember_turn_off_protected_msg_formatting', isset($_POST["eMember_turn_off_protected_msg_formatting"]) ? 1 : '');
            $emember_config->setValue('eMember_multiple_logins', isset($_POST["eMember_multiple_logins"]) ? 1 : '');
            $emember_config->setValue('eMember_multiple_logins_type', (string) $_POST["eMember_multiple_logins_type"]);
            //facebook feature
            //$emember_config->setValue('eMember_enable_fb_reg', isset($_POST["eMember_enable_fb_reg"])?"checked='checked'":'');
            $emember_config->setValue('eMember_secure_rss_seed', isset($_POST["eMember_secure_rss_seed"]) ? (string) $_POST["eMember_secure_rss_seed"] : "My Secret RSS Seed");
            $emember_config->setValue('eMember_domain_lockdown_exclude_url', (string) $_POST['eMember_domain_lockdown_exclude_url']);
            $emember_config->setValue('eMember_domain_lockdown_exclude_url_pattern', (string) $_POST['eMember_domain_lockdown_exclude_url_pattern']);
            $emember_config->setValue('eMember_domain_lockdown_include_url', (string) $_POST['eMember_domain_lockdown_include_url']);
            $emember_config->setValue('eMember_domain_lockdown_alt2popup', (string) $_POST['eMember_domain_lockdown_alt2popup']);
            $emember_config->setValue('wp_eMember_enable_remote_post', isset($_POST["wp_eMember_enable_remote_post"]) ? 1 : '');
            $emember_config->setValue('wp_eMember_secret_word_for_post', trim($_POST["wp_eMember_secret_word_for_post"]));
            echo '<div id="message" class="updated fade"><p>';
            echo $msg ? '<strong style="color:red;">' . $msg : '<strong>Options Updated!';
            echo '</strong></p></div>';
            $emember_config->saveConfig();
        }
    }
    if ($emember_config->getValue('eMember_enable_free_membership')) {
        $eMember_enable_free_membership = 'checked="checked"';
    } else {
        $eMember_enable_free_membership = '';
    }
    ?>
    <div class="eMember_grey_box">
        <p>For detailed documentation, information and updates, please visit the <a href="http://www.tipsandtricks-hq.com/wordpress-membership" target="_blank">WP eMember Documentation Page</a></p>
        <p>WP eMember plugin has a lot of setting options but don't get intimidated by it. Most of the default settings are good to get you started (keep things simple at first). Remember to watch the video tutorials from eMember's documentation page.</p>
        <p>Like the plugin? Give us a <a href="http://www.tipsandtricks-hq.com/?p=1706#gfts_share" target="_blank">thumbs up here</a> by clicking on a share button or leave a comment to let us know.</p>
    </div>

    <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
        <input type="hidden" name="info_update" id="info_update" value="true" />
        <div class="wrap">
            <div id="poststuff">
                <div id="post-body">
                    <!-- <div class="basic" style="float:left;"  id="list1a"> -->
                    <!-- <div class="title"><label for="title">General Settings</label></div> -->
                    <div class="postbox">
                        <h3><label for="title">General Settings</label></h3>
                        <div class="inside">
                            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>eMember Language:</strong>
                                    </td>
                                    <td align="left">
                                        <?php 
    $lang = $emember_config->getValue('eMember_language');
    ?>
                                        <select name="eMember_language" >
                                            <option <?php 
    echo $lang === 'eng' ? 'selected="selected"' : '';
    ?>
 value="eng">English</option>
                                            <option <?php 
    echo $lang === 'fr' ? 'selected="selected"' : '';
    ?>
 value="fr">French</option>
                                            <option <?php 
    echo $lang === 'ger' ? 'selected="selected"' : '';
    ?>
 value="ger">German</option>
                                            <option <?php 
    echo $lang === 'nld' ? 'selected="selected"' : '';
    ?>
 value="nld">Dutch</option>
                                            <option <?php 
    echo $lang === 'heb' ? 'selected="selected"' : '';
    ?>
 value="heb">Hebrew</option>
                                            <option <?php 
    echo $lang === 'ita' ? 'selected="selected"' : '';
    ?>
 value="ita">Italian</option>
                                            <option <?php 
    echo $lang === 'spa' ? 'selected="selected"' : '';
    ?>
 value="spa">Spanish</option>
                                            <option <?php 
    echo $lang === 'pl' ? 'selected="selected"' : '';
    ?>
 value="pl">Polish</option>
                                            <option <?php 
    echo $lang === 'ptg' ? 'selected="selected"' : '';
    ?>
 value="ptg">Portuguese</option>
                                        </select><br/>
                                        <i>Select the language that you want your emember be displayed in.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Allow Free Membership:</strong>
                                    </td>
                                    <td align="left">
                                        <input type="checkbox" name="eMember_enable_free_membership" value="1" <?php 
    echo $eMember_enable_free_membership;
    ?>
 /><br />
                                        <i>If you want to allow free membership on your site then check this box and specify the free Membership Level ID below. Visitors can register for a free membership by visiting the registration page.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Free Membership Level ID:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_free_membership_level_id" type="text" size="4" value="<?php 
    echo $emember_config->getValue('eMember_free_membership_level_id');
    ?>
"/><br /><i>If you want to allow free membership on your site then create a free membership level from the Manage Levels menu and specify the Level ID of that membership level here</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Free Members Must Confirm Email Address:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_free_members_must_confirm_email" type="checkbox"  <?php 
    $eMember_free_members_must_confirm_email = $emember_config->getValue('eMember_free_members_must_confirm_email');
    echo $eMember_free_members_must_confirm_email ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>If you want to force your free members to confirm their email address before they can register for an account then use this option. <a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=460" target="_blank">Read the full documentation</a> for this feature before using it.</i><br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Entries Per Page:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_rows_per_page" type="text" size="4" value="<?php 
    echo $emember_config->getValue('eMember_rows_per_page');
    ?>
"/><br />
                                        <i>Number of rows in each page for any list (example: the Manage Content Protection page). This value is used for pagination purpose.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable More Tag Protection:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_enable_more_tag" type="checkbox"  <?php 
    $enable_more_tag = $emember_config->getValue('eMember_enable_more_tag');
    echo $enable_more_tag ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>Enables or disables "more" tag protection in the posts and pages. Anything after the More tag is protected. Anything before the more tag is teaser content</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable Public profile Listing:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_enable_public_profile" type="checkbox"  <?php 
    $enable_public_profile = $emember_config->getValue('eMember_enable_public_profile');
    echo $enable_public_profile ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>This enables the member profiles to be publicly available for others to browse. Use the [wp_eMember_user_list] shortcode on a page to display all the member profiles.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Allow Account Deletion:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_allow_account_removal" type="checkbox"  <?php 
    $eMember_allow_account_removal = $emember_config->getValue('eMember_allow_account_removal');
    echo $eMember_allow_account_removal ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>Allows the member to delete their member account from the edit profile page.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Allow Wordpress Account Deletion:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_allow_wp_account_removal" type="checkbox"  <?php 
    $eMember_allow_wp_account_removal = $emember_config->getValue('eMember_allow_wp_account_removal');
    echo $eMember_allow_wp_account_removal ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>If checked the corresponding WordPress user account will also be deleted when a member deletes his/her eMember account from the edit profile page</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable Secondary Membership:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_enable_secondary_membership" id="eMember_enable_secondary_membership" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_enable_secondary_membership');
    ?>
 value="1"/>
                                        <i>Enable the ability to assign multiple membership levels per user. <a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=291" target="_blank">Read More Here</a></i>
                                        <br />
                                        <input name="eMember_secondary_membership_migrate" id="eMember_secondary_membership_migrate"  type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_secondary_membership_migrate');
    ?>
 value="1"/>
                                        <i>When a member's primary level expires, automatically set one of the non-expired secondary level as his primary level.</i>
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Use Gravatar Image in Profile:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_use_gravatar" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_use_gravatar');
    ?>
 value="1"/><br />
                                        <i>Check this if if you want to use a member's existing Gravatar image in eMember profile.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Use Profile Image in WordPress Comment Avatar:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_override_avatar" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_override_avatar');
    ?>
 value="1"/><br />
                                        <i>Check this if you want eMember to show member's uploaded profile image in WordPress comment avatar.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable Custom Fields: </strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_custom_field" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_custom_field');
    ?>
 value="1"/><br />
                                        <i>Enable/Disable the custom fields feature. You can configure custom fields from the "Custom Fields" settings tab.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable Auto Expiry Email Notification: </strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_email_notification" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_email_notification');
    ?>
 value="1"/><br />
                                        <i>Enable/Disable automatic membership expiry email notification. For example, the plugin will automatically send an email to the member after their membership expires. You can configure the email in the <a href="admin.php?page=eMember_settings_menu&tab=2" target="_blank">Email Settings page</a></i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Manually Approve Member Registration:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_manually_approve_member_registration" type="checkbox"  <?php 
    $eMember_manually_approve_member_registration = $emember_config->getValue('eMember_manually_approve_member_registration');
    echo $eMember_manually_approve_member_registration ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>If you want to manually approve the member after they register then check this option. A member's account will be "Pending" after registration and the member will not be able to log in until you manually set the status to "Active".</i><br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Protect Comments Separately:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_protect_comments_separately" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_protect_comments_separately');
    ?>
 value="1"/><br />
                                        <i>By default all the comments on a post that is protected are also protected. If you want to individually protect each comment then check this option and protect the comments individually from the <a href="admin.php?page=eMember_membership_level_menu&level_action=2" target="_blank">Manage Content Protection</a> menu.</i><br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Members Must be Logged in to Comment</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_member_can_comment_only" type="checkbox"  <?php 
    $eMember_member_can_comment_only = $emember_config->getValue('eMember_member_can_comment_only');
    echo $eMember_member_can_comment_only ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>Check this option if you only want to allow the members of the site to be able to post a comment.</i><br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable Google First Click Free Feature</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_google_first_click_free" type="checkbox"  <?php 
    $eMember_google_first_click_free = $emember_config->getValue('eMember_google_first_click_free');
    echo $eMember_google_first_click_free ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>Check this option if you want to enable the Google first click free feature. <a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=413" target="_blank">Read More Here</a></i>
                                        <br /><input name="eMember_google_first_click_free_custom_msg" type="text" size="100" value="<?php 
    echo $emember_config->getValue('eMember_google_first_click_free_custom_msg');
    ?>
"/><br />
                                        <i>If you want to show a custom message to your first click free viewers who land on a protected post then specify the message in the above field.</i>
                                        <br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Format the Post/Page Protected Message</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_format_post_page_protected_msg" type="checkbox"  <?php 
    $eMember_format_post_page_protected_msg = $emember_config->getValue('eMember_format_post_page_protected_msg');
    echo $eMember_format_post_page_protected_msg ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>By default eMember shows plain text for the post/page protection message (Please Login to view this Content...). If you want the post/page protected message to stand out then check this option and it will apply a subtle formatting to the post/page protection message.</i><br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Turn Off Protected Message Formatting</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_turn_off_protected_msg_formatting" type="checkbox"  <?php 
    $eMember_turn_off_protected_msg_formatting = $emember_config->getValue('eMember_turn_off_protected_msg_formatting');
    echo $eMember_turn_off_protected_msg_formatting ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>By default eMember formats the section protection messages to make it easily visible by placing it inside a warning box. Check this option if you do not want eMember to apply any formatting to the section protection messages (this will make eMember output the plain text only).</i><br /><br />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>

                    <div class="postbox">
                        <h3><label for="title">Member Login Related Settings</label></h3>
                        <div class="inside">
                            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Login Widget Title:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="wp_eMember_widget_title" type="text" size="100" value="<?php 
    echo $emember_config->getValue('wp_eMember_widget_title');
    ?>
"/><br/>
                                        <i>You can customize the login widget title here. This title is displayed when you use the eMember login widget from the widgets menu.</i><br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable After login Redirection:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_enable_redirection" type="checkbox"  <?php 
    $enable_redirection = $emember_config->getValue('eMember_enable_redirection');
    echo $enable_redirection ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>Enables or disables redirection to a specific page after member login. You can specify the after login page in the member's profile or membership level or in the pages settings menu.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable Auto Login After Registration:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_enable_auto_login_after_rego" type="checkbox"  <?php 
    $eMember_enable_auto_login_after_rego = $emember_config->getValue('eMember_enable_auto_login_after_rego');
    echo $eMember_enable_auto_login_after_rego ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>Use this option if you want to automatically log in your members right after they complete the registration.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Display Secure RSS Feed:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_secure_rss" type="checkbox"  <?php 
    $eMember_secure_rss = $emember_config->getValue('eMember_secure_rss');
    echo $eMember_secure_rss ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>When checked the login widget will display a secure RSS feed link to the members.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Display a Link to Member's Welcome Page:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_show_link_to_after_login_page" type="checkbox"  <?php 
    $eMember_show_link_to_after_login_page = $emember_config->getValue('eMember_show_link_to_after_login_page');
    echo $eMember_show_link_to_after_login_page ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>When checked the login widget will display a link to the member's welcome page (the after login page). The member will be able to click on this link to get to the member's welcome page (if you have specified one). You can specify the after login page URL in the <code>Pages/Forms Settings</code> tab.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable Fancy Login Widget/Popup:</strong>
                                    </td>
                                    <td align="left">
                                        <input id="eMember_enable_fancy_login" name="eMember_enable_fancy_login" type="checkbox"  <?php 
    $eMember_enable_fancy_login = $emember_config->getValue('eMember_enable_fancy_login');
    echo $eMember_enable_fancy_login ? 'checked="checked"' : '';
    ?>
 value="<?php 
    echo empty($eMember_enable_fancy_login) ? 1 : $eMember_enable_fancy_login;
    ?>
"/>
                                        use
                                        <select id="emember_fancy_login_v">
                                            <option value="1">Style 1</option>
                                            <option value="2">Style 2</option>
                                        </select>
                                        <br />
                                        <i>When checked, clicking the login link will make the login widget/popup appear in a stylish way rather than redirecting to the login page.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Disable Inline Login Widget Option:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_disable_inline_login" type="checkbox"  <?php 
    $eMember_disable_inline_login = $emember_config->getValue('eMember_disable_inline_login');
    echo $eMember_disable_inline_login ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>By default eMember shows an inline login widget when your users click on a login link inside a post or page. Checking this option will disable the inline login widget and redirect the user to the login page.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Login Restriction by IP Address:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_login_limit" type="text" size="4" value="<?php 
    echo $emember_config->getValue('eMember_login_limit');
    ?>
"/><i> IPs per day
                                            <br />If the number of login attempts from different IP addresses exceed this limit then the member's account will be locked. Leave this field empty to disable this feature.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Logout Member After XX Minutes of Inactivity:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="wp_eMember_auto_logout" type="text" size="5" value="<?php 
    echo $emember_config->getValue('wp_eMember_auto_logout');
    ?>
"/> Minutes<br/>
                                        <i>Use this option if you want to force your members to re-authenticate after XX minutes of inactivity. Leave this field empty or use a value of 0 to disable this feature.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Disable Simultaneous Member Login</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_multiple_logins" type="checkbox"  <?php 
    $eMember_multiple_logins = $emember_config->getValue('eMember_multiple_logins');
    echo $eMember_multiple_logins ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>Check this option to disable simultaneous member login using the same member account details (two users cannot log-in to the same account and view protected content at the same time). The <code>Remember me</code> feature of the login form will be disabled when this feature is enabled.</i><br />
                                        <?php 
    $multiple_logins_type = $emember_config->getValue('eMember_multiple_logins_type');
    if (empty($multiple_logins_type)) {
        $multiple_logins_type = 'last';
    }
    ?>
                                        <input type="radio" value="last" <?php 
    if ($multiple_logins_type == 'last') {
        echo 'checked="checked"';
    }
    ?>
 name="eMember_multiple_logins_type" /> Keep only most recent login active<br />
                                        <input type="radio" value="current" <?php 
    if ($multiple_logins_type == 'current') {
        echo 'checked="checked"';
    }
    ?>
 name="eMember_multiple_logins_type" /> Keep only current session active<br />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>

                    <div class="postbox">
                        <h3><label for="title">Account Upgrade and Renewal Settings</label></h3>
                        <div class="inside">
                            <strong><i>When a logged in member makes a new membership payment, his/her account is automatically upgraded/renewed to reflect the recent payment.</i></strong><br /><br />
                            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Allow Expired Account login:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_allow_expired_account" type="checkbox"  <?php 
    $allow_expired = $emember_config->getValue('eMember_allow_expired_account');
    echo $allow_expired ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>When checked members whose account has expired will be able to log into the system but won't be able to view any protected content. This will allow them to easily renew their account by making another payment.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Membership renewal Page:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_account_upgrade_url" type="text" size="100" value="<?php 
    echo $emember_config->getValue('eMember_account_upgrade_url');
    ?>
"/><br />
                                        <i>The URL of the page where members can renew their membership. You can simply use the same page as the "Membership Payment/Join Page".</i><br /><br />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div class="postbox">
                        <h3><label for="title">Bookmark Feature Settings</label></h3>
                        <div class="inside">
                            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable Bookmarking Feature:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_enable_bookmark" type="checkbox"  <?php 
    $enable_bookmark = $emember_config->getValue('eMember_enable_bookmark');
    echo $enable_bookmark ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>Allows your members to be able to bookmark your posts and pages for easy access later. Learn <a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=99" target="_blank">how to use the bookmarking feature</a>.</i><br />
                                    </td>
                                </tr>
                                <tr>
                                    <td width="25%" align="left"></td>
                                    <td align="left"><input name="eMember_enable_bookmark_for_loggedin" type="checkbox"  <?php 
    $enable_bookmark_loggedin = $emember_config->getValue('eMember_enable_bookmark_for_loggedin');
    echo $enable_bookmark_loggedin ? 'checked="checked"' : '';
    ?>
 value="1"/> Show bookmark feature ONLY to members who are logged-in</td>
                                </tr>

                                <tr>
                                    <td width="25%" align="left"></td>
                                    <td align="left">Disable Bookmark Feature on:</td>
                                </tr>
                                <tr>
                                    <?php 
    $emember_disable_bookmark_by_page = (array) $emember_config->getValue('emember_disable_bookmark_by_page');
    ?>
                                    <td width="25%" align="left"></td>
                                    <td align="left"><input type="checkbox" name="emember_disable_bookmark_by_page[]" value="home" <?php 
    echo in_array('home', $emember_disable_bookmark_by_page) ? "checked='checked'" : "";
    ?>
  /> Home Page</td>
                                </tr>
                                <tr>
                                    <td width="25%" align="left"></td>
                                    <td align="left"><input type="checkbox" name="emember_disable_bookmark_by_page[]" value="category" <?php 
    echo in_array('category', $emember_disable_bookmark_by_page) ? "checked='checked'" : "";
    ?>
 /> Category Archives</td>
                                </tr>
                                <tr>
                                    <td width="25%" align="left"></td>
                                    <td align="left"><input type="checkbox" name="emember_disable_bookmark_by_page[]" value="search" <?php 
    echo in_array('search', $emember_disable_bookmark_by_page) ? "checked='checked'" : "";
    ?>
 /> Search Result</td>
                                </tr>
                                <tr>
                                    <td width="25%" align="left"></td>
                                    <td align="left">Disable Bookmark Feature by Post Type:</td>
                                </tr>
                                <?php 
    $emember_disable_bookmark_by_type = $emember_config->getValue('emember_disable_bookmark_by_type');
    ?>
                                <?php 
    $emember_disable_bookmark_by_type = empty($emember_disable_bookmark_by_type) ? array() : $emember_disable_bookmark_by_type;
    ?>
                                <?php 
    foreach (get_post_types('', 'objects', array('public' => true)) as $key => $value) {
        ?>
                                    <?php 
        $ischecked = in_array($key, $emember_disable_bookmark_by_type) ? "checked='checked'" : "";
        ?>
                                    <tr>
                                        <td width="25%" align="left"></td>
                                        <td align="left"><input type="checkbox" name="emember_disable_bookmark_by_type[]" value="<?php 
        echo $key;
        ?>
" <?php 
        echo $ischecked;
        ?>
 /><?php 
        echo " " . $value->label;
        ?>
</td>
                                    </tr>
                                <?php 
    }
    ?>
                            </table>
                        </div>
                    </div>
                    <!-- <div class="title"><label for="title">WordPress User Integration Settings (Only use this if you want to integrate the member's of WP eMember with your WordPress users)</label></div> -->
                    <div class="postbox">
                        <h3><label for="title">WordPress User Integration Settings (Only use this if you want to integrate the member's of WP eMember with your WordPress users)</label></h3>
                        <div class="inside">
                            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Automatically Create Wordpress User:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_create_wp_user" type="checkbox"  <?php 
    $create_wp_user = $emember_config->getValue('eMember_create_wp_user');
    echo $create_wp_user ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>If checked it will automatically create a new wordpress user with the same credentials when a new member is registered with eMember.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Automatically log into Wordpress:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_signin_wp_user" type="checkbox"  <?php 
    $create_signin_user = $emember_config->getValue('eMember_signin_wp_user');
    echo $create_signin_user ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>If checked members will be automatically logged into wordpress when they log in using the eMember login.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Automatically log into eMember:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_signin_emem_user" type="checkbox"  <?php 
    $create_signin_user = $emember_config->getValue('eMember_signin_emem_user');
    echo $create_signin_user ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>If checked members will be automatically logged into eMember when they log in using the wordpress login system.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Preserve WordPress User Role:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_preserve_wp_user_role" type="checkbox"  <?php 
    $eMember_preserve_wp_user_role = $emember_config->getValue('eMember_preserve_wp_user_role');
    echo $eMember_preserve_wp_user_role ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>If checked the WP User's role will not be updated according to the role value set in the membership level. By default the WP User role is set to the value you specify in the Default WordPress Role field of a membership level.</i><br /><br />
                                    </td>
                                </tr>

                            </table>
                        </div>
                    </div>

                    <div class="postbox">
                        <h3><label for="title">Site Wide/Domain Level Page Protection Settings</label></h3>
                        <div class="inside">
                            <strong><i>Read the <a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=342" target="_blank">site wide protection feature</a> documentation before using this feature.</i></strong><br /><br />
                            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Site Wide Page Protection:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_enable_domain_lockdown" type="radio"  <?php 
    $eMember_enable_domain_lockdown = $emember_config->getValue('eMember_enable_domain_lockdown');
    echo $eMember_enable_domain_lockdown == 0 ? 'checked="checked"' : '';
    ?>
 value="0"/>
                                        <strong>Disabled</strong><br /><i>This feature is disabled by default. Select one of the following radio boxes to use this feature.</i>
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left"></td>
                                    <td align="left">
                                        <input name="eMember_enable_domain_lockdown" type="radio"  <?php 
    $eMember_enable_domain_lockdown = $emember_config->getValue('eMember_enable_domain_lockdown');
    echo $eMember_enable_domain_lockdown == 1 ? 'checked="checked"' : '';
    ?>
 value="1"/>
                                        <strong>Enable Site Wide/Domain Level Lockdown</strong>
                                        <br /><i>When enabled it will restrict anonymous visitor access to your site (the site won't load unless the visitor logs in as a member). The only pages the visitors will be able to access on the site when not logged in are the "Join Us" and "Registration" pages.</i>
                                        <br /><br />
                                        <textarea name="eMember_domain_lockdown_exclude_url" id="eMember_domain_lockdown_exclude_url" cols="83" rows="3"><?php 
    echo $emember_config->getValue('eMember_domain_lockdown_exclude_url');
    ?>
</textarea>
                                        <br/>
                                        <i>Add URLs (separated by comma) that will be excluded from the lockdown when domain level lockdown feature is enabled. Anonymous visitors will be able to access the above page(s) without having to log into the site. Leave empty if you do not want to exclude any specific URL.</i><br /><br />

                                        <textarea name="eMember_domain_lockdown_exclude_url_pattern" id="eMember_domain_lockdown_exclude_url_pattern" cols="83" rows="3"><?php 
    echo $emember_config->getValue('eMember_domain_lockdown_exclude_url_pattern');
    ?>
</textarea>
                                        <br/>
                                        <i>Add URL patterns (example, <code>/category1/sub-category/</code>) separated by comma that will be excluded from the lockdown when this feature is enabled. The URL pattern exclusion is helpful when you want to exclude all the URLs that have a certain pattern/keyword in it. Leave empty if you do not want to exclude any specific URL pattern.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left"></td>
                                    <td align="left">
                                        <input name="eMember_enable_domain_lockdown" type="radio"  <?php 
    $eMember_enable_domain_lockdown = $emember_config->getValue('eMember_enable_domain_lockdown');
    echo $eMember_enable_domain_lockdown == 2 ? 'checked="checked"' : '';
    ?>
 value="2"/>
                                        <strong>Enable Specific Page Lockdown</strong>
                                        <br /><i>When enabled it will lockdown the following pages and restrict anonymous visitor access to the following pages (the pages won't load unless the visitor logs in as a member).</i>
                                        <br /><br />
                                        <textarea name="eMember_domain_lockdown_include_url" id="eMember_domain_lockdown_include_url" cols="83" rows="3"><?php 
    echo $emember_config->getValue('eMember_domain_lockdown_include_url');
    ?>
</textarea>
                                        <br/>
                                        <i>Add URLs (separated by comma) that will be locked down when you enable the "Specific Page Lockdown" option.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left"><strong>Auto Redirect to a Specific Page (optional)</strong></td>
                                    <td align="left">
                                        <input name="eMember_domain_lockdown_alt2popup" type="text" size="100" id="eMember_domain_lockdown_alt2popup" value="<?php 
    echo $emember_config->getValue('eMember_domain_lockdown_alt2popup');
    ?>
"/>
                                        <br /><i>Specify the URL of a page that you want the users to be automatically redirected to when they land on a sitewide lockdown protected page.</i>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>

                    <div class="postbox">
                        <h3><label for="title">WP Affiliate Platform Account Creation Settings</label></h3> <!-- added -->
                        <div class="inside">
                            <strong><i>Only use this option if you are using the WP eMember plugin together with the <a href="http://www.tipsandtricks-hq.com/?p=1474" target="_blank">WP Affiliate Platform</a> plugin.</i></strong><br /><br />
                            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Automatically Create Affiliate Account:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_auto_affiliate_account" type="checkbox"  <?php 
    $eMember_auto_affiliate_account = $emember_config->getValue('eMember_auto_affiliate_account');
    echo $eMember_auto_affiliate_account ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>If checked an affiliate account will automatically be created with the same login credentials for each member when they register with the eMember plugin.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Automatically Log into Affiliate Account:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_auto_affiliate_account_login" type="checkbox"  <?php 
    $eMember_auto_affiliate_account_login = $emember_config->getValue('eMember_auto_affiliate_account_login');
    echo $eMember_auto_affiliate_account_login ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>If checked a member will automatically be logged into the affiliate account when logging into eMember.</i><br /><br />
                                    </td>
                                </tr>

                                <tr valign="top"><td width="25%" align="left">
                                        <strong>Limit Account Creation to Particular Levels Only</strong>
                                    </td><td align="left">
                                        <input name="wp_eMember_affiliate_account_restriction_list" type="text" size="50" value="<?php 
    echo $emember_config->getValue('wp_eMember_affiliate_account_restriction_list');
    ?>
"/>
                                        <br /><i>Only use this field if you want to restrict the affiliate account creation for particular membership levels only. Specify the membership level IDs separated by comma (,) in the above field (for example: 1,2,3).</i><br />
                                    </td></tr>

                            </table>
                        </div>
                    </div>

                    <div class="postbox">
                        <h3><label for="title">Additional Integration Options</label></h3>
                        <div class="inside">

                            <br />
                            <strong><i>(Only use this section if you have been instructed to do so from one of the <a href="http://www.tipsandtricks-hq.com/wordpress-membership/" target="_blank">documentation pages</a>)</i></strong>
                            <br /><br />

                            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr valign="top"><td width="25%" align="left">
                                        <strong>Enable Remote POST:</strong>
                                    </td><td align="left">
                                        <input type="checkbox" name="wp_eMember_enable_remote_post" <?php 
    $wp_eMember_enable_remote_post = $emember_config->getValue('wp_eMember_enable_remote_post');
    echo $wp_eMember_enable_remote_post ? 'checked="checked"' : '';
    ?>
 value="1" />
                                        <br /><i>Check this box if you want to be able to create or cancel member account by sending a HTTP POST or GET request to a URL.</i><br /><br />
                                    </td></tr>

                                <tr valign="top"><td width="25%" align="left">
                                        <strong>Secret Word:</strong>
                                    </td><td align="left">
                                        <input name="wp_eMember_secret_word_for_post" type="text" size="30" value="<?php 
    echo $emember_config->getValue('wp_eMember_secret_word_for_post');
    ?>
"/>
                                        <br /><i>This secret word will be used to verify any request sent to the POST URL. You can change this code to something random.</i><br />
                                    </td></tr>
                            </table>
                        </div></div>

                    <div class="postbox">
                        <h3><label for="title">Testing and Debugging Settings</label></h3>
                        <div class="inside">
                            <strong><i>You do not need to use these options unless you are testing the plugin or trying to troubleshoot and issue.</i></strong><br /><br />

                            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable Debug:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_enable_debug" type="checkbox"  <?php 
    $eMember_enable_debug = $emember_config->getValue('eMember_enable_debug');
    echo $eMember_enable_debug ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>If checked, debug output will be written to log files. This is useful for troubleshooting failures.</i><br /><br />
                                        You can check the debug log file by clicking on the link below (The log files can be viewed using any text editor):
                                <li style="margin-left:15px;"><a href="<?php 
    echo WP_EMEMBER_URL . "/eMember_debug.log";
    ?>
" target="_blank">eMember_debug.log file</a></li>
                                <li style="margin-left:15px;"><a href="<?php 
    echo WP_EMEMBER_URL . "/eMember_debug_cronjob.log";
    ?>
" target="_blank">eMember_debug_cronjob.log file</a></li>
                                <li style="margin-left:15px;"><a href="<?php 
    echo WP_EMEMBER_URL . "/ipn/ipn_handle_debug_eMember.log";
    ?>
" target="_blank">ipn_handle_debug_eMember.log file</a></li>
                                <div class="submit"><input type="submit" name="wp_emember_reset_logfile" style="font-weight:bold; color:red" value="Reset Debug Log Files" class="button" /><p class="description">All of the above debug log files are "reset" and timestamped with a log file reset message.</p></div>
                                </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable Sandbox Testing:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_enable_sandbox" type="checkbox"  <?php 
    $eMember_enable_sandbox = $emember_config->getValue('eMember_enable_sandbox');
    echo $eMember_enable_sandbox ? 'checked="checked"' : '';
    ?>
 value="1"/><br />
                                        <i>If checked the plugin will run in Sandbox/Testing mode (eg. <a href="http://www.tipsandtricks-hq.com/?p=2880" target="_blank">PayPal Sandbox</a>). Useful for testing.</i><br /><br />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>

                    <div class="submit">
                        <input type="submit" name="info_update" class="button-primary" value="<?php 
    _e('Update options');
    ?>
 &raquo;" />
                    </div>
                    <!-- </div> -->
                </div>
            </div>
        </div>
    </form>
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $('#emember_fancy_login_v').change(function() {
                $('#eMember_enable_fancy_login').val($(this).val());
            }).val($('#eMember_enable_fancy_login').val());
            $('#eMember_enable_secondary_membership').change(function() {
                var sub = $('#eMember_secondary_membership_migrate');
                if (this.checked) {
                    sub.removeAttr('disabled');
                } else {
                    sub.attr('disabled', 'disabled').removeAttr('checked');
                }
            }).change();
        });
    </script>
    <?php 
}
Exemplo n.º 10
0
function eMember_email_notifier_cronjob()
{
    global $wpdb;
    $emember_config = Emember_Config::getInstance();
    $s = $emember_config->getValue('eMember_email_notification');
    $alert_before = $emember_config->getValue('eMember_before_expiry_num_days');
    $alert_after = $emember_config->getValue('eMember_after_expiry_num_days');
    $result_after = array();
    $result_before = array();
    if (empty($s)) {
        eMember_log_cronjob_debug('Auto expiry email notification feature is turned off. No auto expiry email will be sent.', true);
        return;
    }
    eMember_log_cronjob_debug('Auto expiry email notification feature is enabled. Checking user account expiry details...', true);
    $query = "SELECT id, subscription_period,subscription_unit FROM " . WP_EMEMBER_MEMBERSHIP_LEVEL_TABLE . " WHERE id !=1 and subscription_unit !=''";
    $levels = $wpdb->get_results($query);
    if (is_array($levels)) {
        foreach ($levels as $level) {
            $alert_after = empty($alert_after) ? 0 : intval($alert_after);
            $interval = 0;
            $subscript_period = $level->subscription_period;
            $subscript_unit = $level->subscription_unit;
            if ($subscript_period == 0 && !empty($subscript_unit)) {
                //will expire after a fixed date.
                eMember_log_cronjob_debug('Checking membership level: ' . $level->id . '. fixed date : ' . $subscript_unit, true);
                $query = "SELECT email FROM " . WP_EMEMBER_MEMBERS_TABLE_NAME . " WHERE DATE_ADD('" . $subscript_unit . "', INTERVAL " . $alert_after . " DAY) = CURDATE( )" . " AND membership_level = " . $level->id;
                $result_after = $wpdb->get_results($query);
                if (!empty($alert_before) && strtotime($subscript_unit) < time()) {
                    $query = "SELECT email FROM " . WP_EMEMBER_MEMBERS_TABLE_NAME . " WHERE date_sub( '" . $subscript_unit . "' , INTERVAL " . $alert_before . " DAY ) = CURDATE( )" . " AND membership_level = " . $level->id;
                    $result_before = $wpdb->get_results($query);
                }
            } else {
                if ($subscript_period == '0') {
                    // noexpire
                    eMember_log_cronjob_debug('Checking membership level: ' . $level->id . '. No expiry.', true);
                    continue;
                } else {
                    switch ($subscript_unit) {
                        case 'Years':
                            $interval = $subscript_period * 365;
                            break;
                        case 'Months':
                            $interval = $subscript_period * 30;
                            break;
                        case 'weeks':
                            $interval = $subscript_period * 7;
                            break;
                        case 'Days':
                            $interval = $subscript_period;
                    }
                    if (!empty($interval)) {
                        eMember_log_cronjob_debug('Checking membership level: ' . $level->id . '. Interval value: ' . $interval, true);
                        $query = "SELECT email FROM " . WP_EMEMBER_MEMBERS_TABLE_NAME . " WHERE date_add( `subscription_starts` , INTERVAL " . ($interval + $alert_after) . " DAY ) = CURDATE( )" . " AND membership_level = " . $level->id;
                        $result_after = $wpdb->get_results($query);
                        if (!empty($alert_before) && $interval - $alert_before > 0) {
                            $query = "SELECT email FROM " . WP_EMEMBER_MEMBERS_TABLE_NAME . " WHERE date_add( `subscription_starts` , INTERVAL " . ($interval - $alert_before) . " DAY ) = CURDATE( )" . " AND membership_level = " . $level->id;
                            $result_before = $wpdb->get_results($query);
                        }
                    }
                }
            }
            if (!empty($result_after)) {
                eMember_log_cronjob_debug('The following users will receive the after expiry email notification', true);
                $email_list = array();
                foreach ($result_after as $row) {
                    $email_list[] = $row->email;
                    eMember_log_cronjob_debug($row->email, true);
                }
                $subject = $emember_config->getValue('eMember_after_expiry_email_subject');
                $body = $emember_config->getValue('eMember_after_expiry_email_body');
                $headers = 'From: ' . $emember_config->getValue('eMember_after_expiry_senders_email_address') . "\r\n";
                $headers .= 'bcc: ' . implode(',', $email_list) . "\r\n";
                wp_mail(array(), $subject, $body, $headers);
            }
            if (!empty($result_before)) {
                eMember_log_cronjob_debug('The following users will receive the before expiry email notification', true);
                $email_list = array();
                foreach ($result_before as $row) {
                    $email_list[] = $row->email;
                    eMember_log_cronjob_debug($row->email, true);
                }
                $subject = $emember_config->getValue('eMember_before_expiry_email_subject');
                $body = $emember_config->getValue('eMember_before_expiry_email_body');
                $headers = 'From: ' . $emember_config->getValue('eMember_before_expiry_senders_email_address') . "\r\n";
                $headers .= 'bcc: ' . implode(',', $email_list) . "\r\n";
                wp_mail(array(), $subject, $body, $headers);
            }
        }
    }
}
Exemplo n.º 11
0
function eMember_handle_affiliate_password_reset($aff_email, $encrypted_pass)
{
    if (empty($encrypted_pass) || empty($aff_email)) {
        return;
    }
    $emember_config = Emember_Config::getInstance();
    $eMember_auto_affiliate_account_login = $emember_config->getValue('eMember_auto_affiliate_account_login');
    if (function_exists('wp_aff_platform_install') && $eMember_auto_affiliate_account_login) {
        global $wpdb;
        $affiliates_table_name = WP_AFF_AFFILIATES_TBL_NAME;
        //wp_aff_check_if_account_exists($aff_email) - Do an additional check if needed
        $updatedb = "UPDATE {$affiliates_table_name} SET pass = '******' WHERE email = '" . $aff_email . "'";
        $results = $wpdb->query($updatedb);
        eMember_log_debug("Affiliate password updated for affiliate account with email: " . $aff_email, true);
    }
}
Exemplo n.º 12
0
function eMember_global_autoresponder_signup($firstname, $lastname, $emailaddress)
{
    eMember_log_debug('Performing global autoresponder signup if specified.', true);
    $emember_config = Emember_Config::getInstance();
    if ($emember_config->getValue('eMember_enable_aweber_int') == 1) {
        $list_name = trim($emember_config->getValue('eMember_aweber_list_name'));
        $from_address = $emember_config->getValue('senders_email_address');
        $senders_email = eMember_get_string_between($from_address, "<", ">");
        if (empty($senders_email)) {
            $senders_email = $from_address;
        }
        $cust_name = $firstname . ' ' . $lastname;
        if ($emember_config->getValue('eMember_use_new_aweber_integration') == '1') {
            eMember_aweber_new_signup_user($list_name, $firstname, $lastname, $emailaddress);
        } else {
            eMember_log_debug('AWeber list to signup to:' . $list_name, true);
            eMember_send_aweber_mail($list_name, $senders_email, $cust_name, $emailaddress);
            eMember_log_debug('AWeber signup from email address:' . $senders_email, true);
        }
        eMember_log_debug('AWeber signup operation performed for:' . $emailaddress, true);
    }
    if ($emember_config->getValue('eMember_use_mailchimp') == 1) {
        $api = eMember_get_chimp_api();
        $target_list_name = trim($emember_config->getValue('eMember_chimp_list_name'));
        eMember_log_debug('Mailchimp email address to signup:' . $emailaddress, true);
        eMember_log_debug('Mailchimp list to signup to:' . $target_list_name, true);
        $retval = eMember_mailchimp_subscribe($api, $target_list_name, $firstname, $lastname, $emailaddress);
        eMember_log_debug('Mailchimp signup operation performed. returned value:' . $retval, true);
    }
    if ($emember_config->getValue('eMember_use_getresponse') == 1) {
        $campaign_name = trim($emember_config->getValue('eMember_getResponse_campaign_name'));
        eMember_log_debug('GetResponse email address to signup:' . $emailaddress, true);
        eMember_log_debug('GetResponse campaign to signup to:' . $campaign_name, true);
        $retval = eMember_getResponse_subscribe($campaign_name, $firstname, $lastname, $emailaddress);
        eMember_log_debug('GetResponse signup operation performed. returned value:' . $retval, true);
    }
    if ($emember_config->getValue('eMember_use_global_generic_autoresponder_integration') == '1') {
        eMember_log_debug('Generic autoresponder integration is being used.', true);
        $list_email_address = trim($emember_config->getValue('eMember_generic_autoresponder_target_list_email'));
        $result = eMember_generic_autoresponder_signup($firstname, $lastname, $emailaddress, $list_email_address);
        eMember_log_debug('Generic autoresponder signup result: ' . $result, true);
    }
    // API call for plugins extending the global specific autoresponder signup
    $signup_data = array('firstname' => $firstname, 'lastname' => $lastname, 'email' => $emailaddress);
    do_action('emember_global_autoresponder_signup', $signup_data);
    eMember_log_debug('End of global autoresponder signup.', true);
}
Exemplo n.º 13
0
function emember_logout_init()
{
    $emember_auth = Emember_Auth::getInstance();
    $emember_config = Emember_Config::getInstance();
    if (!$emember_auth->isLoggedIn()) {
        return;
    }
    $sign_in_wp = $emember_config->getValue('eMember_signin_wp_user');
    if ($sign_in_wp && !is_user_logged_in()) {
        //If Not logged into WP while emember is logged in
        if (username_exists($emember_auth->getUserInfo('user_name'))) {
            eMember_log_debug("User Exists in WP but not logged in. ", true);
            $emember_auth->silent_logout();
            eMember_log_debug("Logging out of emember because wp cookie for this user expired ", true);
        } else {
            eMember_log_debug("You have auto login to WP enabled but WP User doesn't exist for this user! WP User login won't execute.", true);
        }
    }
}
Exemplo n.º 14
0
function emember_update_wp_role_for_member($eMember_username, $role_name)
{
    $emember_config = Emember_Config::getInstance();
    $user_wp_integration = $emember_config->getValue('eMember_create_wp_user');
    if ($user_wp_integration) {
        $user_info = get_user_by('login', $eMember_username);
        eMember_log_debug("The username of the member :" . $eMember_username . " ,WP User ID is: " . $user_info->ID . " , Target role name: " . $role_name, true);
        update_wp_user_Role($user_info->ID, $role_name);
    }
}
Exemplo n.º 15
0
function emember_update_profile_init()
{
    if (isset($_POST['eMember_update_profile'])) {
        $nonce = $_REQUEST['_wpnonce'];
        if (!wp_verify_nonce($nonce, 'emember-update-profile-nonce')) {
            eMember_log_debug("Profile update nonce check failed ", true);
            die("Security check failed on profile update");
        }
        global $wpdb;
        $emember_config = Emember_Config::getInstance();
        include_once ABSPATH . WPINC . '/class-phpass.php';
        $resultset = dbAccess::find(WP_EMEMBER_MEMBERS_TABLE_NAME, ' member_id=' . esc_sql($_POST['member_id']));
        $wp_user_id = username_exists($resultset->user_name);
        $updatable = true;
        if (isset($_POST['wp_emember_email'])) {
            $emmber_email_owner = emember_email_exists($_POST['wp_emember_email']);
            $wp_email_owner = email_exists($_POST['wp_emember_email']);
            if (!is_email($_POST['wp_emember_email'])) {
                $_POST['eMember_profile_update_result'] = EMEMBER_EMAIL_INVALID;
                $updatable = false;
            } else {
                if ($wp_email_owner && $wp_email_owner != $wp_user_id || $emmber_email_owner && $emmber_email_owner != $_POST['member_id']) {
                    $_POST['eMember_profile_update_result'] = '<span class="emember_error">' . EMEMBER_EMAIL_UNAVAIL . ' </span>';
                    $updatable = false;
                }
            }
        }
        if ($_POST['wp_emember_pwd'] != $_POST['wp_emember_pwd_r']) {
            $_POST['eMember_profile_update_result'] = '<span class="emember_error">' . EMEMBER_PASSWORD_MISMATCH . '</span>';
            $updatable = false;
        }
        if ($updatable) {
            $wp_hasher = new PasswordHash(8, TRUE);
            $fields = array();
            if (isset($_POST['wp_emember_title'])) {
                $fields['title'] = strip_tags($_POST['wp_emember_title']);
            }
            if (isset($_POST['wp_emember_firstname'])) {
                $fields['first_name'] = strip_tags($_POST['wp_emember_firstname']);
            }
            if (isset($_POST['wp_emember_lastname'])) {
                $fields['last_name'] = strip_tags($_POST['wp_emember_lastname']);
            }
            if (isset($_POST['wp_emember_email'])) {
                $fields['email'] = strip_tags($_POST['wp_emember_email']);
            }
            if (isset($_POST['wp_emember_phone'])) {
                $fields['phone'] = strip_tags($_POST['wp_emember_phone']);
            }
            if (isset($_POST['wp_emember_street'])) {
                $fields['address_street'] = strip_tags($_POST['wp_emember_street']);
            }
            if (isset($_POST['wp_emember_city'])) {
                $fields['address_city'] = strip_tags($_POST['wp_emember_city']);
            }
            if (isset($_POST['wp_emember_state'])) {
                $fields['address_state'] = strip_tags($_POST['wp_emember_state']);
            }
            if (isset($_POST['wp_emember_zipcode'])) {
                $fields['address_zipcode'] = strip_tags($_POST['wp_emember_zipcode']);
            }
            if (isset($_POST['wp_emember_country'])) {
                $fields['country'] = strip_tags($_POST['wp_emember_country']);
            }
            if (isset($_POST['wp_emember_gender'])) {
                $fields['gender'] = strip_tags($_POST['wp_emember_gender']);
            }
            if (isset($_POST['wp_emember_company_name'])) {
                $fields['company_name'] = strip_tags($_POST['wp_emember_company_name']);
            }
            if (!empty($_POST['wp_emember_pwd'])) {
                $password = $wp_hasher->HashPassword(strip_tags($_POST['wp_emember_pwd']));
                $fields['password'] = $password;
            }
            if ($wp_user_id) {
                $wp_user_info = array();
                $wp_user_info['first_name'] = strip_tags(isset($_POST['wp_emember_firstname']) ? $_POST['wp_emember_firstname'] : "");
                $wp_user_info['last_name'] = strip_tags(isset($_POST['wp_emember_lastname']) ? $_POST['wp_emember_lastname'] : "");
                $wp_user_info['user_email'] = strip_tags(isset($_POST['wp_emember_email']) ? $_POST['wp_emember_email'] : "");
                $wp_user_info['ID'] = $wp_user_id;
                if (!empty($_POST['wp_emember_pwd'])) {
                    $wp_user_info['user_pass'] = $_POST['wp_emember_pwd'];
                }
                wp_update_user($wp_user_info);
            }
            $_POST['member_id'] = strip_tags($_POST['member_id']);
            if (count($fields) > 0) {
                $ret = dbAccess::update(WP_EMEMBER_MEMBERS_TABLE_NAME, ' member_id =' . esc_sql($_POST['member_id']), $fields);
            }
            if (isset($_POST['emember_custom'])) {
                $custom_fields = dbAccess::find(WP_EMEMBER_MEMBERS_META_TABLE, ' user_id=' . esc_sql($_POST['member_id']) . ' AND meta_key=\'custom_field\'');
                if ($custom_fields) {
                    $ret = $wpdb->query('UPDATE ' . WP_EMEMBER_MEMBERS_META_TABLE . ' SET meta_value =' . '\'' . addslashes(serialize($_POST['emember_custom'])) . '\' WHERE meta_key = \'custom_field\' AND  user_id=' . $_POST['member_id']);
                } else {
                    $ret = $wpdb->query("INSERT INTO " . WP_EMEMBER_MEMBERS_META_TABLE . '( user_id, meta_key, meta_value ) VALUES(' . $_POST['member_id'] . ',"custom_field",' . '\'' . addslashes(serialize($_POST['emember_custom'])) . '\')');
                }
            } else {
                $ret = $wpdb->query('DELETE FROM ' . WP_EMEMBER_MEMBERS_META_TABLE . '  WHERE meta_key = \'custom_field\' AND  user_id=' . esc_sql($_POST['member_id']));
            }
            if ($ret === false) {
                $_POST['eMember_profile_update_result'] = 'Failed';
            } else {
                $edit_profile_page = $emember_config->getValue('eMember_profile_edit_page');
                $profile_updated_msg = '<div class="emember_profile_updated_msg">';
                $profile_updated_msg .= EMEMBER_PROFILE_UPDATED;
                if (!empty($edit_profile_page)) {
                    $profile_updated_msg .= ' <a href="' . $edit_profile_page . '">' . EMEMBER_EDIT_YOUR_PROFILE_AGAIN . '</a>';
                }
                $profile_updated_msg .= '</div>';
                $_POST['eMember_profile_update_result'] = $profile_updated_msg;
                do_action('eMember_profile_updated', $fields, $custom_fields);
                //Update the affiliate end if using the auto affiliate feature
                eMember_handle_affiliate_profile_update();
            }
        }
    }
}
Exemplo n.º 16
0
function recaptcha_settings()
{
    $emember_config = Emember_Config::getInstance();
    $msg = null;
    echo '<div class="wrap">';
    echo '<div id="poststuff"><div id="post-body">';
    if (isset($_POST['info_update'])) {
        if (isset($_POST["emember_enable_recaptcha"])) {
            if (empty($_POST["emember_recaptcha_public"]) || empty($_POST["emember_recaptcha_private"])) {
                $emember_config->setValue('emember_enable_recaptcha', 0);
                $msg = 'reCAPTCHA&trade; can\'t be enabled without public and private keys.';
            } else {
                $emember_config->setValue('emember_enable_recaptcha', 1);
                $emember_config->setValue('emember_recaptcha_public', (string) $_POST["emember_recaptcha_public"]);
                $emember_config->setValue('emember_recaptcha_private', (string) $_POST["emember_recaptcha_private"]);
            }
        } else {
            $emember_config->setValue('emember_enable_recaptcha', 0);
            $msg = 'reCAPTCHA&trade; is strongly recommended for protection against spams.';
        }
        //facebook feature
        /*
         $emember_config->setValue('emember_fb_api_key', (string)$_POST["emember_fb_api_key"]);
         $emember_config->setValue('emember_fb_app_secret', (string)$_POST["emember_fb_app_secret"]);
         $emember_config->setValue('emember_fb_app_id', (string)$_POST["emember_fb_app_id"]);
        */
        //facebook feature
        echo '<div id="message" class="updated fade"><p>';
        echo $msg ? '<strong style="color:red;">' . $msg : '<strong>Options Updated!';
        echo '</strong></p></div>';
        $emember_config->saveConfig();
    }
    ?>

    <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
        <input type="hidden" name="info_update" id="info_update" value="true" />
        <div class="postbox">
            <h3><label for="title">reCAPTCHA Settings (If you want to use <a href="http://www.google.com/recaptcha/learnmore" target="_blank">reCAPTCHA</a> then you need to get reCAPTCHA API keys from <a href="http://www.google.com/recaptcha/whyrecaptcha" target="_blank">here</a> and use in the settings below)</label></h3>
            <div class="inside">
                <table width="100%" border="0" cellspacing="0" cellpadding="6">
                    <tr valign="top"><td width="25%" align="left">
                            Enable reCAPTCHA&trade;:</td>
                        <td align="left">
                            <input name="emember_enable_recaptcha" type="checkbox"  <?php 
    $enable_captcha = $emember_config->getValue('emember_enable_recaptcha');
    echo $enable_captcha ? 'checked="checked"' : '';
    ?>
 value="1"/>
                            <br /><i>Check this box if you want to use reCAPTCHA on the member sign up form.</i><br /><br />
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            Public key:</td>
                        <td align="left">
                            <input name="emember_recaptcha_public" size=60 type="text"   value="<?php 
    echo $emember_config->getValue('emember_recaptcha_public');
    ?>
"/>
                            <br /><i>The public key for the reCAPTCHA API</i><br /><br />
                        </td></tr>
                    <tr valign="top"><td width="25%" align="left">
                            Private key:</td>
                        <td align="left">
                            <input name="emember_recaptcha_private" type="text" size=60 value="<?php 
    echo $emember_config->getValue('emember_recaptcha_private');
    ?>
"/>
                            <br /><i>The private key for the reCAPTCHA API</i><br /><br />
                        </td></tr>

                </table>
            </div>
        </div>
        <!--facebook feature -->
        <!--<div class="postbox">
        <h3><label for="title">Facebook Settings (If you want to use <a href="http://recaptcha.net/learnmore.html" target="_blank">reCAPTCHA</a> then you need to get reCAPTCHA API keys from <a href="http://recaptcha.net/whyrecaptcha.html" target="_blank">here</a> and use in the settings below)</label></h3>
        <div class="inside">
        <table width="100%" border="0" cellspacing="0" cellpadding="6">
        <tr valign="top"><td width="25%" align="left">
        Facebook API Key:</td>
        <td align="left">
        <input name="emember_fb_api_key" type="text" size=60   value="<?php 
    echo $emember_config->getValue('emember_fb_api_key');
    ?>
"/>
        <br /><i>API key provided by Facebook.</i><br /><br />
        </td></tr>

        <tr valign="top"><td width="25%" align="left">
        Facebook Application Secret:</td>
        <td align="left">
        <input name="emember_fb_app_secret" size=60 type="text"   value="<?php 
    echo $emember_config->getValue('emember_fb_app_secret');
    ?>
"/>
        <br /><i>Facebook Application Secret key.</i><br /><br />
        </td></tr>
        <tr valign="top"><td width="25%" align="left">
        Facebook Application ID:</td>
        <td align="left">
        <input name="emember_fb_app_id" type="text" size=60 value="<?php 
    echo $emember_config->getValue('emember_fb_app_id');
    ?>
"/>
        <br /><i>Facebook Application ID.</i><br /><br />
        </td></tr>

        </table>
        </div>
        </div>-->
        <!--facebook feature -->
        <div class="submit">
            <input type="submit" name="info_update" class="button-primary" value="<?php 
    _e('Update options');
    ?>
 &raquo;" />
        </div>
    </form>

    <?php 
    echo '</div></div>';
    echo '</div>';
}
Exemplo n.º 17
0
function print_eMember_public_user_list($no_email = '')
{
    $_SESSION['emember_no_email_shortcode'] = $no_email;
    $emember_config = Emember_Config::getInstance();
    $p = $emember_config->getValue('eMember_enable_public_profile');
    if (!$p) {
        return 'Public profile Listing is disabled';
    }
    $member_table = WP_EMEMBER_MEMBERS_TABLE_NAME;
    $membership_table = WP_EMEMBER_MEMBERSHIP_LEVEL_TABLE;
    $table_name = " {$member_table} LEFT JOIN {$membership_table} ON " . " ({$member_table}.membership_level = {$membership_table}.id)";
    global $wpdb;
    $emember_user_count = $wpdb->get_row("SELECT COUNT(*) as count FROM" . $table_name . ' ORDER BY member_id');
    ob_start();
    ?>
    <br/><br/><br/><div id="emember_Pagination" class="emember_pagination"></div>
    <form action="javascript:void(0);" id="emember_user_search">
        <p>
            <input type="text" value="" name="term" title="<?php 
    echo EMEMBER_SEARCH_TERM;
    ?>
" id="post-search-term"/>
            <input type="submit"  value="<?php 
    echo EMEMBER_SEARCH;
    ?>
"/>
        </p>
    </form>
    <table id="member_list" class="widefat">
        <thead>
            <tr>
                <th scope="col"><?php 
    echo EMEMBER_USERNAME;
    ?>
&nbsp;
                    <img sort="user_name" order="asc" class="wp-emember-sort-order" src="<?php 
    echo WP_EMEMBER_URL;
    ?>
/images/sort-asc-icon.gif" title="Sort by username"/>
                </th>
                <th scope="col"><?php 
    echo EMEMBER_FIRST_NAME;
    ?>
</th>
                <th scope="col"><?php 
    echo EMEMBER_LAST_NAME;
    ?>
&nbsp;
                    <img sort="last_name" order="asc" class="wp-emember-sort-order" src="<?php 
    echo WP_EMEMBER_URL;
    ?>
/images/sort-asc-icon.gif" title="Sort by last name"/>
                </th>
                <?php 
    if (!$no_email) {
        ?>
                    <th scope="col"><?php 
        echo EMEMBER_EMAIL;
        ?>
&nbsp;
                        <img sort="email" order="asc" class="wp-emember-sort-order" src="<?php 
        echo WP_EMEMBER_URL;
        ?>
/images/sort-asc-icon.gif" title="Sort by email"/>
                    </th>
                <?php 
    }
    ?>
            </tr>
        </thead>
        <tbody></tbody>
    </table>
    <div class="emember_apple_overlay" id="emember_post_preview_overlay">
        <!-- the external content is loaded inside this tag -->
        <div class="emember_contentWrap"></div>
    </div>
    <script type="text/javascript">
        /*<![CDATA[ */
        function drawContent(count, params) {
            var counter = 0;
            if (params == undefined)
                params = {};
            var itms_per_pg = parseInt(<?php 
    $items_per_page = $emember_config->getValue('eMember_rows_per_page');
    $items_per_page = trim($items_per_page);
    echo !empty($items_per_page) && is_numeric($items_per_page) ? $items_per_page : 30;
    ?>
);
            var $tbody = jQuery('#member_list tbody');
            jQuery("#emember_Pagination").pagination(count, {
                callback: function(i, container) {
                    $tbody.html('<?php 
    echo emember_preloader(3);
    ?>
');
                    params['event'] = "emember_public_user_list_ajax";
                    params['action'] = "emember_public_user_list_ajax";
                    params['start'] = i * itms_per_pg;
                    params['limit'] = itms_per_pg;
                    var maxIndex = Math.min((i + 1) * itms_per_pg, count);
                    var target_url = '<?php 
    echo admin_url("admin-ajax.php");
    ?>
';
                    jQuery.get(target_url,
                            params,
                            function(data) {
                                $tbody.html('');
                                data = jQuery(data);
                                $tbody.html(data.filter('tbody').html());
                                window.eval(data.filter('script').html());
                            },
                            'html'
                            );
                },
                prev_text: '<?php 
    echo EMEMBER_PREV;
    ?>
',
                next_text: '<?php 
    echo EMEMBER_NEXT;
    ?>
',
                num_edge_entries: 2,
                num_display_entries: 10,
                items_per_page: itms_per_pg
            });
        }

        jQuery(document).ready(function() {
            jQuery('input[title!=""]').hint();
            var count = <?php 
    echo $emember_user_count->count;
    ?>
;
            drawContent(count);
            var asc_img = '<?php 
    echo WP_EMEMBER_URL;
    ?>
' + '/images/sort-asc-icon.gif';
            var desc_img = '<?php 
    echo WP_EMEMBER_URL;
    ?>
' + '/images/sort-desc-icon.gif';
            jQuery('.wp-emember-sort-order').click(function() {
                var target_url = '<?php 
    echo admin_url("admin-ajax.php");
    ?>
';
                var $this = jQuery(this);
                var order = $this.attr('order');
                var sort = $this.attr('sort');
                var term = jQuery('#post-search-term').val();
                var params = {ord: order, sort: sort};
                if (term != jQuery('#post-search-term').attr('title'))
                    params['t'] = term;
                var paramss = params;
                paramss['event'] = "emember_user_count_ajax";
                paramss['action'] = "emember_user_count_ajax";

                jQuery.get(target_url, paramss,
                        function(data) {
                            drawContent(data.count, params);
                            if (order == "asc") {
                                $this.attr('order', 'desc');
                                $this.attr('src', desc_img);
                            }
                            else {
                                $this.attr('order', 'asc');
                                $this.attr('src', asc_img);
                            }
                        },
                        'json'
                        );
            });
            jQuery('#emember_user_search').submit(function(e) {
                e.prevenDefault;
                var term = jQuery('#post-search-term').val();
                var q = "t=" + term;
                if (term != jQuery('#post-search-term').attr('title'))
                {
                    var target_url = '<?php 
    echo admin_url("admin-ajax.php");
    ?>
';
                    jQuery.get(target_url,
                            {event: "emember_user_count_ajax", action: "emember_user_count_ajax", t: term},
                    function(data) {
                        drawContent(data.count, {t: term});
                    },
                            'json'
                            );
                }
                return false;
            });
        });
        /*]]>*/
    </script>
    <?php 
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Exemplo n.º 18
0
function print_eMember_bookmark_list()
{
    $emember_auth = Emember_Auth::getInstance();
    $emember_config = Emember_Config::getInstance();
    $enable_bookmark = $emember_config->getValue('eMember_enable_bookmark');
    if (!$enable_bookmark) {
        return EMEMBER_BOOKMARK_DISABLED;
    }
    if ($emember_auth->isLoggedIn()) {
        $bookmarks = $emember_auth->getUserInfo('extra_info');
        $bookmarks = unserialize($bookmarks);
        if (empty($bookmarks) || empty($bookmarks['bookmarks'])) {
            return EMEMBER_NO_BOOKMARK;
        } else {
            $return = '<form method="post"><table>';
            $counter = 1;
            foreach ($bookmarks['bookmarks'] as $key) {
                //$c = ($counter%2)? 'style="background:#E8E8E8;"' : '';
                $c = $counter % 2 ? 'class="emember_even_row"' : 'class="emember_odd_row"';
                $return .= '<tr ' . $c . ' ><td>' . $counter . '</td><td width=350px><a target= "_blank" href="' . get_permalink($key) . '">' . get_the_title($key) . '</a> </td>';
                $return .= '<td><input type="checkbox" name=del_bookmark[] value="' . $key . '" ></td><tr>';
                $counter++;
            }
            $return .= '<tr ><td colspan="3" align="left"><input type="submit" name="remove_bookmark" value="Remove" /></td></tr>';
            $return .= '</table>';
            $return .= '</form>';
            return $return;
        }
    } else {
        return EMEMBER_BOOKMARK_NOT_LOGGED_IN;
    }
}
Exemplo n.º 19
0
function emember_auto_responder_settings()
{
    $emember_config = Emember_Config::getInstance();
    echo '<div class="wrap">';
    echo '<div id="poststuff"><div id="post-body">';
    if (isset($_POST['info_update'])) {
        $errors = "";
        if (isset($_POST['aweber_make_connection'])) {
            if ($emember_config->getValue('eMember_aweber_authorize_status') != 'authorized') {
                $authorization_code = trim($_POST['aweber_auth_code']);
                if (!class_exists('AWeberAPI')) {
                    include_once 'lib/auto-responder/aweber_api/aweber_api.php';
                }
                $auth = AWeberAPI::getDataFromAweberID($authorization_code);
                list($consumerKey, $consumerSecret, $accessKey, $accessSecret) = $auth;
                $eMember_aweber_access_keys = array('consumer_key' => $consumerKey, 'consumer_secret' => $consumerSecret, 'access_key' => $accessKey, 'access_secret' => $accessSecret);
                $emember_config->setValue('eMember_aweber_access_keys', $eMember_aweber_access_keys);
                if ($eMember_aweber_access_keys['access_key']) {
                    try {
                        $aweber = new AWeberAPI($consumerKey, $consumerSecret);
                        $account = $aweber->getAccount($accessKey, $accessSecret);
                    } catch (AWeberException $e) {
                        $account = null;
                    }
                    if (!$account) {
                        //$this->deauthorize();//TODO - remove the keys
                        $errors = 'AWeber authentication failed! Please try connecting again.';
                    } else {
                        $emember_config->setValue('eMember_aweber_authorize_status', 'authorized');
                        $_POST['eMember_use_new_aweber_integration'] = '1';
                        //Set the eMember_use_new_aweber_integration flag to enabled
                        echo '<div id="message" class="updated fade"><p><strong>';
                        echo 'AWeber authorization success!';
                        echo '</strong></p></div>';
                    }
                } else {
                    $errors = 'You need to specify a valid authorization code to establish an AWeber API connection';
                }
            } else {
                //Remove existing connection
                $eMember_aweber_access_keys = array('consumer_key' => '', 'consumer_secret' => '', 'access_key' => '', 'access_secret' => '');
                $emember_config->setValue('eMember_aweber_access_keys', $eMember_aweber_access_keys);
                $emember_config->setValue('eMember_aweber_authorize_status', '');
                $_POST['eMember_use_new_aweber_integration'] = '';
                //Set the eMember_use_new_aweber_integration flag to disabled
                echo '<div id="message" class="updated fade"><p><strong>';
                echo 'AWeber connection removed!';
                echo '</strong></p></div>';
            }
        }
        $emember_config->setValue('eMember_enable_aweber_int', $_POST['eMember_enable_aweber_int'] == '1' ? '1' : '');
        $emember_config->setValue('eMember_aweber_list_name', (string) $_POST["eMember_aweber_list_name"]);
        $emember_config->setValue('eMember_use_new_aweber_integration', $_POST['eMember_use_new_aweber_integration'] == '1' ? '1' : '');
        $emember_config->setValue('eMember_use_mailchimp', $_POST['eMember_use_mailchimp'] == '1' ? '1' : '');
        //$emember_config->setValue('eMember_enable_global_chimp_int', ($_POST['eMember_enable_global_chimp_int']=='1') ? '1':'' );
        $emember_config->setValue('eMember_chimp_list_name', trim($_POST["eMember_chimp_list_name"]));
        $emember_config->setValue('eMember_chimp_api_key', trim($_POST["eMember_chimp_api_key"]));
        $emember_config->setValue('eMember_mailchimp_disable_double_optin', $_POST['eMember_mailchimp_disable_double_optin'] == '1' ? '1' : '');
        $emember_config->setValue('eMember_mailchimp_disable_final_welcome_email', $_POST['eMember_mailchimp_disable_final_welcome_email'] == '1' ? '1' : '');
        $emember_config->setValue('eMember_mailchimp_signup_date_field_name', trim($_POST["eMember_mailchimp_signup_date_field_name"]));
        $emember_config->setValue('eMember_use_getresponse', $_POST['eMember_use_getresponse'] == '1' ? '1' : '');
        $emember_config->setValue('eMember_getResponse_campaign_name', (string) $_POST["eMember_getResponse_campaign_name"]);
        $emember_config->setValue('eMember_getResponse_api_key', (string) $_POST["eMember_getResponse_api_key"]);
        $emember_config->setValue('eMember_use_generic_autoresponder_integration', $_POST['eMember_use_generic_autoresponder_integration'] == '1' ? '1' : '');
        $emember_config->setValue('eMember_use_global_generic_autoresponder_integration', $_POST['eMember_use_global_generic_autoresponder_integration'] == '1' ? '1' : '');
        $emember_config->setValue('eMember_generic_autoresponder_target_list_email', trim($_POST["eMember_generic_autoresponder_target_list_email"]));
        $emember_config->saveConfig();
        if (!empty($errors)) {
            echo '<div id="message" class="error"><p>';
            echo $errors;
            echo '</p></div>';
        } else {
            echo '<div id="message" class="updated fade"><p><strong>';
            echo 'Autoresponder Options Updated!';
            echo '</strong></p></div>';
        }
    }
    ?>

    <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
        <input type="hidden" name="info_update" id="info_update" value="true" />

        <div class="postbox">
            <h3><label for="title">AWeber Settings (<a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=151" target="_blank">AWeber Integration Instructions</a>)</label></h3>
            <div class="inside">

                <table width="100%" border="0" cellspacing="0" cellpadding="6">

                    <tr valign="top"><td width="25%" align="left">
                            <strong>Enable AWeber Signup:</strong>
                        </td><td align="left">
                            <input name="eMember_enable_aweber_int" type="checkbox"<?php 
    if ($emember_config->getValue('eMember_enable_aweber_int') != '') {
        echo ' checked="checked"';
    }
    ?>
 value="1"/>
                            <br /><i>When checked the plugin will automatically sign up the members at registration time to your AWeber List specified below. For membership level specific signup see the "Autoresponder List/Campaign Name" section of the membership level.</i><br /><br />
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            <strong>AWeber List Name:</strong>
                        </td><td align="left">
                            <input name="eMember_aweber_list_name" type="text" size="40" value="<?php 
    echo $emember_config->getValue('eMember_aweber_list_name');
    ?>
"/>
                            <br /><i>The name of the AWeber list where the members will be signed up to (eg. listname@aweber.com)</i><br /><br />
                        </td></tr>
                </table>

                <div style="border-bottom: 1px solid #dedede; height: 10px"></div>
                <table class="form-table">

                    <tr valign="top"><td width="25%" align="left">
                            Use the New AWeber Integration Option:
                        </td><td align="left">
                            <input name="eMember_use_new_aweber_integration" type="checkbox"<?php 
    if ($emember_config->getValue('eMember_use_new_aweber_integration') != '') {
        echo ' checked="checked"';
    }
    ?>
 value="1"/>
                            <br /><i>When checked the plugin will use the new AWeber integration method which uses the AWeber API (this method is recommended over the old method that uses the email parser).</i>
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            Step 1: Get Your AWeber Authorization Code:
                        </td><td align="left">
                            <a href="https://auth.aweber.com/1.0/oauth/authorize_app/999d6172" target="_blank">Click here to get your authorization code</a>
                            <br /><i>Clicking on the above link will take you to the AWeber site where you will need to log in using your AWeber username and password. Then give access to the Tips and Tricks HQ AWeber app.</i>
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            Step 2: Paste in Your Authorization Code:
                        </td><td align="left">
                            <input name="aweber_auth_code" type="text" size="140" value=""/>
                            <br /><i>Paste the long authorization code that you got from AWeber in the above field.</i>
                        </td></tr>

                    <tr valign="top"><td colspan="2" align="left">
                            <?php 
    if ($emember_config->getValue('eMember_aweber_authorize_status') == 'authorized') {
        echo '<input type="submit" name="aweber_make_connection" value="Remove Connection" class= "button button" />';
    } else {
        echo '<input type="submit" name="aweber_make_connection" value="Make Connection" class= "button-primary" />';
    }
    ?>
                        </td></tr>

                </table>
            </div></div>

        <div class="postbox">
            <h3><label for="title">MailChimp Settings (<a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=236" target="_blank">MailChimp Integration Instructions</a>)</label></h3>
            <div class="inside">

                <table width="100%" border="0" cellspacing="0" cellpadding="6">

                    <tr valign="top"><td width="25%" align="left">
                            <strong>Use MailChimp AutoResponder:</strong>
                        </td><td align="left">
                            <input name="eMember_use_mailchimp" type="checkbox"<?php 
    if ($emember_config->getValue('eMember_use_mailchimp') != '') {
        echo ' checked="checked"';
    }
    ?>
 value="1"/>
                            <br /><i>Check this if you want to use MailChimp Autoresponder service. For membership level specific signup see the "Autoresponder List/Campaign Name" section of the membership level.</i><br /><br />
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            <strong>MailChimp List Name:</strong>
                        </td><td align="left">
                            <input name="eMember_chimp_list_name" type="text" size="30" value="<?php 
    echo $emember_config->getValue('eMember_chimp_list_name');
    ?>
"/>
                            <br /><i>The name of the MailChimp list where the customers will be signed up to (e.g. Customer List)</i><br /><br />
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            <strong>MailChimp API Key:</strong>
                        </td><td align="left">
                            <input name="eMember_chimp_api_key" type="text" size="50" value="<?php 
    echo $emember_config->getValue('eMember_chimp_api_key');
    ?>
"/>
                            <br /><i>The API Key of your MailChimp account (can be found under the "Account" tab). By default the API Key is not active so make sure you activate it in your Mailchimp account. If you do not have the API Key then you can use the username and password option below but it is better to use the API key.</i>
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            <strong>Disable Double Opt-In:</strong>
                        </td><td align="left">
                            <input name="eMember_mailchimp_disable_double_optin" type="checkbox"<?php 
    if ($emember_config->getValue('eMember_mailchimp_disable_double_optin') != '') {
        echo ' checked="checked"';
    }
    ?>
 value="1"/>
                            Do not send double opt-in confirmation email
                            <br /><i>Use this checkbox if you do not wish to use the double opt-in option. Please note that abusing this option may cause your MailChimp account to be suspended.</i><br />

                            <input name="eMember_mailchimp_disable_final_welcome_email" type="checkbox"<?php 
    if ($emember_config->getValue('eMember_mailchimp_disable_final_welcome_email') != '') {
        echo ' checked="checked"';
    }
    ?>
 value="1"/>
                            Do not send welcome email
                            <br /><i>Use this checkbox if you do not wish to send the welcome email sent by MailChimp when a user subscribes to your list. This will only work if you disable the double opt-in option above.</i>
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            <strong>Signup Date Field Name (optional):</strong>
                        </td><td align="left">
                            <input name="eMember_mailchimp_signup_date_field_name" type="text" size="30" value="<?php 
    echo $emember_config->getValue('eMember_mailchimp_signup_date_field_name');
    ?>
"/>
                            <br /><i>If you have configured a signup date field for your mailchimp list then specify the name of the field here (example: SIGNUPDATE). <a href="http://kb.mailchimp.com/article/how-do-i-create-a-date-field-in-my-signup-form" target="_blank">More Info</a></i><br /><br />
                        </td></tr>

                </table>
            </div></div>

        <div class="postbox">
            <h3><label for="title">GetResponse Settings (<a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=283" target="_blank">GetResponse Integration Instructions</a>)</label></h3>
            <div class="inside">

                <table width="100%" border="0" cellspacing="0" cellpadding="6">

                    <tr valign="top"><td width="25%" align="left">
                            <strong>Use GetResponse AutoResponder:</strong>
                        </td><td align="left">
                            <input name="eMember_use_getresponse" type="checkbox"<?php 
    if ($emember_config->getValue('eMember_use_getresponse') != '') {
        echo ' checked="checked"';
    }
    ?>
 value="1"/>
                            <br /><i>Check this if you want to use GetResponse Autoresponder service.</i><br /><br />
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            <strong>GetResponse Campaign Name:</strong>
                        </td><td align="left">
                            <input name="eMember_getResponse_campaign_name" type="text" size="30" value="<?php 
    echo $emember_config->getValue('eMember_getResponse_campaign_name');
    ?>
"/>
                            <br /><i>The name of the GetResponse campaign where the customers will be signed up to (e.g. marketing)</i><br /><br />
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            <strong>GetResponse API Key:</strong>
                        </td><td align="left">
                            <input name="eMember_getResponse_api_key" type="text" size="50" value="<?php 
    echo $emember_config->getValue('eMember_getResponse_api_key');
    ?>
"/>
                            <br /><i>The API Key of your GetResponse account (can be found inside your GetResponse Account).</i><br /><br />
                        </td></tr>

                </table>
            </div></div>

        <div class="postbox">
            <h3><label for="title">Generic Autoresponder Integration Settings</label></h3>
            <div class="inside">

                <br /><strong>&nbsp; &nbsp; If your autoresponder provider allows you to signup users just by sending an email to the list email address with the user's email as the from address then you can use this method of integration</strong>

                <table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">

                    <tr valign="top"><td width="25%" align="left">
                            Enable Generic Autoresponder Integration:
                        </td><td align="left">
                            <input name="eMember_use_generic_autoresponder_integration" type="checkbox"<?php 
    if ($emember_config->getValue('eMember_use_generic_autoresponder_integration') != '') {
        echo ' checked="checked"';
    }
    ?>
 value="1"/>
                            <br /><p class="description">Use this option if you want to use the generic auotoresponder integration option.</p>
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            Enable Global Integration:
                        </td><td align="left">
                            <input name="eMember_use_global_generic_autoresponder_integration" type="checkbox"<?php 
    if ($emember_config->getValue('eMember_use_global_generic_autoresponder_integration') != '') {
        echo ' checked="checked"';
    }
    ?>
 value="1"/>
                            <br /><p class="description">When checked the plugin will automatically sign up every member to your list/campaign specified below. If you want to selectively signup members on a per membership level basis then use the Autoresponder settings of that level.</p>
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            Global List/Campaign Email Address:
                        </td><td align="left">
                            <input name="eMember_generic_autoresponder_target_list_email" type="text" size="40" value="<?php 
    echo $emember_config->getValue('eMember_generic_autoresponder_target_list_email');
    ?>
"/>
                            <br /><p class="description">The email address of the list where the member will be signed up to. The plugin will send the autoresponder signup request email to this address.</p>
                        </td></tr>

                </table>
            </div></div>

        <div class="submit">
            <input type="submit" name="info_update" class="button-primary" value="<?php 
    _e('Update options');
    ?>
 &raquo;" />
        </div>
    </form>

    <?php 
    echo '</div></div>';
    echo '</div>';
}
function eStore_member_belongs_to_specified_levels($permitted_levels)
{
    $emember_config = Emember_Config::getInstance();
    $emember_auth = Emember_Auth::getInstance();
    $level = $emember_auth->getUserInfo('membership_level');
    if (in_array($level, $permitted_levels)) {
        return true;
    } else {
        if ($emember_config->getValue('eMember_enable_secondary_membership')) {
            $sec_levels = $emember_auth->getUserInfo('more_membership_levels');
            if ($sec_levels) {
                $sec_levels = explode(',', $sec_levels);
                foreach ($sec_levels as $sec_level) {
                    if (in_array($sec_level, $permitted_levels)) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
Exemplo n.º 21
0
function emember_custom_field_settings()
{
    $emember_config = Emember_Config::getInstance();
    if (isset($_POST['info_update'])) {
        //        wp_emember_printd($_POST);
        //        die();
        unset($_POST['info_update']);
        $fields = $_POST;
        $fields['emember_field_name'] = array_values((array) $fields['emember_field_name']);
        $fields['emember_field_type'] = array_values((array) $fields['emember_field_type']);
        $fields['emember_field_requred'] = array_values((array) $fields['emember_field_requred']);
        $fields['emember_field_extra'] = array_values((array) $fields['emember_field_extra']);
        if (isset($_POST['emember_field_flag'])) {
            $fields['emember_field_flag'] = $_POST['emember_field_flag'];
        }
        update_option('emember_custom_field_type', $fields);
    } else {
        $fields = get_option('emember_custom_field_type');
    }
    if ($emember_config->getValue('eMember_custom_field') == '') {
        //custom field settings is not enabled
        echo '<div class="wrap">';
        echo '<p><strong>If you want to use custom fields on your registration and edit profile forms then please check the "Enable Custom Fields" checkbox from the WP eMember\'s General Settings to enable this feature</strong></p>';
        echo '</div>';
        return;
    }
    ?>
    <form id="emember-dyn-form" method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
        <div class="wrap">
            <div id="poststuff">
                <div id="post-body">
                    <div class="eMember_yellow_box">
                        <p><i>You can turn the custom fields feature on or off by checking the "Enable Custom Fields" checkbox from the WP eMember's General Settings</i></p>
                        <p><strong>The fields that you configure below will just show up on your registration and edit profile page directly. You DO NOT need to configure these fields from the "Pages/Forms Settings" section (no need to look for them there).</strong></p>
                        <p>For Dropdown field types, write down key=&gt;value pairs as a comma separated list in the "Extra Field Info" field. (Example: 1=&gt;option1,2=&gt;option2). Here is another example (1=>America,2=>Africa,3=>Europe,4=>Asia) that will create a dropdown list with the options being America, Africa, Europe and Asia.</p>
                    </div>
                    <fieldset class="inlineLabels" id="cfU-204BD901-09C4-BEF8-6008F40594EA946F">
                        <div id="add-name-container" class="emember-add-field-container">
                            <span class="emember-add-field-trigger">
                                <img src="<?php 
    echo WP_EMEMBER_URL;
    ?>
/images/add.gif" alt="" title="Add New Item" />
                                Add Custom Field
                            </span>
                        </div>
                        <div class="ctrlHolder">
                            <?php 
    $i = 0;
    $fields['emember_field_requred'] = is_null($fields['emember_field_requred']) ? array() : $fields['emember_field_requred'];
    do {
        ?>
                                <div id="removable-name-container-<?php 
        echo $i;
        ?>
" class="postbox" style="padding:10px;border:3px solid #DFDFDF;<?php 
        echo isset($fields['emember_field_flag']) ? "display:none" : "";
        ?>
">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                        <tr>
                                            <td>
                                                <label for="emember_field_name_<?php 
        echo $i;
        ?>
"><strong>Field Name</strong></label>
                                            </td>
                                            <td>
                                                <input type="text" name="emember_field_name[<?php 
        echo $i;
        ?>
]" id="name_<?php 
        echo $i;
        ?>
" value="<?php 
        echo htmlspecialchars(stripslashes($fields['emember_field_name'][$i]));
        ?>
" class="textInput emember-removable" />
                                                <input <?php 
        echo in_array($i, $fields['emember_field_requred']) ? "checked='checked'" : "";
        ?>
 type="checkbox" name="emember_field_requred[<?php 
        echo $i;
        ?>
]" id="required_<?php 
        echo $i;
        ?>
" value="<?php 
        echo $i;
        ?>
" class="textInput" /> required.
                                            </td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <label for="emember_field_type_<?php 
        echo $i;
        ?>
"><strong>Field Type</strong></label>
                                            </td>
                                            <td>
                                                <select  name="emember_field_type[<?php 
        echo $i;
        ?>
]" id="emember_field_type_<?php 
        echo $i;
        ?>
" class="textInput emember-removable" >
                                                    <option <?php 
        echo isset($fields['emember_field_type'][$i]) && $fields['emember_field_type'][$i] == 'text' ? "selected='selected'" : "";
        ?>
 value="text">Text</option>
                                                    <option <?php 
        echo isset($fields['emember_field_type'][$i]) && $fields['emember_field_type'][$i] == 'dropdown' ? "selected='selected'" : "";
        ?>
 value="dropdown">Dropdown List</option>
                                                    <option <?php 
        echo isset($fields['emember_field_type'][$i]) && $fields['emember_field_type'][$i] == 'checkbox' ? "selected='selected'" : "";
        ?>
 value="checkbox">Checkbox</option>
                                                    <option <?php 
        echo isset($fields['emember_field_type'][$i]) && $fields['emember_field_type'][$i] == 'textarea' ? "selected='selected'" : "";
        ?>
 value="textarea">Text Area</option>
                                                </select>
                                            </td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <label for="name_<?php 
        echo $i;
        ?>
"><strong>Extra Field Info</strong></label>
                                            </td>
                                            <td>
                                                <textarea name="emember_field_extra[<?php 
        echo $i;
        ?>
]" id="extra_<?php 
        echo $i;
        ?>
"  rows="1" cols="70"  class="textInput emember-removable" ><?php 
        echo stripslashes($fields['emember_field_extra'][$i]);
        ?>
</textarea>
                                            </td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <label for="nameindex_<?php 
        echo $i;
        ?>
"><strong>Display Order</strong></label>
                                            </td>
                                            <td>
                                                <input type="text" size="4" maxlength="4" name="emember_field_order[<?php 
        echo $i;
        ?>
]" id="nameindex_<?php 
        echo $i;
        ?>
" value="<?php 
        echo $fields['emember_field_order'][$i];
        ?>
" class="textInput emember-removable onlynumber displayorder" />
                                                <br /><i>Enter a number for display order purpose (example value: 1). The custom fields will be shown according to this order number on the registration and edit profile page.</i>
                                            </td>
                                            <td></td>
                                        </tr>
                                    </table>
                                    <img class="emember-remove_segment" src="<?php 
        echo WP_EMEMBER_URL;
        ?>
/images/spacer.gif" width="16" height="16" alt="" title="Remove This Item" class="" />
                                </div>
                                <?php 
        $i++;
    } while ($i < count($fields['emember_field_name']));
    ?>
                        </div>
                    </fieldset>
                    <div class="submit">
                        <input type="submit"  name="info_update" class="button-primary" value="<?php 
    _e('Update options');
    ?>
 &raquo;" />
                    </div>
                </div>
            </div>
        </div>
    </form>
    <script type="text/javascript">
        ;
        (function($) {
            $(document).ready(function() {
                $('.onlynumber').keypress(function(e) {
                    if (window.event)
                        var charCode = e.keyCode;
                    else if (e.which)
                        var charCode = e.which;
                    if (charCode > 31 && (charCode < 48 || charCode > 57))
                        return false;
                    return true;
                });
                $('form').submit(function() {
                    var $ok = true;
                    var $this = this;
                    $('input.textInput:text').each(function() {
                        if ($(this).parents('div:first').css('display') == 'none') {
                            $("<input type='hidden' name='emember_field_flag' value = '1' />").appendTo($($this));
                            $ok = true;
                            return false;
                        }
                        if ($(this).val() == "") {
                            $ok = false;
                            return false;
                        }
                    });
                    if (!$ok)
                        alert('"Display Order" and "Field Name" field(s) cannot be kept empty.');
                    return $ok;
                });
                $("button[name='cancel']").click(function() {
                    var input = $(':input');
                    input.each(function(i) {
                        $(this).rules('remove');
                    });
                    $(':input').removeClass('required').addClass('ignore');
                    $('#emember-dyn-form').validate({ignore: '.ignore'});
                });

                $("#emember-dyn-form #removable-name-container-0").dynamicField({
                    removeImgSrc: '<?php 
    echo WP_EMEMBER_URL;
    ?>
/images/cross.png',
                    spacerImgSrc: '<?php 
    echo WP_EMEMBER_URL;
    ?>
/images/spacer.gif',
                    addTriggerClass: "emember-add-field-trigger",
                    removeImgClass: "emember-remove-field-trigger"
                });
            });
        })(jQuery);
    </script>

    <?php 
}
Exemplo n.º 22
0
function wp_eMember_add_memebers()
{
    $emember_config = Emember_Config::getInstance();
    global $wpdb;
    $d = WP_EMEMBER_URL . '/images/default_image.gif';
    //If being edited, grab current info
    if (isset($_GET['editrecord']) && $_GET['editrecord'] != '') {
        $theid = $_GET['editrecord'];
        $editingrecord = dbAccess::find(WP_EMEMBER_MEMBERS_TABLE_NAME, ' member_id=' . $theid);
        $edit_custom_fields = dbAccess::find(WP_EMEMBER_MEMBERS_META_TABLE, ' user_id=' . $theid . ' AND meta_key="custom_field"');
        $edit_custom_fields = isset($edit_custom_fields->meta_value) ? unserialize($edit_custom_fields->meta_value) : array();
        $editingrecord->more_membership_levels = explode(',', $editingrecord->more_membership_levels);
        $editingrecord = (array) $editingrecord;
        $image_url = null;
        $image_path = null;
        $upload_dir = wp_upload_dir();
        $upload_url = $upload_dir['baseurl'] . '/emember/';
        $upload_path = $upload_dir['basedir'] . '/emember/';
        $use_gravatar = $emember_config->getValue('eMember_use_gravatar');
        if ($use_gravatar) {
            $image_url = WP_EMEMBER_GRAVATAR_URL . "/" . md5(strtolower($editingrecord['email'])) . "?d=" . urlencode($d) . "&s=" . 96;
        } else {
            if (!empty($editingrecord['profile_image'])) {
                $image_url = $upload_url . $editingrecord['profile_image'];
                $image_path = $theid;
            } else {
                $image_path = "";
                $image_url = WP_EMEMBER_URL . '/images/default_image.gif';
            }
        }
    }
    if (isset($_POST['Submit'])) {
        global $wpdb;
        include_once ABSPATH . WPINC . '/class-phpass.php';
        $wp_hasher = new PasswordHash(8, TRUE);
        $post_editedrecord = esc_sql(isset($_POST['editedrecord']) ? $_POST['editedrecord'] : "");
        $fields = array();
        $fields['flags'] = 0;
        if ($emember_config->getValue('eMember_enable_secondary_membership')) {
            $fields['more_membership_levels'] = implode(',', empty($_POST['more_membership_levels']) ? array() : $_POST['more_membership_levels']);
        }
        $fields["user_name"] = $_POST["user_name"];
        $fields["first_name"] = $_POST["first_name"];
        $fields["last_name"] = $_POST["last_name"];
        $fields["company_name"] = $_POST["company_name"];
        $fields["member_since"] = $_POST["member_since"];
        $fields["membership_level"] = $_POST["membership_level"];
        $fields["account_state"] = $_POST["account_state"];
        $fields["email"] = $_POST["email"];
        $fields["phone"] = $_POST["phone"];
        $fields["address_street"] = $_POST["address_street"];
        $fields["address_city"] = $_POST["address_city"];
        $fields["address_state"] = $_POST["address_state"];
        $fields["address_zipcode"] = $_POST["address_zipcode"];
        $fields["home_page"] = $_POST["home_page"];
        $fields["country"] = $_POST["country"];
        $fields["gender"] = $_POST["gender"];
        $fields["referrer"] = $_POST["referrer"];
        $fields["subscription_starts"] = $_POST["subscription_starts"];
        $fields['last_accessed_from_ip'] = get_real_ip_addr();
        $fields["notes"] = $_POST['notes'];
        $wp_user_info = array();
        $wp_user_info['user_nicename'] = implode('-', explode(' ', $_POST['user_name']));
        $wp_user_info['display_name'] = $_POST['user_name'];
        $wp_user_info['user_email'] = $_POST['email'];
        $wp_user_info['nickname'] = $_POST['user_name'];
        $wp_user_info['first_name'] = $_POST['first_name'];
        $wp_user_info['last_name'] = $_POST['last_name'];
        if ($post_editedrecord == '') {
            $fields['user_name'] = esc_sql($_POST['user_name']);
            $wp_user_info['user_login'] = $_POST['user_name'];
            // Add the record to the DB
            include_once 'emember_validator.php';
            $validator = new Emember_Validator();
            $validator->add(array('value' => $fields['user_name'], 'label' => 'User Name', 'rules' => array('user_required', 'user_name', 'user_unavail', 'user_minlength')));
            $validator->add(array('value' => $_POST['password'], 'repeat' => $_POST['retype_password'], 'label' => 'Password', 'rules' => array('pass_required', 'pass_mismatch')));
            $validator->add(array('value' => $fields['email'], 'label' => 'Email', 'rules' => array('email_required', 'email_unavail')));
            $messages = $validator->validate();
            if (count($messages) > 0) {
                echo '<span class="emember_error">' . implode('<br/>', $messages) . '</span>';
                $editingrecord = $_POST;
            } else {
                $password = $wp_hasher->HashPassword($_POST['password']);
                $fields['password'] = esc_sql($password);
                $ret = dbAccess::insert(WP_EMEMBER_MEMBERS_TABLE_NAME, $fields);
                $lastid = $wpdb->insert_id;
                $should_create_wp_user = $emember_config->getValue('eMember_create_wp_user');
                if ($should_create_wp_user) {
                    $role_names = array(1 => 'Administrator', 2 => 'Editor', 3 => 'Author', 4 => 'Contributor', 5 => 'Subscriber');
                    $membership_level_resultset = dbAccess::find(WP_EMEMBER_MEMBERSHIP_LEVEL_TABLE, " id='" . $fields['membership_level'] . "'");
                    $wp_user_info['role'] = $membership_level_resultset->role;
                    $wp_user_info['user_registered'] = date('Y-m-d H:i:s');
                    //$wp_user_id = wp_create_user($_POST['user_name'], $_POST['password'], $_POST['email']);
                    $wp_user_id = eMember_wp_create_user($_POST['user_name'], $_POST['password'], $_POST['email'], $wp_user_info);
                    //do_action( 'set_user_role', $wp_user_id, $membership_level_resultset->role );
                }
                ///custom field insert
                if (isset($_POST['emember_custom'])) {
                    $wpdb->query("INSERT INTO " . WP_EMEMBER_MEMBERS_META_TABLE . '( user_id, meta_key, meta_value ) VALUES(' . $lastid . ',"custom_field",' . '\'' . addslashes(serialize($_POST['emember_custom'])) . '\')');
                }
                if ($ret === false) {
                    $_SESSION['flash_message'] = '<div id="message" style = "color:red;" class="updated fade"><p>Couldn\'t create new member.</p></div>';
                } else {
                    if (isset($_POST['uploaded_profile_img'])) {
                        $upload_dir = wp_upload_dir();
                        $upload_path = $upload_dir['basedir'];
                        $upload_path .= '/emember/';
                        $ext = explode('.', $_POST['uploaded_profile_img']);
                        rename($upload_path . $_POST['uploaded_profile_img'], $upload_path . $lastid . '.' . $ext[1]);
                    }
                    $_SESSION['flash_message'] = '<div id="message" class="updated fade"><p>Member &quot;' . $fields['user_name'] . '&quot; created.</p></div>';
                    //Notify the newly created member if specified in the settings
                    if ($emember_config->getValue('eMember_email_notification_for_manual_member_add')) {
                        $login_link = $emember_config->getValue('login_page_url');
                        $member_email_address = $_POST['email'];
                        $subject_rego_complete = $emember_config->getValue('eMember_email_subject_rego_complete');
                        $body_rego_complete = $emember_config->getValue('eMember_email_body_rego_complete');
                        $from_address = $emember_config->getValue('senders_email_address');
                        $headers = 'From: ' . $from_address . "\r\n";
                        $curr_member_id = $lastid;
                        $additional_params = array('password' => $_POST['password'], 'login_link' => $login_link);
                        $email_body1 = emember_dynamically_replace_member_details_in_message($curr_member_id, $body_rego_complete, $additional_params);
                        wp_mail($member_email_address, $subject_rego_complete, $email_body1, $headers);
                    }
                    //Create the corresponding affliate account if specified in the settings
                    if ($emember_config->getValue('eMember_auto_affiliate_account')) {
                        eMember_handle_affiliate_signup($_POST['user_name'], $_POST['password'], $_POST['first_name'], $_POST['last_name'], $_POST['email'], '');
                    }
                    /*                         * * Signup the member to Autoresponder List (Autoresponder integration) ** */
                    eMember_log_debug("===> Performing autoresponder signup if needed (member was added via admin dashboard) <===", true);
                    $membership_level_id = $_POST["membership_level"];
                    $firstname = $_POST['first_name'];
                    $lastname = $_POST['last_name'];
                    $emailaddress = $_POST['email'];
                    eMember_level_specific_autoresponder_signup($membership_level_id, $firstname, $lastname, $emailaddress);
                    eMember_global_autoresponder_signup($firstname, $lastname, $emailaddress);
                    /*                         * * end of autoresponder integration ** */
                    echo '<script type="text/javascript">window.location = "admin.php?page=wp_eMember_manage";</script>';
                }
            }
        } else {
            if (isset($_POST['emember_custom'])) {
                $custom_fields = dbAccess::find(WP_EMEMBER_MEMBERS_META_TABLE, ' user_id=' . $post_editedrecord . ' AND meta_key=\'custom_field\'');
                if ($custom_fields) {
                    $wpdb->query('UPDATE ' . WP_EMEMBER_MEMBERS_META_TABLE . ' SET meta_value =' . '\'' . addslashes(serialize($_POST['emember_custom'])) . '\' WHERE meta_key = \'custom_field\' AND  user_id=' . $post_editedrecord);
                } else {
                    $wpdb->query("INSERT INTO " . WP_EMEMBER_MEMBERS_META_TABLE . '( user_id, meta_key, meta_value ) VALUES(' . $post_editedrecord . ',"custom_field",' . '\'' . addslashes(serialize($_POST['emember_custom'])) . '\')');
                }
            } else {
                $wpdb->query('DELETE FROM ' . WP_EMEMBER_MEMBERS_META_TABLE . '  WHERE meta_key = \'custom_field\' AND  user_id=' . $post_editedrecord);
            }
            $editingrecord = dbAccess::find(WP_EMEMBER_MEMBERS_TABLE_NAME, ' member_id=' . $post_editedrecord);
            // Update the member info
            $member_id = esc_sql($_POST['editedrecord']);
            $wp_user_id = username_exists($fields['user_name']);
            $wp_email_owner = email_exists($fields['email']);
            $emember_email_owner = emember_email_exists($fields['email']);
            if (empty($fields['user_name']) || $fields['user_name'] != $editingrecord->user_name) {
                echo '<div id="message" class="updated fade"><p>User Name Cannot Be Changed!</p></div>';
            } else {
                if (empty($fields['email'])) {
                    echo '<div id="message" class="updated fade"><p>Email Field is Empty!</p></div>';
                } else {
                    if ($wp_email_owner && $wp_user_id != $wp_email_owner || $emember_email_owner && $member_id != $emember_email_owner) {
                        echo '<div id="message" class="updated fade"><p>Email ID &quot;' . $fields['email'] . '&quot; is already registered to a user!</p></div>';
                    } else {
                        $update_possible = true;
                        if (!empty($_POST['password'])) {
                            if ($_POST['password'] === $_POST['retype_password']) {
                                $password = $wp_hasher->HashPassword($_POST['password']);
                                $fields['password'] = esc_sql($password);
                                $wp_user_info['user_pass'] = $_POST['password'];
                            } else {
                                $update_possible = false;
                                echo '<div id="message" class="updated fade"><p>Password does\'t match!</p></div>';
                            }
                        }
                        if ($update_possible) {
                            $ret = dbAccess::update(WP_EMEMBER_MEMBERS_TABLE_NAME, 'member_id = ' . $member_id, $fields);
                            if ($fields["membership_level"] != $editingrecord->membership_level) {
                                do_action('emember_membership_changed', array('member_id' => $editingrecord->member_id, 'from_level' => $editingrecord->membership_level, 'to_level' => $fields["membership_level"]));
                            }
                            if ($wp_user_id && !is_wp_error($wp_user_id)) {
                                $wp_user_info['ID'] = $wp_user_id;
                                wp_update_user($wp_user_info);
                                if (($editingrecord->flags & 1) != 1) {
                                    $cond = " id='" . $fields['membership_level'] . "'";
                                    $membership_level_resultset = dbAccess::find(WP_EMEMBER_MEMBERSHIP_LEVEL_TABLE, $cond);
                                    update_wp_user_Role($wp_user_id, $membership_level_resultset->role);
                                    //do_action( 'set_user_role', $wp_user_id, $membership_level_resultset->role );
                                }
                            }
                            if ($ret === false) {
                                $_SESSION['flash_message'] = '<div id="message" class="updated fade"><p>' . __('Member', 'wp_eMember') . ' &quot;' . $fields['user_name'] . '&quot; ' . __('Update Failed.', 'wp_eMember') . '</p></div>';
                            } else {
                                $_SESSION['flash_message'] = '<div id="message" class="updated fade"><p>' . __('Member', 'wp_eMember') . ' &quot;' . $fields['user_name'] . '&quot; ' . __('updated.', 'wp_eMember') . '</p></div>';
                                if (isset($_POST['account_status_change'])) {
                                    $from_address = $emember_config->getValue('senders_email_address');
                                    $headers = 'From: ' . $from_address . "\r\n";
                                    $subject = $_POST['notificationmailhead'];
                                    $member_email_address = $_POST['email'];
                                    $login_link = $emember_config->getValue('login_page_url');
                                    $additional_params = array('password' => $_POST['password'], 'login_link' => $login_link);
                                    $curr_member_id = $post_editedrecord;
                                    $email_body = emember_dynamically_replace_member_details_in_message($curr_member_id, $_POST['notificationmailbody'], $additional_params);
                                    wp_mail($member_email_address, $subject, $email_body, $headers);
                                    $emember_config->setValue('eMember_status_change_email_body', $_POST['notificationmailbody']);
                                    $emember_config->setValue('eMember_status_change_email_subject', $_POST['notificationmailhead']);
                                    $emember_config->saveConfig();
                                }
                                echo '<script type="text/javascript">window.location = "admin.php?page=wp_eMember_manage";</script>';
                            }
                        }
                    }
                }
            }
            $editingrecord = (array) $editingrecord;
        }
    }
    $all_levels = dbAccess::findAll(WP_EMEMBER_MEMBERSHIP_LEVEL_TABLE, ' id != 1 ', ' id DESC ');
    include_once 'views/add_member_view.php';
}
function wp_eMember_scheduled_membership_upgrade()
{
    global $wpdb;
    $emember_config = Emember_Config::getInstance();
    $wpememmeta = new WPEmemberMeta();
    $membership_tbl = $wpememmeta->get_table('membership_level');
    $members_tbl = $wpememmeta->get_table('member');
    $email_list = array();
    $emails_for_followup_notification = array();
    $query_start = 0;
    $query_limit = 500;
    $iterations = 0;
    $membership_levels = Emember_Level_Collection::get_instance();
    while (1) {
        $query = 'SELECT member_id,membership_level,email,subscription_starts,account_state, ' . 'more_membership_levels, expiry_1st, expiry_2nd FROM ' . $members_tbl . ' WHERE account_state="active"  LIMIT ' . $query_start . ', ' . $query_limit;
        $members = $wpdb->get_results($query, OBJECT);
        if (count($members) < 1) {
            break;
        }
        foreach ($members as $member) {
            if (empty($member->subscription_starts)) {
                continue;
            }
            $should_update_db = false;
            $level_info = array();
            $my_level = $membership_levels->get_levels($member->membership_level);
            $options = unserialize($my_level->get('options'));
            $current_level = $member->membership_level;
            $more_levels = $member->more_membership_levels;
            $more_levels = is_array($more_levels) ? array_filter($more_levels) : $more_levels;
            $sec_levels = explode(',', $more_levels);
            $level_info['membership_level'] = $current_level;
            $level_info['account_state'] = $member->account_state;
            //Initialize the account state with the current data
            $level_data_modified = false;
            if (isset($options['promoted_level_id']) && !empty($options['promoted_level_id']) && $options['promoted_level_id'] != -1) {
                $current_subscription_starts = strtotime($member->subscription_starts);
                $current_time = time();
                while (1) {
                    if ($current_level === $options['promoted_level_id']) {
                        break;
                    }
                    $promoted_after = trim($options['days_after']);
                    if (empty($promoted_after)) {
                        break;
                    }
                    $d = $promoted_after == 1 ? ' day' : ' days';
                    $expires = strtotime(" + " . abs($promoted_after) . $d, $current_subscription_starts);
                    if ($expires > $current_time) {
                        break;
                    }
                    if (!isset($options['promoted_level_id']) || empty($options['promoted_level_id']) || $options['promoted_level_id'] == -1) {
                        break;
                    }
                    $sec_levels[] = $current_level;
                    $current_level = $options['promoted_level_id'];
                    $my_level = $membership_levels->get_levels($current_level);
                    //
                    $options = unserialize($my_level->get('options'));
                }
                if ($current_level != -1 && !empty($current_level) && $member->membership_level != $current_level) {
                    $level_info['membership_level'] = $current_level;
                    $level_data_modified = true;
                    if ($emember_config->getValue('eMember_enable_secondary_membership')) {
                        $level_info['more_membership_levels'] = array_unique($sec_levels);
                    }
                }
            }
            if (wp_emember_is_subscription_expired($member, $my_level)) {
                $level_info['account_state'] = 'expired';
                $level_data_modified = true;
                $sec = $emember_config->getValue('eMember_enable_secondary_membership');
                $migrate = $emember_config->getValue('eMember_secondary_membership_migrate');
                if ($sec && $migrate) {
                    foreach ($sec_levels as $key => $level) {
                        if (empty($level)) {
                            continue;
                        }
                        if (wp_emember_is_subscription_expired($member, $membership_levels->get_levels($level))) {
                            continue;
                        }
                        $sec_levels[$key] = $level_info['membership_level'];
                        $level_info['membership_level'] = $level;
                        $level_info['account_state'] = 'active';
                        $level_info['more_membership_levels'] = array_unique($sec_levels);
                        break;
                    }
                }
            }
            /*** notification after x day of account expiry ***/
            if (isset($level_info['account_state']) && $level_info['account_state'] == 'expired') {
                $is_auto_email = $emember_config->getValue('eMember_email_notification');
                $notification_interval = $emember_config->getValue('eMember_after_expiry_num_days');
                //$is_recurring = $emember_config->getValue('eMember_after_expiry_num_days_recurring');
                if (!empty($is_auto_email) && !empty($notification_interval)) {
                    $current_mem_level = $membership_levels->get_levels($level_info['membership_level']);
                    $days_elapsed = wp_emember_num_days_since_expired($current_mem_level->get('subscription_period'), $current_mem_level->get('subscription_unit'), $member->get('subscription_starts'));
                    if ($days_elapsed == $notification_interval) {
                        $emails_for_followup_notification[] = $member->email;
                    }
                }
            }
            /*** Auto upgrade ***/
            if ($level_data_modified) {
                eMember_log_cronjob_debug('Auto upgrading the member account with member ID: ' . $member->member_id . ' Level: ' . $level_info['membership_level'], true);
                eMember_log_cronjob_debug('Users account state: ' . $level_info['account_state'], true);
                $email_list[] = $member->email;
                if (isset($level_info['more_membership_levels'])) {
                    $level_info['more_membership_levels'] = implode(',', $level_info['more_membership_levels']);
                }
                if (!empty($level_info)) {
                    dbAccess::update(WP_EMEMBER_MEMBERS_TABLE_NAME, 'member_id=' . $member->member_id, $level_info);
                }
                do_action('emember_membership_changed', array('member_id' => $member->member_id, 'from_level' => $member->membership_level, 'to_level' => $level_info['membership_level']));
            }
        }
        $query_start = $query_limit * ++$iterations + 1;
    }
    //Handle auto upgrade notification if needed
    if ($emember_config->getValue('eMember_enable_autoupgrade_notification')) {
        eMember_log_cronjob_debug('Using auto upgrade notification email option.. need to check the email list.', true);
        if (!empty($email_list)) {
            $subject = $emember_config->getValue('eMember_autoupgrade_email_subject');
            eMember_log_cronjob_debug('Sending auto upgrade notification email with subject: ' . $subject, true);
            $body = $emember_config->getValue('eMember_autoupgrade_email_body');
            $headers = 'From: ' . $emember_config->getValue('eMember_autoupgrade_senders_email_address') . "\r\n";
            $headers .= 'bcc: ' . implode(',', $email_list) . "\r\n";
            eMember_log_cronjob_debug($headers, true);
            wp_mail(array(), $subject, $body, $headers);
            eMember_log_cronjob_debug('Auto upgrade notification email sent.', true);
        }
    }
    // Handle notification email after X days if needed
    if (!empty($emails_for_followup_notification)) {
        $subject = $emember_config->getValue('eMember_after_expiry_email_subject_followup');
        eMember_log_cronjob_debug('Sending expiry notification email after X days with subject: ' . $subject, true);
        $body = $emember_config->getValue('eMember_after_expiry_email_body_followup');
        $headers = 'From: ' . $emember_config->getValue('eMember_after_expiry_senders_email_address_followup') . "\r\n";
        $headers .= 'bcc: ' . implode(',', $emails_for_followup_notification) . "\r\n";
        eMember_log_cronjob_debug($headers, true);
        wp_mail(array(), $subject, $body, $headers);
        eMember_log_cronjob_debug('Expiry notification email sent.', true);
    }
    //mail
}
Exemplo n.º 24
0
 public function __construct($userInfo)
 {
     $level_info = array();
     $current_level = $userInfo->membership_level;
     $more_levels = $userInfo->more_membership_levels;
     $more_levels = is_array($more_levels) ? array_filter($more_levels) : $more_levels;
     $userInfo->more_membership_levels = explode(',', $more_levels);
     $this->primary_level = Emember_Permission::get_instance($userInfo->membership_level);
     $this->secondary_levels = array();
     $config = Emember_Config::getInstance();
     $options = $this->primary_level->get_options();
     if (isset($options['promoted_level_id']) && $options['promoted_level_id'] != -1) {
         $current_subscription_starts = strtotime($userInfo->subscription_starts);
         $sec_levels = $userInfo->more_membership_levels;
         $level_before = $userInfo->membership_level;
         $current_time = time();
         while (1) {
             if ($current_level === $options['promoted_level_id']) {
                 break;
             }
             $promoted_after = trim($options['days_after']);
             if (empty($promoted_after)) {
                 break;
             }
             $d = $promoted_after == 1 ? ' day' : ' days';
             $expires = strtotime(" + " . abs($promoted_after) . $d, $current_subscription_starts);
             if ($expires > $current_time) {
                 break;
             }
             if (!isset($options['promoted_level_id']) || $options['promoted_level_id'] == -1) {
                 break;
             }
             //$current_subscription_starts = $expires;
             $sec_levels[] = $current_level;
             $current_level = $options['promoted_level_id'];
             $this->primary_level = Emember_Permission::get_instance($current_level);
             $options = $this->primary_level->get_options();
         }
         if ($current_level != -1) {
             $level_info['membership_level'] = $current_level;
             //$level_info ['current_subscription_starts'] = date('y-m-d', $current_subscription_starts);
             if ($config->getValue('eMember_enable_secondary_membership')) {
                 $sec_levels = array_unique($sec_levels);
                 $level_info['more_membership_levels'] = implode(',', $sec_levels);
                 $userInfo->more_membership_levels = $sec_levels;
             }
             $userInfo->membership_level = $current_level;
             dbAccess::update(WP_EMEMBER_MEMBERS_TABLE_NAME, 'member_id=' . $userInfo->member_id, $level_info);
             if ($level_info['membership_level'] != $level_before) {
                 do_action('emember_membership_changed', array('member_id' => $userInfo->member_id, 'from_level' => $level_before, 'to_level' => $level_info['membership_level']));
             }
         }
     }
     if ($config->getValue('eMember_enable_secondary_membership')) {
         if (!empty($userInfo->more_membership_levels)) {
             foreach ($userInfo->more_membership_levels as $l) {
                 if (empty($l)) {
                     continue;
                 }
                 $this->secondary_levels[] = Emember_Permission::get_instance($l);
             }
         }
     }
     $my_subcript_period = $this->primary_level->get('subscription_period');
     $my_subscript_unit = $this->primary_level->get('subscription_unit');
     if ($my_subcript_period == 0 && empty($my_subscript_unit)) {
         $type = 'noexpire';
     } else {
         if ($my_subcript_period == 0 && !empty($my_subscript_unit)) {
             $type = 'fixeddate';
             $my_subcript_period = $my_subscript_unit;
         } else {
             $type = 'interval';
             switch ($my_subscript_unit) {
                 case 'Days':
                     break;
                 case 'Weeks':
                     $my_subcript_period = $my_subcript_period * 7;
                     break;
                 case 'Months':
                     $my_subcript_period = $my_subcript_period * 30;
                     break;
                 case 'Years':
                     $my_subcript_period = $my_subcript_period * 365;
                     break;
             }
         }
     }
     $this->subscription_duration = array('duration' => $my_subcript_period, 'type' => $type);
 }
Exemplo n.º 25
0
function emember_payment_gateway_settings_menu()
{
    echo '<div class="wrap">';
    echo '<div id="poststuff"><div id="post-body">';
    $emember_config = Emember_Config::getInstance();
    $paypal_ipn_url = WP_EMEMBER_URL . "/ipn/eMember_handle_paypal_ipn.php";
    if (isset($_POST['info_update_emem_cb'])) {
        $emember_config->setValue('eMember_cb_secret_key', trim($_POST["eMember_cb_secret_key"]));
        $emember_config->saveConfig();
        echo '<div id="message" class="updated fade"><p><strong>';
        echo 'Clickbank Options Updated!';
        echo '</strong></p></div>';
    }
    if (isset($_POST['emem_generate_av_code'])) {
        $mem_level = trim($_POST['emember_paypal_av_member_level']);
        $membership_level_resultset = dbAccess::find(WP_EMEMBER_MEMBERSHIP_LEVEL_TABLE, " id='" . $mem_level . "'");
        if ($membership_level_resultset) {
            $pp_av_code = 'notify_url=' . $paypal_ipn_url . '<br />' . 'custom=subsc_ref=' . $mem_level;
            echo '<div id="message" class="updated fade"><p>';
            echo '<strong>Paste the code below in the "Add advanced variables" field of your PayPal button for membership level ' . $mem_level . '</strong>';
            echo '<br /><code>' . $pp_av_code . '</code>';
            echo '</p></div>';
        } else {
            echo '<div id="message" class="updated fade"><p><strong>';
            echo 'Error! The membership level ID (' . $mem_level . ') you specified is incorrect. Please check this value again.';
            echo '</strong></p></div>';
        }
    }
    ?>
    <div class="postbox">
        <h3><label for="title">WP eStore Integration Settings</label></h3>
        <div class="inside">

            <p><strong>
                    Please read the <a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=60" target="_blank">WP eStore Integration Instruction</a> to integrate eMember with WP eStore's purchase button.
                </strong></p>

        </div></div>

    <div class="postbox">
        <h3><label for="title">Direct PayPal Integration Settings</label></h3>
        <div class="inside">

            <p><strong>
                    Please read the <a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=146" target="_blank">Direct PayPal Button Integration Instruction</a> to integrate eMember directly with a PayPal button.
                </strong></p>

            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                <tr valign="top"><td width="25%" align="left">
                        PayPal IPN (Instant Payment Notification) URL Value:
                    </td><td align="left">
                        <code><?php 
    echo $paypal_ipn_url;
    ?>
</code>
                        <br /><br /><i>You will need to use the above URL as the "IPN handling script URL" value in your your PayPal button.</i><br /><br />
                    </td></tr>
            </table>

            <strong>Generate the "Advanced Variables" Code for your PayPal button</strong>
            <br />
            <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
                Enter the Membership Level ID
                <input name="emember_paypal_av_member_level" type="text" size="4" value="" />
                <input type="submit" name="emem_generate_av_code" class="button-primary" value="Generate Code" />
            </form>

        </div></div>

    <div class="postbox">
        <h3><label for="title">ClickBank Integration Settings</label></h3>
        <div class="inside">

            <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
                <input type="hidden" name="info_update_emem_cb" id="info_update_emem_cb" value="true" />

                <p><strong>
                        Please read the <a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=470" target="_blank">ClickBank Integration Instruction</a> to integrate eMember with a ClickBank button.
                    </strong></p>

                <table width="100%" border="0" cellspacing="0" cellpadding="6">
                    <tr valign="top"><td width="25%" align="left">
                            ClickBank Secret Key:
                        </td><td align="left">
                            <input name="eMember_cb_secret_key" type="text" size="50" value="<?php 
    echo $emember_config->getValue('eMember_cb_secret_key');
    ?>
"/>
                            <br /><i>Enter your ClickBank secret key. You can configure your secret key from the <code>"Account Settings -> My Site -> Advanced Tools"</code> section of your ClickBank account.</i><br /><br />
                        </td></tr>

                    <tr valign="top"><td width="25%" align="left">
                            ClickBank Instant Notification URL Value:
                        </td><td align="left">
                            <code><?php 
    echo WP_EMEMBER_URL . "/ipn/eMember_handle_clickbank_ipn.php";
    ?>
</code>
                            <br /><br /><i>Enter the above URL in your your ClickBank account's "Instant Notification URL" field (just below the secret key). You can find it in the <code>"Account Settings -> My Site -> Advanced Tools"</code> section of your ClickBank account.</i><br /><br />
                        </td></tr>
                </table>

                <div class="submit">
                    <input type="submit" name="info_update_emem_cb" class="button-primary" value="<?php 
    _e('Save Clickbank options');
    ?>
 &raquo;" />
                </div>
            </form>
        </div></div>

    <?php 
    echo '</div></div>';
    echo '</div>';
}
Exemplo n.º 26
0
function emember_protected_handler($attrs, $contents, $codes = '')
{
    global $post;
    $emember_auth = Emember_Auth::getInstance();
    $emember_config = Emember_Config::getInstance();
    $emember_auth->hasmore[$post->ID] = $post->ID;
    //$first_click_enabled = $emember_config->getValue('eMember_google_first_click_free');
    $contents = do_shortcode($contents);
    if (emember_is_first_click()) {
        return $contents;
    }
    //google first click free enabled.
    $do_not_show_restricted_msg = isset($attrs['do_not_show_restricted_msg']) ? $attrs['do_not_show_restricted_msg'] : "";
    if (!$emember_auth->isLoggedIn()) {
        // Show the content to anyone who is not logged in
        if (isset($attrs['scope']) && $attrs['scope'] == "not_logged_in_users_only") {
            return $contents;
        }
    }
    if ($emember_auth->isLoggedIn()) {
        // Do not show the content to anyone who is logged in
        if (isset($attrs['scope']) && $attrs['scope'] == "not_logged_in_users_only") {
            return "";
        }
        // Show content to anyone who is logged in
        if (isset($attrs['scope']) && $attrs['scope'] == "verified_users_only") {
            return $contents;
        }
        $expires = $emember_auth->getUserInfo('account_state');
        if ($expires == 'expired') {
            //Show the renewal message as this account is expired
            return get_renewal_link();
        }
        if (isset($attrs['member_id'])) {
            $member_id = $emember_auth->getUserInfo('member_id');
            $permitted_member_ids = explode('-', $attrs['member_id']);
            if (in_array($member_id, $permitted_member_ids)) {
                return $contents;
            } else {
                if (!empty($do_not_show_restricted_msg)) {
                    return "";
                    //do not show the restrcted content message
                }
                return wp_emember_format_message(EMEMBER_ACCOUNT_PROFILE_NOT_ALLOWED);
            }
        }
        if (isset($attrs['for'])) {
            $level = $emember_auth->getUserInfo('membership_level');
            $permitted_levels = explode('-', $attrs['for']);
            if (in_array($level, $permitted_levels)) {
                return $contents;
            }
            if ($emember_config->getValue('eMember_enable_secondary_membership')) {
                $sec_levels = $emember_auth->getUserInfo('more_membership_levels');
                if ($sec_levels) {
                    if (is_string($sec_levels)) {
                        $sec_levels = explode(',', $sec_levels);
                    }
                    foreach ($sec_levels as $sec_level) {
                        if (in_array($sec_level, $permitted_levels)) {
                            return $contents;
                        }
                    }
                }
            }
            if (!empty($do_not_show_restricted_msg)) {
                return "";
                //do not show the restrcted content message
            }
            if (isset($attrs['custom_msg'])) {
                //Show the custom message
                $replacement = $attrs['custom_msg'];
                return wp_emember_format_message($replacement);
            } else {
                //Show the standard hidden content
                $account_upgrade_url = $emember_config->getValue('eMember_account_upgrade_url');
                return wp_emember_format_message(EMEMBER_HIDDEN_CONTENT_MESSAGE . '<br/>' . EMEMBER_PLEASE . ' <a href=" ' . $account_upgrade_url . '" target=_blank>' . EMEMBER_RENEW_OR_UPGRADE . '</a> ' . EMEMBER_YOUR_ACCOUNT);
            }
        }
        if (isset($attrs['not_for'])) {
            $level = $emember_auth->getUserInfo('membership_level');
            $ban_levels = explode('-', $attrs['not_for']);
            $banned = false;
            if (in_array($level, $ban_levels)) {
                $banned = true;
            } else {
                if ($emember_config->getValue('eMember_enable_secondary_membership')) {
                    $sec_levels = $emember_auth->getUserInfo('more_membership_levels');
                    if (!empty($sec_levels)) {
                        if (is_string($sec_levels)) {
                            $sec_levels = explode(',', $sec_levels);
                        }
                        foreach ($sec_levels as $sec_level) {
                            if (in_array($sec_level, $ban_levels)) {
                                $banned = true;
                            }
                        }
                    }
                }
            }
            if ($banned) {
                if (!empty($do_not_show_restricted_msg)) {
                    return "";
                    //do not show the restrcted content message
                }
                return wp_emember_format_message(EMEMBER_HIDDEN_CONTENT_MESSAGE);
            }
        }
        return $contents;
    }
    $join_url = $emember_config->getValue('eMember_payments_page');
    if (empty($join_url)) {
        return wp_emember_format_message('<b>Membership Payment/Join Page</b>value is not set in eMember settings. Site admin needs to complete the settings in the pages/forms settings menu of eMember before the plugin can work.');
    } else {
        $join_url = ' href ="' . $join_url . '" ';
    }
    if (!empty($do_not_show_restricted_msg)) {
        return "";
        //do not show the restrcted content message
    }
    if (isset($attrs['custom_msg'])) {
        $replacement = $attrs['custom_msg'];
    } else {
        $replacement = '<a ' . $join_url . ' ><b>' . EMEMBER_MEMBERS_ONLY_MESSAGE . '</b></a>';
    }
    return wp_emember_format_message($replacement);
}
Exemplo n.º 27
0
function wp_eMember_admin_functions_general_menu()
{
    $emember_config = Emember_Config::getInstance();
    if (isset($_POST['generate_registration_link'])) {
        $errorMsg = "";
        $eMember_member_id = (string) $_POST["eMember_member_id"];
        $member_record = dbAccess::find(WP_EMEMBER_MEMBERS_TABLE_NAME, ' member_id=\'' . $eMember_member_id . '\'');
        if ($member_record) {
            $md5_code = md5($member_record->reg_code);
            $separator = '?';
            $url = get_option('eMember_registration_page');
            if (empty($url)) {
                $errorMsg .= "Error! You need to specify the registration URL in the pages/forms settings menu of this plugin.";
            } else {
                if (strpos($url, '?') !== false) {
                    $separator = '&';
                }
                $reg_url = $url . $separator . 'member_id=' . $eMember_member_id . '&code=' . $md5_code;
            }
        } else {
            $errorMsg .= "Error! Could not find the member ID in the database. Please double check the member ID value.";
        }
        $message = "";
        if (!empty($errorMsg)) {
            $message = $errorMsg;
        } else {
            $message = 'Registration Link Generated! Your customer can complete his/her membership registration by going to the generated link.';
        }
        echo '<div id="message" class="updated fade"><p><strong>';
        echo $message;
        echo '</strong></p></div>';
    }
    if (isset($_POST['generate_and_send_registration_link'])) {
        $errorMsg = "";
        $eMember_member_id = (string) $_POST["eMember_member_id"];
        $member_record = dbAccess::find(WP_EMEMBER_MEMBERS_TABLE_NAME, ' member_id=\'' . $eMember_member_id . '\'');
        if ($member_record) {
            $md5_code = md5($member_record->reg_code);
            $separator = '?';
            $url = get_option('eMember_registration_page');
            if (empty($url)) {
                $errorMsg .= "<br />You need to specify the registration URL in the pages settings menu of this plugin.";
            } else {
                if (strpos($url, '?') !== false) {
                    $separator = '&';
                }
                $reg_url = $url . $separator . 'member_id=' . $eMember_member_id . '&code=' . $md5_code;
            }
            $email = $member_record->email;
            $subject = get_option('eMember_email_subject');
            $body = get_option('eMember_email_body');
            $from_address = get_option('senders_email_address');
            $tags = array("{first_name}", "{last_name}", "{reg_link}");
            $vals = array($member_record->first_name, $member_record->last_name, $reg_url);
            $email_body = str_replace($tags, $vals, $body);
            $headers = 'From: ' . $from_address . "\r\n";
            wp_mail($email, $subject, $email_body, $headers);
        } else {
            $errorMsg .= "<br />Could not find the member ID in the database";
        }
        $message = "";
        if (!empty($errorMsg)) {
            $message = $errorMsg;
        } else {
            $message = "Member registration completion email successfully sent to:" . $email;
        }
        echo '<div id="message" class="updated fade"><p><strong>';
        echo $message;
        echo '</strong></p></div>';
    }
    if (isset($_POST['generate_and_send_registration_link_bulk'])) {
        $errorMsg = "";
        global $wpdb;
        $query = "SELECT member_id,reg_code,first_name,last_name FROM " . WP_EMEMBER_MEMBERS_TABLE_NAME . " WHERE user_name = ''";
        $member_records = $wpdb->get_results($query);
        if ($member_records) {
            foreach ($member_records as $member_record) {
                $md5_code = md5($member_record->reg_code);
                $separator = '?';
                $url = get_option('eMember_registration_page');
                if (empty($url)) {
                    $errorMsg .= "<br />You need to specify the registration URL in the pages settings menu of this plugin.";
                    break;
                } else {
                    if (strpos($url, '?') !== false) {
                        $separator = '&';
                    }
                    $reg_url = $url . $separator . 'member_id=' . $member_record->member_id . '&code=' . $md5_code;
                }
                $email = $member_record->email;
                $subject = get_option('eMember_email_subject');
                $body = get_option('eMember_email_body');
                $from_address = get_option('senders_email_address');
                $tags = array("{first_name}", "{last_name}", "{reg_link}");
                $vals = array($member_record->first_name, $member_record->last_name, $reg_url);
                $email_body = str_replace($tags, $vals, $body);
                $headers = 'From: ' . $from_address . "\r\n";
                wp_mail($email, $subject, $email_body, $headers);
            }
        }
        $message = "";
        if (!empty($errorMsg)) {
            $message = $errorMsg;
        } else {
            $message = "Member registration completion email successfully sent.";
        }
        echo '<div id="message" class="updated fade"><p><strong>';
        echo $message;
        echo '</strong></p></div>';
    }
    if (isset($_POST['emem_to_wp'])) {
        global $wpdb;
        $member_table = WP_EMEMBER_MEMBERS_TABLE_NAME;
        $ret_member_db = $wpdb->get_results("SELECT * FROM {$member_table} ", OBJECT);
        foreach ($ret_member_db as $emember) {
            $emember->user_name = trim($emember->user_name);
            if (empty($emember->user_name)) {
                continue;
            }
            if (strtolower($emember->user_name) === "admin") {
                continue;
            }
            if (!username_exists($emember->user_name)) {
                $role_names = array(1 => 'Administrator', 2 => 'Editor', 3 => 'Author', 4 => 'Contributor', 5 => 'Subscriber');
                $membership_level_resultset = dbAccess::find(WP_EMEMBER_MEMBERSHIP_LEVEL_TABLE, " id='" . $emember->membership_level . "'");
                $wp_user_info = array();
                $wp_user_info['user_nicename'] = implode('-', explode(' ', $emember->user_name));
                $wp_user_info['display_name'] = $emember->user_name;
                $wp_user_info['nickname'] = $emember->user_name;
                $wp_user_info['first_name'] = $emember->first_name;
                $wp_user_info['last_name'] = $emember->last_name;
                $wp_user_info['role'] = $role_names[$membership_level_resultset->role];
                $wp_user_info['user_registered'] = date('Y-m-d H:i:s');
                //$wp_user_id = wp_create_user($emember->user_name, 'changeme', $emember->email);
                $wp_user_id = eMember_wp_create_user($emember->user_name, 'changeme', $emember->email);
                $wp_user_info['ID'] = $wp_user_id;
                wp_update_user($wp_user_info);
                //$wpdb->query("UPDATE  $wpdb->users set user_pass = \'" . $emember->password . '\' WHERE ID = ' . $wp_user_id);
                $user_info = get_userdata($wp_user_id);
                $user_cap = is_array($user_info->wp_capabilities) ? array_keys($user_info->wp_capabilities) : array();
                if (!in_array('administrator', $user_cap)) {
                    update_wp_user_Role($wp_user_id, $membership_level_resultset->role);
                }
            }
        }
        echo '<div id="message" class="updated fade"><p>WordPress user account creation complete!</p></div>';
    }
    if (isset($_POST['emem_when_wp'])) {
        $emember_config->setValue('eMember_enable_emem_when_wp', $_POST['eMember_enable_emem_when_wp']);
        $emember_config->setValue('eMember_emem_when_wp_default_level', $_POST['eMember_emem_when_wp_default_level']);
        $emember_config->setValue('eMember_emem_when_wp_default_acstatus', $_POST['eMember_emem_when_wp_default_acstatus']);
        $emember_config->saveConfig();
        echo '<div id="message" class="updated fade"><p>Auto Member Account Creation Settings Saved!</p></div>';
    }
    if (isset($_POST['emember_management_permission_update'])) {
        $emember_config->setValue('emember_management_permission', $_POST['emember_management_permission']);
        $emember_config->saveConfig();
        echo '<div id="message" class="updated fade"><p><strong>';
        echo 'Management permission setting updated!';
        echo '</strong></p></div>';
    }
    ?>

            <div class="postbox">
                <h3><label for="title">Generate a Registration Completion link</label></h3>
                <div class="inside">
                    You can manually generate a registration completion link here and give it to your customer if they have missed the email that was automatically sent out to them after the payment.<br />
                    <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">

                        <table width="100%" border="0" cellspacing="0" cellpadding="6">
                            <tr valign="top"><td width="25%" align="right">
                                    <strong>Member ID: </strong>
                                </td><td align="left">
                                    <input name="eMember_member_id" type="text" size="5" value="<?php 
    echo isset($eMember_member_id) ? $eMember_member_id : "";
    ?>
" />
                                    <br /><i>(i) Enter the member ID (you can get the member ID from the members menu).</i><br /><br />
                                </td></tr>

                            <tr valign="top"><td width="25%" align="right">
                                </td><td align="left">
                                    <input type="submit" name="generate_registration_link" value="<?php 
    _e('Generate Link');
    ?>
 &raquo;" />
                                    <br /><i>(ii) Hit the "Generate Link" button.</i><br /><br />
                                </td></tr>
                            <tr valign="top"><td width="25%" align="right">
                                    <strong>Registration Link: </strong>
                                </td><td align="left">
                                    <textarea name="wp_eStore_rego_link" rows="3" cols="80"><?php 
    echo isset($reg_url) ? $reg_url : "";
    ?>
</textarea>
                                    <br /><i>This is the registration completion link.</i><br />
                                </td></tr>
                        </table>
                    </form>
                </div></div>

            <div class="postbox">
                <h3><label for="title">Generate and Email the Registration Completion link</label></h3>
                <div class="inside">
                    You can generate a registration completion link and email it to your customer in one go. This can be useful if they have missed the email that was automatically sent out to them after the payment.<br />
                    <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">

                        <table width="100%" border="0" cellspacing="0" cellpadding="6">
                            <tr valign="top"><td width="25%" align="right">
                                    <strong>Member ID: </strong>
                                </td><td align="left">
                                    <input name="eMember_member_id" type="text" size="5" value="<?php 
    echo isset($eMember_member_id) ? $eMember_member_id : "";
    ?>
" />
                                    <br /><i>(i) Enter the member ID (you can get the member ID from the members menu).</i><br /><br />
                                </td></tr>

                            <tr valign="top"><td width="25%" align="right">
                                </td><td align="left">
                                    <input type="submit" name="generate_and_send_registration_link" value="<?php 
    _e('Generate & Email Link');
    ?>
 &raquo;" />
                                    <br /><i>(ii) Hit the "Generate & Email Link" button.</i><br /><br />
                                </td></tr>

                        </table>
                    </form>
                </div></div>

            <div class="postbox">
                <h3><label for="title">Generate and Email the Registration Completion link (Bulk Mode)</label></h3>
                <div class="inside">

                    You can generate registration completion link and email it to all your members that are still waiting to complete the registration. This can be useful if they have missed the email that was automatically sent out to them after the payment.<br />
                    <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
                        <input type="submit" name="generate_and_send_registration_link_bulk" value="<?php 
    _e('Generate & Email Link in Bulk');
    ?>
 &raquo;" />
                        <br /><i>Hit the "Generate & Email Link in Bulk" button.</i><br /><br />
                    </form>
                </div></div>



            <div class="postbox">
                <h3><label for="title">Create WordPress User Account for the members that do not have one</label></h3>
                <div class="inside">
                    <strong>If you have a lot of eMember members that do not have a corresponding WordPress user account and for some reason you wanted to create WordPress user account for them then use this option.</strong>
                    <br /><br />
                    &raquo; When you use this option the plugin will create wordpress user accounts for every eMember user that does not have a corresponding WordPress account already.
                    <br />
                    &raquo; The WordPress user accounts will be created with the same details from eMember but the password will be set to "changeme" (The user will have to change the password to their liking).
                    <br />
                    &raquo; Why? The password is kept in the database using an one way encryption so nobody except the member knows what the real password is.
                    <br /><br />
                    <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
                        <input type="submit" name="emem_to_wp" value="<?php 
    _e('Create WP account for eMember users');
    ?>
 &raquo;" />
                    </form>
                </div></div>
            <div class="postbox">
                <h3><label for="title">Automatically Create eMember Account When a WordPress User Account is Created.</label></h3>
                <div class="inside">

                    <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
                        <table width="100%" border="0" cellspacing="0" cellpadding="6">

                            <tr valign="top"><td width="25%" align="right">
                                    <strong>Enable this Feature: </strong>
                                </td><td align="left">
                                    <input name="eMember_enable_emem_when_wp" type="checkbox" <?php 
    echo $emember_config->getValue('eMember_enable_emem_when_wp');
    ?>
 value="checked='checked'" />
                                    <br /><i>When this feature is enabled, an eMember account will be created for every WP User account that gets created on this site.</i><br />
                                </td></tr>

                            <tr valign="top"><td width="25%" align="right"><strong>Default Membership Level: </strong></td>
                                <td align="left">
                                    <select name="eMember_emem_when_wp_default_level">
                                        <?php 
    $all_levels = dbAccess::findAll(WP_EMEMBER_MEMBERSHIP_LEVEL_TABLE, ' id != 1 ', ' id DESC ');
    $selected_level = $emember_config->getValue('eMember_emem_when_wp_default_level');
    $selected_acstatus = $emember_config->getValue('eMember_emem_when_wp_default_acstatus');
    foreach ($all_levels as $level) {
        ?>
                                            <option <?php 
        echo $selected_level == $level->id ? "selected='selected'" : "";
        ?>
 value="<?php 
        echo $level->id;
        ?>
"><?php 
        echo $level->alias;
        ?>
</option>
                                        <?php 
    }
    ?>
                                    </select>
                                    <br /><i>When automatically creating a member account in the background, the membership level will be set to the one you specify above.</i>
                                </td></tr>

                            <tr valign="top"><td width="25%" align="right"><strong>Default Account Status: </strong></td>
                                <td align="left">
                                    <select name="eMember_emem_when_wp_default_acstatus">
                                        <option <?php 
    echo $selected_acstatus == 'active' ? "selected='selected'" : "";
    ?>
 value="active">Active</option>
                                        <option <?php 
    echo $selected_acstatus == 'inactive' ? "selected='selected'" : "";
    ?>
 value="inactive">Inactive</option>
                                        <option <?php 
    echo $selected_acstatus == 'pending' ? "selected='selected'" : "";
    ?>
 value="pending">Pending</option>
                                        <option <?php 
    echo $selected_acstatus == 'expired' ? "selected='selected'" : "";
    ?>
 value="expired">Expired</option>
                                    </select>
                                    <br /><i>The account status will be set to the one specified above.</i>
                                </td></tr>
                        </table>
                        <input type="submit" name="emem_when_wp" value="Save Settings &raquo;" />
                    </form>
                </div></div>

            <div class="postbox">
                <h3><label for="title">eMember Admin Dashboard Access Permission</label></h3>
                <div class="inside">
                    <p>
                        eMember's admin dashboard is accessible to admin users only (just like any other plugin).
                        You can allow users with other WP role to access the eMember admin dashboard by selecting a value below.
                        <br /><br />
                        <strong>If don't know what this is for then don't change the following value.</strong>
                    </p>
                    <?php 
    $selected_permission = $emember_config->getValue('emember_management_permission');
    ?>
                    <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
                        <select name="emember_management_permission">
                            <option <?php 
    echo $selected_permission == 'edit_themes' ? "selected='selected'" : "";
    ?>
 value="edit_themes">Admin</option>
                            <option <?php 
    echo $selected_permission == 'edit_pages' ? "selected='selected'" : "";
    ?>
 value="edit_pages">Editor</option>
                            <option <?php 
    echo $selected_permission == 'edit_published_posts' ? "selected='selected'" : "";
    ?>
 value="edit_published_posts">Author</option>
                            <option <?php 
    echo $selected_permission == 'edit_posts' ? "selected='selected'" : "";
    ?>
 value="edit_posts">Contributor</option>
                        </select>
                        <input type="submit" name="emember_management_permission_update" value="Save Permission &raquo" />
                    </form>
                </div></div>
            <?php 
}
Exemplo n.º 28
0
<?php

if (!defined('ABSPATH')) {
    include_once '../../../../wp-load.php';
    include_once '../eMember_debug_handler.php';
}
eMember_log_debug('Post AWeber form submission request received. Processing...', true);
$emember_config = Emember_Config::getInstance();
$eMember_allow_remote_post = $emember_config->getValue('wp_eMember_enable_remote_post');
if (!$eMember_allow_remote_post) {
    echo "Error! Remote POST is disabled";
    eMember_log_debug('Error! Remote POST is disabled in the settings. So this request will not be processed.', false);
    exit;
}
$secretKey = $emember_config->getValue('wp_eMember_secret_word_for_post');
//TODO - add a secret key check and make this script do the whole user creation tasks?
//Massage the data
$email = $_REQUEST['email'];
$name = $_REQUEST['name'];
list($first_name, $last_name) = explode(' ', $name);
$listname = $_REQUEST['unit'];
$username = $email;
$referrer_mail = $_REQUEST['referrer'];
if (empty($email) || empty($name) || empty($listname)) {
    echo "Error!\n";
    echo "Missing mandatory field. Email, first name and last name must be present!\n";
    eMember_log_debug('Error! Missing mandatory field. Email, first name and last name must be present...', false);
    exit;
}
//POST the data to the eMember API
$postURL = WP_EMEMBER_URL . "/api/create.php";
function eMember_folder_protection_settings_menu()
{
    $message = "";
    $emember_config = Emember_Config::getInstance();
    if (isset($_GET['delete_record']) && isset($_GET['record_id'])) {
        //Need to delete a record
        $id = $_GET['record_id'];
        global $wpdb;
        $media_db_table_name = $wpdb->prefix . "emember_uploads";
        $guid = $wpdb->get_col("SELECT guid FROM {$media_db_table_name} WHERE id='{$id}'");
        if (isset($guid[0])) {
            $fileinfo = pathinfo($guid[0]);
            $filename = $fileinfo['basename'];
            $upload_dir = wp_upload_dir();
            $dir = $upload_dir['basedir'] . '/emember/downloads/';
            @unlink($dir . $filename);
            $updatedb = "DELETE FROM {$media_db_table_name} WHERE id='{$id}'";
            $results = $wpdb->query($updatedb);
            $message .= "Record successfully deleted!";
        }
    }
    if (isset($_POST['emem_add_manually_uploaded_file'])) {
        $upload_dir = wp_upload_dir();
        $filename = explode('.', $_POST['emember_manually_uploaded_filename']);
        $filename = $filename[0];
        $guid = $upload_dir['baseurl'] . '/emember/downloads/' . trim($_POST['emember_manually_uploaded_filename']);
        $date = trim($_POST['emember_manually_uploaded_date']);
        emember_add_uploaded_file_to_inventory($filename, $guid, $date);
        $message = "Saved Successfully.";
    }
    if (isset($_POST['emem_folder_protect'])) {
        $upload_dir = wp_upload_dir();
        $dir = $upload_dir['basedir'] . '/emember/downloads/';
        if (isset($_POST['emember_download_folder_protection'])) {
            $emember_config->setValue('emember_download_folder_protection', 1);
            $dir = $upload_dir['basedir'] . '/emember/downloads/';
            $htaccess = 'AuthUserFile ' . $dir . '.htpasswd' . "\n";
            $htaccess .= 'AuthName "eMember Protected Folder"' . "\n";
            $htaccess .= 'AuthType Basic' . "\n\n";
            $htaccess .= 'require valid-user' . "\n";
            if (!is_dir($dir)) {
                mkdir($dir, 0755, true);
            }
            //Let's also create an empty index.html file in this folder
            $index_file = $dir . '/index.html';
            $handle = fopen($index_file, 'w');
            fclose($handle);
            $htpasswd = '';
            global $wpdb;
            $users = $wpdb->get_results('SELECT user_name, password FROM ' . $wpdb->prefix . 'wp_eMember_members_tbl');
            foreach ($users as $user) {
                if (!empty($user->user_name)) {
                    //Do not add any entries where the username is empty
                    $htpasswd .= $user->user_name . ':' . $user->password . "\n";
                }
            }
            file_put_contents($dir . '.htaccess', $htaccess);
            file_put_contents($dir . '.htpasswd', $htpasswd);
            $message = "Download folder protection settings updated";
        } else {
            @unlink($dir . '.htaccess');
            @unlink($dir . '.htpasswd');
            $emember_config->setValue('emember_download_folder_protection', '');
            $message = "Download folder protection settings updated";
        }
        $emember_config->saveConfig();
        global $wp_rewrite;
        $wp_rewrite->flush_rules();
        flush_rewrite_rules(true);
        echo '<script type="text/javascript">location.href="?page=eMember_admin_functions_menu&tab=2";</script>';
    }
    if (!empty($message)) {
        echo '<div id="message" class="updated fade"><p><strong>';
        echo $message;
        echo '</strong></p></div>';
    }
    ?>
    <div class="postbox">
        <h3><label for="title">Download Folder Protection</label></h3>
        <div class="inside">

            <div class="eMember_yellow_box">
                When this feature is enabled, any file you upload to the <code>"wp-content/uploads/emember/downloads"</code> folder will be protected. Only your members will be able to download any file(s) from that folder after providing their eMember username and password. You can upload your files to this folder using an FTP software or the media uploader below.
            </div>

            <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
                <input type="checkbox" name="emember_download_folder_protection" id="emember_download_folder_protection"  <?php 
    $protect_download = $emember_config->getValue('emember_download_folder_protection');
    echo $protect_download ? 'checked="checked"' : '';
    ?>
 value="1" />
                <i>Enable/Disable eMember Folder Protection</i>
                <input type="submit" name="emem_folder_protect" value="Update" class = "button-primary" />
            </form>

        </div></div>

    <div class="postbox">
        <h3><label for="title">eMember Media Uploader</label></h3>
        <div class="inside">
            <div id="emember-file-uploader">
                <noscript>
                <p>Please enable JavaScript to use file uploader.</p>
                <!-- or put a simple form for upload here -->
                </noscript>
            </div>
            <?php 
    include_once 'lib/class.emember.list_protected_media.php';
    //Create an instance of our list item class...
    $emember_list_table = new WP_eMember_List_Protected_Media();
    //Fetch, prepare, sort, and filter our data...
    $emember_list_table->prepare_items();
    //$form_post_url = $_REQUEST['page']."&tab=".$_REQUEST['tab'];//This can be handy if you need to post the form to a different post
    ?>
            <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
            <form id="emember-protected-medias" method="POST">
                <!-- For plugins, we also need to ensure that the form posts back to our current page -->
                <input type="hidden" name="page" value="" />
                <!-- Now we can render the completed list table -->
    <?php 
    $emember_list_table->display();
    ?>
            </form>
        </div></div>

    <div class="postbox">
        <h3><label for="title">Add Manually Uploaded File</label></h3>
        <div class="inside">

            <div class="eMember_yellow_box">
                If you manually uploaded a file to the protected folder using FTP, You Can add that file's information to eMember file inventory using this form after you have uploaded the file via FTP.
            </div>

            <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
                <table>
                    <tr>
                        <td>File Name</td>
                        <td>
                            <input type="text" size="30" name="emember_manually_uploaded_filename" id="emember_manually_uploaded_filename"   value="" />
                            <i>Manually Uploaded File Name</i>
                        </td>
                    </tr>
                    <tr>
                        <td>Date</td>
                        <td><input type="date" name="emember_manually_uploaded_date" id="emember_manually_uploaded_date" value="">
                            <i> Upload Date </i></td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input type="submit" name="emem_add_manually_uploaded_file" value="Add" class = "button-primary" />
                        </td>
                    </tr>
                </table>
            </form>
        </div></div>

    <script type="text/javascript">
        jQuery(document).ready(function($) {
            var uploader = new qq.FileUploader({
                button_label: 'Upload a file',
                element: document.getElementById('emember-file-uploader'),
                action: '<?php 
    echo admin_url("admin-ajax.php");
    ?>
',
                params: {'action': 'emember_file_upload'},
                onComplete: function(id, fileName, responseJSON) {
                    location.reload();
                }});
            $("#emember_manually_uploaded_date").dateinput({'format': 'yyyy-mm-dd', selectors: true, yearRange: [-100, 100]});
        });
    </script>
    <?php 
}
Exemplo n.º 30
0
function emember_pages_settings()
{
    global $emember_config;
    $emember_config = Emember_Config::getInstance();
    if (isset($_POST['info_update'])) {
        $msg = '';
        $emember_config->setValue('login_page_url', trim((string) $_POST["login_page_url"]));
        $emember_config->setValue('after_login_page', trim((string) $_POST["after_login_page"]));
        $emember_config->setValue('after_logout_page', trim((string) $_POST["after_logout_page"]));
        $emember_config->setValue('eMember_registration_page', trim((string) $_POST["eMember_registration_page"]));
        update_option('eMember_registration_page', trim((string) $_POST["eMember_registration_page"]));
        //For backwards compatibility with eStore
        $emember_config->setValue('eMember_after_registration_page', trim((string) $_POST["eMember_after_registration_page"]));
        $emember_config->setValue('eMember_payments_page', trim((string) $_POST["eMember_payments_page"]));
        $emember_config->setValue('eMember_profile_edit_page', trim((string) $_POST["eMember_profile_edit_page"]));
        $emember_config->setValue('eMember_support_page', trim((string) $_POST["eMember_support_page"]));
        $emember_config->setValue('eMember_terms_conditions_page', trim((string) $_POST["eMember_terms_conditions_page"]));
        $emember_config->setValue('eMember_password_reset_page', trim((string) $_POST["eMember_password_reset_page"]));
        $emember_config->setValue('eMember_bookmark_listing_page', trim((string) $_POST["eMember_bookmark_listing_page"]));
        $emember_config->setValue('eMember_profile_thumbnail', isset($_POST["eMember_profile_thumbnail"]) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_title', isset($_POST['eMember_reg_title']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_firstname', isset($_POST['eMember_reg_firstname']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_lastname', isset($_POST['eMember_reg_lastname']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_company', isset($_POST['eMember_reg_company']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_email', isset($_POST['eMember_reg_email']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_phone', isset($_POST['eMember_reg_phone']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_street', isset($_POST['eMember_reg_street']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_city', isset($_POST['eMember_reg_city']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_state', isset($_POST['eMember_reg_state']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_zipcode', isset($_POST['eMember_reg_zipcode']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_country', isset($_POST['eMember_reg_country']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_gender', isset($_POST['eMember_reg_gender']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_title', isset($_POST['eMember_edit_title']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_firstname', isset($_POST['eMember_edit_firstname']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_lastname', isset($_POST['eMember_edit_lastname']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_company', isset($_POST['eMember_edit_company']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_email', isset($_POST['eMember_edit_email']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_phone', isset($_POST['eMember_edit_phone']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_street', isset($_POST['eMember_edit_street']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_city', isset($_POST['eMember_edit_city']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_state', isset($_POST['eMember_edit_state']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_zipcode', isset($_POST['eMember_edit_zipcode']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_country', isset($_POST['eMember_edit_country']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_gender', isset($_POST['eMember_edit_gender']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_title_required', isset($_POST['eMember_reg_title_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_firstname_required', isset($_POST['eMember_reg_firstname_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_lastname_required', isset($_POST['eMember_reg_lastname_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_company_required', isset($_POST['eMember_reg_company_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_email_required', isset($_POST['eMember_reg_email_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_phone_required', isset($_POST['eMember_reg_phone_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_street_required', isset($_POST['eMember_reg_street_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_city_required', isset($_POST['eMember_reg_city_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_state_required', isset($_POST['eMember_reg_state_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_zipcode_required', isset($_POST['eMember_reg_zipcode_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_country_required', isset($_POST['eMember_reg_country_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_reg_gender_required', isset($_POST['eMember_reg_gender_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_show_terms_conditions', isset($_POST['eMember_show_terms_conditions']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_hide_membership_field', isset($_POST['eMember_hide_membership_field']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_show_confirm_pass_field', isset($_POST['eMember_show_confirm_pass_field']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_title_required', isset($_POST['eMember_edit_title_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_firstname_required', isset($_POST['eMember_edit_firstname_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_lastname_required', isset($_POST['eMember_edit_lastname_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_company_required', isset($_POST['eMember_edit_company_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_email_required', isset($_POST['eMember_edit_email_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_phone_required', isset($_POST['eMember_edit_phone_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_street_required', isset($_POST['eMember_edit_street_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_city_required', isset($_POST['eMember_edit_city_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_state_required', isset($_POST['eMember_edit_state_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_zipcode_required', isset($_POST['eMember_edit_zipcode_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_country_required', isset($_POST['eMember_edit_country_required']) ? "checked='checked'" : '');
        $emember_config->setValue('eMember_edit_gender_required', isset($_POST['eMember_edit_gender_required']) ? "checked='checked'" : '');
        $tmpmsg1 = htmlspecialchars($_POST['eMember_login_widget_message_for_logged_members'], ENT_COMPAT);
        $emember_config->setValue('eMember_login_widget_message_for_logged_members', $tmpmsg1);
        $emember_config->saveConfig();
        echo '<div id="message" class="updated fade"><p>';
        echo $msg ? '<strong style="color:red;">' . $msg : '<strong>Options Updated!';
        echo '</strong></p></div>';
    }
    ?>
    <form method="post" action="<?php 
    echo $_SERVER["REQUEST_URI"];
    ?>
">
        <input type="hidden" name="info_update" id="info_update" value="true" />
        <div class="wrap">
            <div id="poststuff">
                <div id="post-body">
                    <div class="eMember_grey_box">
                        <p>For detailed documentation, information and updates, please visit the <a href="http://www.tipsandtricks-hq.com/wordpress-membership" target="_blank">WP eMember Documentation Page</a></p>
                        <p>Like the plugin? Give us a <a href="http://www.tipsandtricks-hq.com/?p=1706#gfts_share" target="_blank">thumbs up here</a> by clicking on a share button or leave a comment to let us know.</p>
                    </div>

                    <!--  <div class="basic" style="float:left;"  id="list1a">-->
                    <!--  <div class="title"><label for="title">General Settings</label></div> -->
                    <div class="postbox">
                        <h3><label for="title">General Settings</label></h3> <!-- added -->
                        <div class="inside">

                            <div class="eMember_yellow_box">
                                <p style="color:blue;font-size:14px;font-weight:bold;margin-top:5px;">The plugin automatically created the mandatory configuration pages for you at install time. You can edit them however you like. You can also create your own pages if you like but make sure to update the URL values below if you do so.</p>

                                <p style="font-size:14px; line-height:22px;padding:5px 0px 0px 0px;">
                                    <strong>Note: </strong>The mandatory fields in this section must be completed for the plugin to function correctly.
                                </p>
                            </div>
                            <p style="margin-bottom:15px"></p>

                            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr valign="top">
                                    <td width="25%" align="left"><strong>Login Page (Mandatory):</strong></td>
                                    <td align="left">
                                        <input name="login_page_url" type="text" size="100" value="<?php 
    echo $emember_config->getValue('login_page_url');
    ?>
"/><br />
                                        <i>This is the page where the members can go to log into the site. Create a page and put <strong>[wp_eMember_login]</strong> shortcode in the page that will display a form which will allow members to be able to log in. Enter the URL of this page in this field</i><br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Registration Page (Mandatory):</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_registration_page" type="text" size="100" value="<?php 
    echo $emember_config->getValue('eMember_registration_page');
    ?>
"/><br />
                                        <i>Where members can fill out a registration form to complete a membership account creation. Create a page and put <strong>[wp_eMember_registration]</strong> shortcode in the page that will display a form which will allow users to be able to register. Enter the URL of this page in this field. <a href="http://www.tipsandtricks-hq.com/forum/topic/the-difference-between-registration-page-and-join-us-page" target="_blank">More explanation here</a></i><br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Membership Payment/Join Page (Mandatory):</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_payments_page" type="text" size="100" value="<?php 
    echo $emember_config->getValue('eMember_payments_page');
    ?>
"/><br />
                                        <i>The URL of the page where you have a list of all types of membership that you offer (example: Free, Silver, Gold) and the necessary buttons that the visitors can use to purchase a membership. For the free membership signup (if you want to allow free membership) simply place a link pointing to the Registration page where anyone can go and signup for a free membership. <a href="http://www.tipsandtricks-hq.com/forum/topic/the-difference-between-registration-page-and-join-us-page" target="_blank">More explanation here</a></i><br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>After Login Page (Optional):</strong>
                                    </td>
                                    <td align="left">
                                        <input name="after_login_page" type="text" size="100" value="<?php 
    echo $emember_config->getValue('after_login_page');
    ?>
"/><br />
                                        <i>Members will be redirected to this page after a successful login. This option is only used if you have not specified a redirection page in the membership level configuration for a particular membership level</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>After Logout Page (Optional):</strong>
                                    </td>
                                    <td align="left">
                                        <input name="after_logout_page" type="text" size="100" value="<?php 
    echo $emember_config->getValue('after_logout_page');
    ?>
"/><br />
                                        <i>Members will be redirected to this page after logout.</i><br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>After Registration Page (Optional):</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_after_registration_page" type="text" size="100" value="<?php 
    echo $emember_config->getValue('eMember_after_registration_page');
    ?>
"/><br />
                                        Members will be redirected to this page after completing the registration.
                                        <br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Member Profile Edit Page (Optional):</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_profile_edit_page" type="text" size="100" value="<?php 
    echo $emember_config->getValue('eMember_profile_edit_page');
    ?>
"/><br />
                                        <i>The URL of the page where members can edit their profile (eg. their email address). To allow the members to be able to change their profile simply create a page and put <strong>[wp_eMember_edit_profile]</strong> trigger text in the page that will display a form which will allow members to update their profile. Enter the URL of this page in this settings field</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Support Page (Optional):</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_support_page" type="text" size="100" value="<?php 
    echo $emember_config->getValue('eMember_support_page');
    ?>
"/><br />
                                        <i>URL of the Support/Member help page if you have any. Leave empty if it does not apply.</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Bookmarks Listing Page (Optional):</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_bookmark_listing_page" type="text" size="100" value="<?php 
    echo $emember_config->getValue('eMember_bookmark_listing_page');
    ?>
"/><br />
                                        <i>Use this field if you have enabled the <a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=99" target="_blank">bookmarking feature</a>. Enter the URL of the page where you will display the member's bookmarks list (the page where you added the <code>[wp_eMember_user_bookmarks]</code> shortcode).</i><br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Password Reset Page (Optional):</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_password_reset_page" type="text" size="100" value="<?php 
    echo $emember_config->getValue('eMember_password_reset_page');
    ?>
"/><br />
                                        <i>The default method for password reset is via an overlay popup. If you want to use a separete page for password reset instead of the default overlay popup then create a page and use the <strong>[wp_eMember_password_reset]</strong> shortcode in that page. Specify the URL of that page in the above field.</i><br /><br />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>

                    <!-- <div class="title"><label for="title">Registration Form Fields</label></div> -->
                    <div class="postbox">
                        <h3><label for="title">Registration Form Fields</label></h3>	<!-- added -->
                        <div class="inside">
                            <strong><i>Fields to be shown on the Registation form (Username, Password and Email address are mandatory fields and will always be present on the form).</i></strong><br /><br />
                            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Title:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_reg_title" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_title');
    ?>
 value="1"/> Show title field on registration page<br />
                                        <input name="eMember_reg_title_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_title_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>First name:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_reg_firstname" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_firstname');
    ?>
 value="1"/> Show first name field on registration page<br />
                                        <input name="eMember_reg_firstname_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_firstname_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Last name:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_reg_lastname" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_lastname');
    ?>
 value="1"/> Show last name field on registration page<br />
                                        <input name="eMember_reg_lastname_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_lastname_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Phone:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_reg_phone" type="checkbox"  <?php 
    $eMember_reg_phone = $emember_config->getValue('eMember_reg_phone');
    echo $eMember_reg_phone ? 'checked="checked"' : '';
    ?>
 value="1"/> Show phone field on registration page<br />
                                        <input name="eMember_reg_phone_required" type="checkbox"  <?php 
    $eMember_reg_phone = $emember_config->getValue('eMember_reg_phone_required');
    echo $eMember_reg_phone ? 'checked="checked"' : '';
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Company:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_reg_company" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_company');
    ?>
 value="1"/> Show company field on registration page<br />
                                        <input name="eMember_reg_company_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_company_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Address Street:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_reg_street" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_street');
    ?>
 value="1"/> Show street address field on registration page<br />
                                        <input name="eMember_reg_street_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_street_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Address City:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_reg_city" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_city');
    ?>
 value="1"/> Show address city field on registration page<br />
                                        <input name="eMember_reg_city_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_city_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Address State:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_reg_state" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_state');
    ?>
 value="1"/> Show address state field on registration page<br />
                                        <input name="eMember_reg_state_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_state_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Address Zipcode:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_reg_zipcode" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_zipcode');
    ?>
 value="1"/> Show address zipcode field on registration page<br />
                                        <input name="eMember_reg_zipcode_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_zipcode_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Country:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_reg_country" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_country');
    ?>
 value="1"/> Show country field on registration page<br />
                                        <input name="eMember_reg_country_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_country_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Gender:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_reg_gender" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_gender');
    ?>
 value="1"/> Show gender field on registration page<br />
                                        <input name="eMember_reg_gender_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_reg_gender_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr>
                                    <td width="25%" align="left"><strong>Show Terms and Conditions Checkbox:</strong></td>
                                    <td align="left"><input name="eMember_show_terms_conditions" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_show_terms_conditions');
    ?>
 value="1"/>
                                        Terms & Conditions Page URL:
                                        <input name="eMember_terms_conditions_page" type="text" size="60" value="<?php 
    echo $emember_config->getValue('eMember_terms_conditions_page');
    ?>
"/>
                                        <br /><i>If you want your members to agree to the terms and conditions before they can register then enable this option.</i>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="25%" align="left"><strong>Hide Membership Level Field:</strong></td>
                                    <td align="left"><input name="eMember_hide_membership_field" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_hide_membership_field');
    ?>
 value="1"/>
                                        <br /><i>The membership level field is a mandatory field for the registration form. You can use this option to make the membership level field hidden if needed.</i>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="25%" align="left"><strong>Show Confirm Password Field:</strong></td>
                                    <td align="left"><input name="eMember_show_confirm_pass_field" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_show_confirm_pass_field');
    ?>
 value="1"/>
                                        <br /><i>Adds a confirm password field in the registration form.</i>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <!-- <div class="title"><label for="title">Edit Profile Form Fields</label></div> -->
                    <div class="postbox">
                        <h3><label for="title">Edit Profile Form Fields</label></h3> <!-- added -->
                        <div class="inside">
                            <strong><i>Fields to be shown on the Edit profile form (Username, Password and Email address are mandatory fields and will always be present on the form).</i></strong><br /><br />
                            <table width="100%" border="0" cellspacing="0" cellpadding="6">
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Title:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_edit_title" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_title');
    ?>
 value="1"/> Show title field on edit profile page<br />
                                        <input name="eMember_edit_title_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_title_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>First name:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_edit_firstname" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_firstname');
    ?>
 value="1"/> Show first name field on edit profile page<br />
                                        <input name="eMember_edit_firstname_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_firstname_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Last name:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_edit_lastname" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_lastname');
    ?>
 value="1"/> Show last name field on edit profile page<br />
                                        <input name="eMember_edit_lastname_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_lastname_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Company:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_edit_company" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_company');
    ?>
 value="1"/> Show company field on edit profile page<br />
                                        <input name="eMember_edit_company_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_company_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Email:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_edit_email" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_email');
    ?>
 value="1"/> Show email field on edit profile page<br />
                                        <input name="eMember_edit_email_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_email_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Phone:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_edit_phone" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_phone');
    ?>
 value="1"/> Show phone field on edit profile page<br />
                                        <input name="eMember_edit_phone_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_phone_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Address Street:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_edit_street" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_street');
    ?>
 value="1"/> Show address street field on edit profile page<br />
                                        <input name="eMember_edit_street_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_street_required');
    ?>
 value="1"/>Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Address City:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_edit_city" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_city');
    ?>
 value="1"/> Show address city field on edit profile page<br />
                                        <input name="eMember_edit_city_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_city_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Address State:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_edit_state" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_state');
    ?>
 value="1"/> Show address state field on edit profile page<br />
                                        <input name="eMember_edit_state_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_state_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Address Zipcode:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_edit_zipcode" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_zipcode');
    ?>
 value="1"/> Show address zipcode field on edit profile page<br />
                                        <input name="eMember_edit_zipcode_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_zipcode_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Country:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_edit_country" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_country');
    ?>
 value="1"/> Show country field on edit profile page<br />
                                        <input name="eMember_edit_country_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_country_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Gender:</strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_edit_gender" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_gender');
    ?>
 value="1"/> Show gender field on edit profile page<br />
                                        <input name="eMember_edit_gender_required" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_edit_gender_required');
    ?>
 value="1"/> Make this field required
                                        <br /><br />
                                    </td>
                                </tr>
                                <tr valign="top">
                                    <td width="25%" align="left">
                                        <strong>Enable Profile Thumbnail Image: </strong>
                                    </td>
                                    <td align="left">
                                        <input name="eMember_profile_thumbnail" type="checkbox"  <?php 
    echo $emember_config->getValue('eMember_profile_thumbnail');
    ?>
 value="1"/> Show profile thumbnail image on edit profile page
                                        <br /><br />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>

                    <div class="postbox">
                        <h3><label for="title">Login Widget Message</label></h3>
                        <div class="inside">
                            <table width="100%" border="0" cellspacing="0" cellpadding="6">

                                <tr valign="top">
                                    <td width="25%" align="left"><strong>Additional Message for Logged in Members:</strong></td>
                                    <td align="left">
                                        <textarea name="eMember_login_widget_message_for_logged_members" cols="70" rows="5"><?php 
    echo stripslashes($emember_config->getValue('eMember_login_widget_message_for_logged_members'));
    ?>
</textarea><br />
                                        <i>This message will be added to the default login widget content that is displayed to the members who are logged in. You can use HTML code in this field.</i><br /><br />
                                    </td>
                                </tr>

                            </table>
                        </div></div>

                    <div class="submit">
                        <input type="submit"  name="info_update" class="button-primary" value="<?php 
    _e('Update options');
    ?>
 &raquo;" />
                    </div>
                    <!-- </div> -->
                </div>
            </div>
        </div>
    </form>
    <script type="text/javascript">
        //	   ;(function($){
        //			$(document).ready(function(){
        //				$('#list1a').accordion({autoHeight:false});
        //				$('#list1a a').click(function(e){ e.stopPropagation(); });
        //		    });
        //	    })(jQuery);
    </script>
    <?php 
}