本文整理汇总了PHP中pmpro_setOption函数的典型用法代码示例。如果您正苦于以下问题:PHP pmpro_setOption函数的具体用法?PHP pmpro_setOption怎么用?PHP pmpro_setOption使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmpro_setOption函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pmpro_upgrade_1_8_7
function pmpro_upgrade_1_8_7()
{
//fix cron jobs
$jobs = _get_cron_array();
// Remove all pmpro cron jobs (for now).
foreach ($jobs as $when => $job_array) {
foreach ($job_array as $name => $job) {
//delete pmpro cron
if (false !== stripos($name, 'pmpro_cron')) {
unset($jobs[$when][$name]);
}
}
//delete empty cron time slots
if (empty($jobs[$when])) {
unset($jobs[$when]);
}
}
// Save the data
_set_cron_array($jobs);
//add the three we want back
pmpro_maybe_schedule_event(current_time('timestamp'), 'daily', 'pmpro_cron_expire_memberships');
pmpro_maybe_schedule_event(current_time('timestamp') + 1, 'daily', 'pmpro_cron_expiration_warnings');
pmpro_maybe_schedule_event(current_time('timestamp'), 'monthly', 'pmpro_cron_credit_card_expiring_warnings');
pmpro_setOption("db_version", "1.87");
return 1.87;
}
示例2: pmpro_upgrade_1_7
function pmpro_upgrade_1_7()
{
pmpro_db_delta();
//just a db delta
pmpro_setOption("db_version", "1.7");
return 1.7;
}
示例3: pmpro_upgrade_1_8_6_9
function pmpro_upgrade_1_8_6_9()
{
global $wpdb;
$orders = $wpdb->get_results("SELECT id, user_id, membership_id, subscription_transaction_id FROM {$wpdb->pmpro_membership_orders} WHERE gateway = 'stripe' AND subscription_transaction_id LIKE 'cus_%'");
if (!empty($orders)) {
if (count($orders) > 100) {
//if more than 100 orders, we'll need to do this via AJAX
pmpro_addUpdate('pmpro_upgrade_1_8_6_9_ajax');
} else {
//less than 100, let's just do them now
$subids = array();
foreach ($orders as $order) {
if (!empty($subids[$order->subscription_transaction_id])) {
$wpdb->query("UPDATE {$wpdb->pmpro_membership_orders} SET subscription_transaction_id = '" . esc_sql($subids[$order->subscription_transaction_id]) . "' WHERE id = '" . $order->id . "' LIMIT 1");
//echo "Updating subid for #" . $order->id . " " . $order->subscription_transaction_id . ".<br />";
} elseif (isset($subids[$order->subscription_transaction_id])) {
//no sub id found, so let it go
//echo "No subid found for #" . $order->id . " " . $order->subscription_transaction_id . " in cache.<br />";
} else {
//need to look for a sub id in the database
$subid = $wpdb->get_var("SELECT subscription_transaction_id FROM {$wpdb->pmpro_membership_orders} WHERE membership_id = '" . $order->membership_id . "' AND user_id = '" . $order->user_id . "' AND subscription_transaction_id LIKE 'sub_%' LIMIT 1");
$subids[$order->subscription_transaction_id] = $subid;
if (!empty($subid)) {
$wpdb->query("UPDATE {$wpdb->pmpro_membership_orders} SET subscription_transaction_id = '" . esc_sql($subid) . "' WHERE id = '" . $order->id . "' LIMIT 1");
//echo "Updating subid for #" . $order->id . " " . $order->subscription_transaction_id . ".<br />";
} else {
//echo "No subid found for #" . $order->id . " " . $order->subscription_transaction_id . ".<br />";
}
}
}
}
}
pmpro_setOption("db_version", "1.869");
return 1.869;
}
示例4: pmpro_upgrade_1_2_3
function pmpro_upgrade_1_2_3()
{
global $wpdb;
$wpdb->hide_errors();
$wpdb->pmpro_membership_levels = $wpdb->prefix . 'pmpro_membership_levels';
$wpdb->pmpro_memberships_users = $wpdb->prefix . 'pmpro_memberships_users';
$wpdb->pmpro_memberships_categories = $wpdb->prefix . 'pmpro_memberships_categories';
$wpdb->pmpro_memberships_pages = $wpdb->prefix . 'pmpro_memberships_pages';
$wpdb->pmpro_membership_orders = $wpdb->prefix . 'pmpro_membership_orders';
$wpdb->pmpro_discount_codes = $wpdb->prefix . 'pmpro_discount_codes';
$wpdb->pmpro_discount_codes_levels = $wpdb->prefix . 'pmpro_discount_codes_levels';
$wpdb->pmpro_discount_codes_uses = $wpdb->prefix . 'pmpro_discount_codes_uses';
//expiration number and period for levels
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_membership_levels . "` ADD `expiration_number` INT UNSIGNED NOT NULL ,\r\nADD `expiration_period` ENUM( 'Day', 'Week', 'Month', 'Year' ) NOT NULL\r\n\t";
$wpdb->query($sqlQuery);
//expiration number and period for discount code levels
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_discount_codes_levels . "` ADD `expiration_number` INT UNSIGNED NOT NULL ,\r\nADD `expiration_period` ENUM( 'Day', 'Week', 'Month', 'Year' ) NOT NULL\r\n\t";
$wpdb->query($sqlQuery);
//end date for members
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_memberships_users . "` ADD `enddate` DATETIME NULL AFTER `startdate`\r\n\t";
$wpdb->query($sqlQuery);
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_memberships_users . "` ADD INDEX ( `enddate` )\r\n\t";
$wpdb->query($sqlQuery);
pmpro_setOption("db_version", "1.23");
return 1.23;
}
示例5: pmproet_save_template_data
function pmproet_save_template_data()
{
//update this template's settings
pmpro_setOption($_REQUEST['template'] . '_subject', stripslashes($_REQUEST['subject']));
pmpro_setOption($_REQUEST['template'] . '_body', stripslashes($_REQUEST['body']));
echo 'Template Saved';
exit;
}
示例6: pmpro_upgrade_1_1_15
function pmpro_upgrade_1_1_15()
{
/*
DB table setup
*/
global $wpdb;
$wpdb->hide_errors();
$wpdb->pmpro_membership_levels = $wpdb->prefix . 'pmpro_membership_levels';
$wpdb->pmpro_memberships_users = $wpdb->prefix . 'pmpro_memberships_users';
$wpdb->pmpro_memberships_categories = $wpdb->prefix . 'pmpro_memberships_categories';
$wpdb->pmpro_memberships_pages = $wpdb->prefix . 'pmpro_memberships_pages';
$wpdb->pmpro_membership_orders = $wpdb->prefix . 'pmpro_membership_orders';
$wpdb->pmpro_discount_codes = $wpdb->prefix . 'pmpro_discount_codes';
$wpdb->pmpro_discount_codes_levels = $wpdb->prefix . 'pmpro_discount_codes_levels';
$wpdb->pmpro_discount_codes_uses = $wpdb->prefix . 'pmpro_discount_codes_uses';
/*
Changing some id columns to unsigned.
*/
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_membership_levels . "` CHANGE `id` `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT\r\n\t";
$wpdb->query($sqlQuery);
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_memberships_categories . "` CHANGE `membership_id` `membership_id` INT( 11 ) UNSIGNED NOT NULL\r\n\t";
$wpdb->query($sqlQuery);
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_memberships_categories . "` CHANGE `category_id` `category_id` INT( 11 ) UNSIGNED NOT NULL\r\n\t";
$wpdb->query($sqlQuery);
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_memberships_pages . "` CHANGE `membership_id` `membership_id` INT( 11 ) UNSIGNED NOT NULL\r\n\t";
$wpdb->query($sqlQuery);
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_memberships_pages . "` CHANGE `page_id` `page_id` INT( 11 ) UNSIGNED NOT NULL\r\n\t";
$wpdb->query($sqlQuery);
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_memberships_users . "` CHANGE `user_id` `user_id` INT( 11 ) UNSIGNED NOT NULL\r\n\t";
$wpdb->query($sqlQuery);
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_memberships_users . "` CHANGE `membership_id` `membership_id` INT( 11 ) UNSIGNED NOT NULL\r\n\t";
$wpdb->query($sqlQuery);
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_membership_orders . "` CHANGE `id` `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT\r\n\t";
$wpdb->query($sqlQuery);
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_membership_orders . "` CHANGE `user_id` `user_id` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0'\r\n\t";
$wpdb->query($sqlQuery);
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_membership_orders . "` CHANGE `membership_id` `membership_id` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0'\r\n\t";
$wpdb->query($sqlQuery);
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_memberships_users . "` ADD `code_id` INT UNSIGNED NOT NULL AFTER `membership_id` ;\r\n\t";
$wpdb->query($sqlQuery);
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_memberships_users . "` ADD INDEX ( `code_id` )\r\n\t";
$wpdb->query($sqlQuery);
/*
New tables for discount codes
*/
//wp_pmpro_discount_codes
$sqlQuery = "\t\t\r\n\t\tCREATE TABLE `" . $wpdb->pmpro_discount_codes . "` (\r\n\t\t `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t `code` varchar(32) NOT NULL,\r\n\t\t `starts` date NOT NULL,\r\n\t\t `expires` date NOT NULL,\r\n\t\t `uses` int(11) NOT NULL,\r\n\t\t PRIMARY KEY (`id`),\r\n\t\t UNIQUE KEY `code` (`code`),\r\n\t\t KEY `starts` (`starts`),\r\n\t\t KEY `expires` (`expires`)\r\n\t\t);\r\n\t";
$wpdb->query($sqlQuery);
//wp_pmpro_discount_codes_levels
$sqlQuery = "\t\t\r\n\t\tCREATE TABLE `" . $wpdb->pmpro_discount_codes_levels . "` (\r\n\t\t `code_id` int(11) unsigned NOT NULL,\r\n\t\t `level_id` int(11) unsigned NOT NULL,\r\n\t\t `initial_payment` decimal(10,2) NOT NULL DEFAULT '0.00',\r\n\t\t `billing_amount` decimal(10,2) NOT NULL DEFAULT '0.00',\r\n\t\t `cycle_number` int(11) NOT NULL DEFAULT '0',\r\n\t\t `cycle_period` enum('Day','Week','Month','Year') DEFAULT 'Month',\r\n\t\t `billing_limit` int(11) NOT NULL COMMENT 'After how many cycles should billing stop?',\r\n\t\t `trial_amount` decimal(10,2) NOT NULL DEFAULT '0.00',\r\n\t\t `trial_limit` int(11) NOT NULL DEFAULT '0',\r\n\t\t PRIMARY KEY (`code_id`,`level_id`),\r\n\t\t KEY `initial_payment` (`initial_payment`)\r\n\t\t);\r\n\t";
$wpdb->query($sqlQuery);
//wp_pmpro_discount_codes_uses
$sqlQuery = "\t\t\r\n\t\tCREATE TABLE `" . $wpdb->pmpro_discount_codes_uses . "` (\r\n\t\t `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t `code_id` int(10) unsigned NOT NULL,\r\n\t\t `user_id` int(10) unsigned NOT NULL,\r\n\t\t `order_id` int(10) unsigned NOT NULL,\r\n\t\t `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\r\n\t\t PRIMARY KEY (`id`),\r\n\t\t KEY `user_id` (`user_id`),\r\n\t\t KEY `timestamp` (`timestamp`)\r\n\t\t);\r\n\t";
$wpdb->query($sqlQuery);
pmpro_setOption("db_version", "1.115");
//do the next update
return 1.115;
}
示例7: pmproet_save_template_data
function pmproet_save_template_data()
{
check_ajax_referer('pmproet', 'security');
//update this template's settings
pmpro_setOption('email_' . $_REQUEST['template'] . '_subject', stripslashes($_REQUEST['subject']));
pmpro_setOption('email_' . $_REQUEST['template'] . '_body', stripslashes($_REQUEST['body']));
echo 'Template Saved';
exit;
}
示例8: pmpro_upgrade_1_3_18
function pmpro_upgrade_1_3_18()
{
//setting new email settings defaults
pmpro_setOption("email_admin_checkout", "1");
pmpro_setOption("email_admin_changes", "1");
pmpro_setOption("email_admin_cancels", "1");
pmpro_setOption("email_admin_billing", "1");
pmpro_setOption("db_version", "1.318");
return 1.318;
}
示例9: pmpro_upgrade_1_6
function pmpro_upgrade_1_6()
{
global $wpdb;
$wpdb->hide_errors();
$wpdb->pmpro_membership_orders = $wpdb->prefix . 'pmpro_membership_orders';
//add notes column to orders
$sqlQuery = "ALTER TABLE `" . $wpdb->pmpro_membership_orders . "` ADD `notes` TEXT NOT NULL";
$wpdb->query($sqlQuery);
pmpro_setOption("db_version", "1.6");
return 1.6;
}
示例10: pmpro_upgrade_1_8_9_1
function pmpro_upgrade_1_8_9_1()
{
global $wpdb;
//Fixing Stripe orders where user_id/membership_id = 0. (Sets up update via AJAX)
$orders = $wpdb->get_col("SELECT id FROM {$wpdb->pmpro_membership_orders} WHERE gateway = 'stripe' AND user_id = 0 AND membership_id = 0 AND status <> 'error' ");
if (!empty($orders)) {
pmpro_addUpdate('pmpro_upgrade_1_8_9_1_ajax');
}
pmpro_setOption("db_version", "1.891");
return 1.891;
}
示例11: pmpro_upgrade_1_4
function pmpro_upgrade_1_4()
{
global $wpdb;
$wpdb->hide_errors();
$wpdb->pmpro_membership_levels = $wpdb->prefix . 'pmpro_membership_levels';
//confirmation message
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_membership_levels . "` ADD `confirmation` LONGTEXT NOT NULL AFTER `description`\r\n\t";
$wpdb->query($sqlQuery);
pmpro_setOption("db_version", "1.4");
return 1.4;
}
示例12: pmpro_upgrade_1_8_9_3
function pmpro_upgrade_1_8_9_3()
{
global $wpdb;
//Fixing incorrect start and end dates. (Sets up update via AJAX)
$user_ids = $wpdb->get_col("SELECT user_id FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND modified > '2016-05-19'");
if (!empty($user_ids)) {
pmpro_addUpdate('pmpro_upgrade_1_8_9_3_ajax');
}
pmpro_setOption("db_version", "1.91");
return 1.893;
}
示例13: pmpro_upgrade_1_5_9
function pmpro_upgrade_1_5_9()
{
global $wpdb;
$wpdb->hide_errors();
$wpdb->pmpro_membership_orders = $wpdb->prefix . 'pmpro_membership_orders';
//fix firstpayment statuses
$sqlQuery = "UPDATE " . $wpdb->pmpro_membership_orders . " SET status = 'success' WHERE status = 'firstpayment'";
$wpdb->query($sqlQuery);
pmpro_setOption("db_version", "1.59");
return 1.59;
}
示例14: pmpro_upgrade_1_4_8
function pmpro_upgrade_1_4_8()
{
/*
Adding a billing_country field to the orders table.
*/
global $wpdb;
$wpdb->hide_errors();
$wpdb->pmpro_membership_orders = $wpdb->prefix . 'pmpro_membership_orders';
//billing_country
$sqlQuery = "\r\n\t\tALTER TABLE `" . $wpdb->pmpro_membership_orders . "` ADD `billing_country` VARCHAR( 128 ) NOT NULL AFTER `billing_zip`\r\n\t";
$wpdb->query($sqlQuery);
pmpro_setOption("db_version", "1.48");
return 1.48;
}
示例15: pmpro_upgrade_1_4_2
function pmpro_upgrade_1_4_2()
{
/*
Setting the new use_ssl setting.
PayPal Website Payments Pro, Authorize.net, and Stripe will default to use ssl.
PayPal Express and the test gateway (no gateway) will default to not use ssl.
*/
$gateway = pmpro_getOption("gateway");
if ($gateway == "paypal" || $gateway == "authorizenet" || $gateway == "stripe") {
pmpro_setOption("use_ssl", 1);
} else {
pmpro_setOption("use_ssl", 0);
}
pmpro_setOption("db_version", "1.42");
return 1.42;
}