本文整理汇总了PHP中UserPeer::loadUserById方法的典型用法代码示例。如果您正苦于以下问题:PHP UserPeer::loadUserById方法的具体用法?PHP UserPeer::loadUserById怎么用?PHP UserPeer::loadUserById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserPeer
的用法示例。
在下文中一共展示了UserPeer::loadUserById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: t
<?php
require_once '_header.inc.php';
// load all file servers
$sQL = "SELECT id, serverLabel FROM file_server ORDER BY serverLabel";
$serverDetails = $db->getRows($sQL);
// load all users
$sQL = "SELECT id, username AS selectValue FROM users ORDER BY username";
$userDetails = $db->getRows($sQL);
// do we need to filter by user
$userFilter = false;
if (isset($_REQUEST['user'])) {
$userFilter = (int) $_REQUEST['user'];
// load user details
$userObj = UserPeer::loadUserById($userFilter);
}
?>
<div>
<div style="float:left; padding-right:10px;">
<?php
echo t("files_filter_results", "Filter Results:");
?>
</div>
<div style="float:left; padding-right:20px;">
<input id="files_search" name="files_search" class="fileSearch" value="" type="text" onKeyUp="mfScripts.filesTable.updateFilteredResults();"/>
</div>
<div style="float:left; padding-right:10px;">
<?php
echo t("files_filter_user", "By User");
示例2: DBObject
// make sure the order is pending
if ($order->order_status == 'completed') {
// order has already been completed
die;
}
// update order status to paid
$dbUpdate = new DBObject("premium_order", array("order_status"), 'id');
$dbUpdate->order_status = 'completed';
$dbUpdate->id = $order->id;
$effectedRows = $dbUpdate->update();
if ($effectedRows === false) {
// failed to update order
die;
}
// extend/upgrade user
$user = UserPeer::loadUserById($userId);
$newExpiryDate = strtotime('+' . $order->days . ' days');
if ($user->level == 'paid user' || $user->level == 'admin') {
// add onto existing period
$existingExpiryDate = strtotime($user->paidExpiryDate);
// if less than today just revert to now
if ($existingExpiryDate < time()) {
$existingExpiryDate = time();
}
$newExpiryDate = (int) $existingExpiryDate + (int) ($order->days * (60 * 60 * 24));
}
$newUserType = 'paid user';
if ($user->level == 'admin') {
$newUserType = 'admin';
}
// update order status to paid
示例3: redirect
<?php
/* setup includes */
require_once 'includes/master.inc.php';
/* require login */
$Auth->requireUser('login.php');
/* load user */
$user = UserPeer::loadUserById($Auth->id);
if (!$user) {
redirect(WEB_ROOT);
}
/* setup page */
define("PAGE_NAME", t("account_edit_page_name", "Account Details"));
define("PAGE_DESCRIPTION", t("account_edit_meta_description", "Account details"));
define("PAGE_KEYWORDS", t("account_edit_meta_keywords", "details, account, short, url, user"));
/* update user */
if ((int) $_REQUEST['submitme']) {
// validation
$title = trim($_REQUEST['title']);
$firstname = trim($_REQUEST['firstname']);
$lastname = trim($_REQUEST['lastname']);
$emailAddress = trim(strtolower($_REQUEST['emailAddress']));
$password = trim($_REQUEST['password']);
if (!strlen($title)) {
setError(t("please_enter_your_title", "Please enter your title"));
} elseif (!strlen($firstname)) {
setError(t("please_enter_your_firstname", "Please enter your firstname"));
} elseif (!strlen($lastname)) {
setError(t("please_enter_your_lastname", "Please enter your lastname"));
} elseif (!strlen($emailAddress)) {
setError(t("please_enter_your_email_address", "Please enter your email address"));