function ProjectTheme_dispute_myplugin_activate() { global $wpdb; $ss = " CREATE TABLE `" . $wpdb->prefix . "project_disputes` (\n\t\t\t`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n\t\t\t`initiator` INT,\n\t\t\t`pid` BIGINT ,\n\t\t\t`datemade` BIGINT ,\n\t\t\t`solution` TINYINT NOT NULL DEFAULT '0',\n\t\t\t`winner` TINYINT NOT NULL DEFAULT '0',\n\t\t\t`closedon` BIGINT,\n\t\t\t`comment` TEXT NOT NULL ,\n\t\t\t`defendant` INT,\n\t\t\t\n\t) ENGINE = MYISAM "; $wpdb->query($ss); //--------------------------- ProjectTheme_insert_pages('ProjectTheme_my_account_disputes_id', 'Disputes', '[project_theme_my_account_disputes]', get_option('ProjectTheme_my_account_page_id')); }
function ProjectTheme_affiliates_myplugin_activate() { global $wpdb; $ss = " CREATE TABLE `" . $wpdb->prefix . "project_affiliate_users` (\n\t\t\t`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n\t\t\t`owner_id` INT,\n\t\t\t`affiliate_id` INT ,\n\t\t\t`datemade` BIGINT \n\t\t\t\n\t) ENGINE = MYISAM "; $wpdb->query($ss); $ss = " CREATE TABLE `" . $wpdb->prefix . "project_affiliate_payouts` (\n\t\t\t`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n\t\t\t`pid` BIGINT,\n\t\t\t`uid` BIGINT ,\n\t\t\t`datemade` BIGINT,\n\t\t\t`paidon` BIGINT,\n\t\t\t`moneymade` VARCHAR( 255 ),\n\t\t\t`paid` TINYINT NOT NULL DEFAULT '0'\n\t\t\t \n\t\t\t\n\t) ENGINE = MYISAM "; $wpdb->query($ss); ProjectTheme_insert_pages('ProjectTheme_my_account_affiliates_id', 'Affiliates', '[project_theme_my_account_affiliates]', get_option('ProjectTheme_my_account_page_id')); }
function ProjectTheme_template_redirect_milestones() { $mlls = "PT_milestone_payments_installed_1_aaa"; $opt = get_option($mlls); if (isset($_POST['submits1no_me_thing_ok'])) { wp_redirect(get_permalink(get_option('ProjectTheme_my_account_milestones_id'))); exit; } if (isset($_POST['submits1yes_me_ok_p'])) { global $wpdb; $release_id = $_POST['release_id']; $s = "select * from " . $wpdb->prefix . "project_milestone where id='{$release_id}'"; $r = $wpdb->get_results($s); $row = $r[0]; global $current_user; get_currentuserinfo(); $post_me = get_post($row->pid); //------------------------- $cr = projectTheme_get_credits($current_user->ID); if ($row->released == 0 and $cr >= $row->amount) { $amount = $row->amount; $projectTheme_fee_after_paid = get_option('projectTheme_fee_after_paid'); if (!empty($projectTheme_fee_after_paid)) { $deducted = $amount * ($projectTheme_fee_after_paid * 0.01); } else { $deducted = 0; } $cr = projectTheme_get_credits($row->uid); projectTheme_update_credits($row->uid, $cr + $amount - $deducted); $reason = sprintf(__('Milestone payment received from <a href="%s">%s</a> for the project <a href="%s">%s</a>', 'ProjectTheme'), ProjectTheme_get_user_profile_link($current_user->ID), $current_user->user_login, get_permalink($post_me->ID), $post_me->post_title); projectTheme_add_history_log('1', $reason, $amount, $row->uid, $current_user->ID); $reason = sprintf(__('Payment fee taken for milestone payment for the project <a href="%s">%s</a>', 'ProjectTheme'), get_permalink($post_me->ID), $post_me->post_title); projectTheme_add_history_log('0', $reason, $deducted, $row->uid); $wpdb->query("update " . $wpdb->prefix . "project_milestone set released='1' where id='{$release_id}'"); //----------------------- $usr_dt = get_userdata($row->uid); $cr = projectTheme_get_credits($current_user->ID); //projectTheme_update_credits($row->uid, $cr - $amount); projectTheme_update_credits($current_user->ID, $cr - $amount); $reason = sprintf(__('Milestone payment sent to <a href="%s">%s</a> for the project <a href="%s">%s</a>', 'ProjectTheme'), ProjectTheme_get_user_profile_link($usr_dt->ID), $usr_dt->user_login, get_permalink($post_me->ID), $post_me->post_title); projectTheme_add_history_log('0', $reason, $amount, $current_user->ID, $row->uid); } //------------------------- wp_redirect(get_permalink(get_option('ProjectTheme_my_account_milestones_id')) . "?submit_ok_p=1"); exit; } //--------------------------------- if (empty($opt)) { ProjectTheme_insert_pages('ProjectTheme_my_account_milestones_id', 'Milestone Payments', '[project_theme_my_account_milestones]', get_option('ProjectTheme_my_account_payments_id')); update_option($mlls, 'DONE'); global $wpdb; $ss = "CREATE TABLE `" . $wpdb->prefix . "project_milestone` (\n\t\t\t\t\t`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n\t\t\t\t\t`owner` INT NOT NULL ,\n\t\t\t\t\t`pid` INT NOT NULL ,\n\t\t\t\t\t`uid` INT NOT NULL ,\n\t\t\t\t\t`description_content` TEXT NOT NULL ,\n\t\t\t\t\t`datemade` BIGINT NOT NULL DEFAULT '0',\n\t\t\t\t\t`completion_date` BIGINT NOT NULL DEFAULT '0' ,\n\t\t\t\t\t`date_released` BIGINT NOT NULL DEFAULT '0' ,\n\t\t\t\t\t`amount` VARCHAR( 255 ) NOT NULL \n\t\t\t\t\t \n\t\t\t\t\t) ENGINE = MYISAM ;\n\t\t\t\t\t"; $wpdb->query($ss); $ss = "ALTER TABLE `" . $wpdb->prefix . "project_milestone` ADD `released` TINYINT NOT NULL DEFAULT '0';"; $wpdb->query($ss); } }
//--------------------------------------------------------- $opt = get_option('ProjectTheme_upd138_bass4aa'); if (empty($opt) or isset($_GET['sitemile_reset_theme'])) { $wp_user_query = new WP_User_Query(array('number' => 99999999)); $authors = $wp_user_query->get_results(); if (0) { foreach ($authors as $usr) { $user_tp = get_user_meta($usr->ID, 'user_tp', true); if ($usr->user_level != 10 and $usr->user_login != 'admin') { if ($user_tp == 'service_provider') { $usera = new WP_User($usr->ID); $usera->set_role('service_provider'); } if ($user_tp == 'business_owner') { $usera = new WP_User($usr->ID); $usera->set_role('business_owner'); } } } } global $wpdb; update_option('ProjectTheme_upd138_bass4aa', 'y'); $ss = "ALTER TABLE `" . $wpdb->prefix . "project_pm` ADD `approved` TINYINT NOT NULL DEFAULT '1';"; $wpdb->query($ss); $ss = "ALTER TABLE `" . $wpdb->prefix . "project_pm` ADD `approved_on` BIGINT NOT NULL DEFAULT '0';"; $wpdb->query($ss); $ss = "ALTER TABLE `" . $wpdb->prefix . "project_custom_fields` ADD `is_mandatory` TINYINT NOT NULL DEFAULT '0';"; $wpdb->query($ss); //----------------------------------------------- ProjectTheme_insert_pages('ProjectTheme_all_projects_page_id', 'All Posted Projects', '[project_theme_all_projects]'); }