function process_purchase($id) { $user_id = wp_get_current_user()->ID; $currency = get_currency_available(); $item = get_item($id); $price = $item->price; if (intval($price) > intval($currency)) { return false; } else { $purchase_id = create_purchase($user_id); create_line_item($purchase_id, $id, $price); $cost = floatval($price) * -1; bonus_points_to_wallet($user_id, $cost); return true; } }
$final = $result->fetch_assoc(); return $final['available_currency']; } function get_currency_symbol() { $db = database_connection(); $result = $db->query("SELECT symbol FROM wp_points_info WHERE id = 1 LIMIT 1"); $final = $result->fetch_assoc(); return $final['symbol']; } $x = get_currency_available($user); if ($x < 0) { $currency_class = 'neg'; } $symbol = get_currency_symbol(); $currency = get_currency_available($user); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="./wallet.css"> </head> <body> <div id="wrapper"> <h1>Wallet</h1> <h2>Your current balance is:</h2> <img src="./wallet-icon.png" alt="wallet icon" /> <p class="<?php echo $currency_class; ?>