function column_account($item) { $account_title = isset(WPLE()->accounts[$item['account_id']]) ? WPLE()->accounts[$item['account_id']]->title : '<span style="color:darkred">Invalid Account ID: ' . $item['account_id'] . '</span>'; return sprintf('%1$s <br><span style="color:silver">%2$s</span>', $account_title, EbayController::getEbaySiteCode($item['site_id'])); }
protected function newAccount() { // call FetchToken $this->initEC(); $ebay_token = $this->EC->doFetchToken(false); $this->EC->closeEbay(); // check if we have a token if ($ebay_token) { // create new account $account = new WPLE_eBayAccount(); // $account->title = stripslashes( $_POST['wplister_account_title'] ); $account->title = 'My Account'; $account->site_id = $_REQUEST['site_id']; $account->site_code = EbayController::getEbaySiteCode($_REQUEST['site_id']); $account->sandbox_mode = $_REQUEST['sandbox']; $account->token = $ebay_token; $account->active = 1; $account->add(); // set enabled flag for site $site = WPLE_eBaySite::getSiteObj($account->site_id); $site->enabled = 1; $site->update(); // update user details $account->updateUserDetails(); // set default account automatically if (!get_option('wplister_default_account_id')) { update_option('wplister_default_account_id', $account->id); $this->makeDefaultAccount($account->id); } $this->check_wplister_setup('settings'); $this->showMessage(__('New account was added.', 'wplister') . ' ' . __('Please refresh account and site specific details now.', 'wplister')); } else { $this->showMessage("There was a problem fetching your token. Make sure you follow the instructions.", 1); } }