本文整理汇总了PHP中get_user_field函数的典型用法代码示例。如果您正苦于以下问题:PHP get_user_field函数的具体用法?PHP get_user_field怎么用?PHP get_user_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_user_field函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_admin_link
function get_admin_link($page, $caption, $access)
{
if (get_user_field(USER_ID, 'admin', $access)) {
echo "<a href='admin.php?page={$page}'>{$caption}</a>";
} else {
echo "{$caption} <img src='res/locked.png' alt='Locked' title='Locked' width='14' height='14' />";
}
}
示例2: dt_payment_save_settings
function dt_payment_save_settings($current)
{
if (!empty($_POST) && check_admin_referer('dt_payment_settings', '_wpnonce')) {
$payment_settings = array();
$payment_settings = get_option('dt_settings');
unset($_POST['_wpnonce']);
unset($_POST['_wp_http_referer']);
unset($_POST['dt_save']);
switch ($current) {
case 'dt_set_commission':
$payment_settings['set-commission']['commission'][$_POST['dt-setcom-teacher']] = $_POST;
break;
case 'dt_pay_commission':
$teacher_info = get_userdata($_POST['dt-paycom-teacher']);
$teacher_name = $teacher_info->display_name;
$title = __('Commissions / ' . $teacher_name . ' / ' . date('Y-m-d'), 'dt_themes');
$items_all = dt_decode_array($_POST['item_data_all']);
$selected_items = isset($_POST['item']) ? $_POST['item'] : '';
$new_items = array();
if ($selected_items != '') {
$j = 0;
foreach ($items_all as $key => $item) {
if (isset($selected_items[$j]) && $selected_items[$j] == 'true') {
$students = array_merge(get_users(array('role' => 's2member_level1')), get_users(array('role' => 's2member_level2')), get_users(array('role' => 's2member_level3')), get_users(array('role' => 's2member_level4')));
foreach ($students as $student) {
$new_ccaps = '';
$student_level = get_user_field("s2member_access_role", $student->data->ID);
if ($student_level == 's2member_level2' || $student_level == 's2member_level3' || $student_level == 's2member_level4') {
$all_ccaps = dt_get_all_paid_courses();
} else {
$student_cap = get_user_field("s2member_access_ccaps", $student->data->ID);
$all_ccaps = dt_remove_cid($student_cap);
}
if (in_array($item['course_id'], $all_ccaps)) {
$prev_ccaps = get_user_meta($student->data->ID, 'commission_ccaps', true);
$prev_ccaps = isset($prev_ccaps) ? $prev_ccaps : '';
if ($prev_ccaps != '') {
$new_ccaps = $prev_ccaps . ',' . $item['course_id'];
} else {
$new_ccaps = $item['course_id'];
}
update_user_meta($student->data->ID, 'commission_ccaps', $new_ccaps);
}
}
$new_items[] = $item;
}
$j++;
}
$payment_post = array('post_title' => $title, 'post_status' => 'publish', 'post_type' => 'dt_payments');
$payment_post_id = wp_insert_post($payment_post);
update_post_meta($payment_post_id, 'payment-data', $new_items);
}
break;
}
update_option('dt_settings', $payment_settings);
}
}
示例3: delete_old_avatar
function delete_old_avatar($CI, $new_avatar)
{
$old_avatar = get_user_field('avatar');
if (isset($old_avatar) && !empty($old_avatar) && isset($new_avatar) && !empty($new_avatar)) {
if ($old_avatar != $new_avatar) {
delete_avatar($CI, $old_avatar);
}
}
}
示例4: merge_filter
function merge_filter($merge, $vars)
{
// $merge /* Array of existing MERGE fields that s2Member passes by default. */
// $vars /* Array of defined variables in the scope/context of this Filter. */
// process date of birth field
$my_dob_merge_vars = array();
$user_id = $vars["user_id"];
$dob = get_user_field("dob", $user_id);
if ("" != $dob) {
$dob = date_parse_from_format('j/n/Y', $dob);
if ($dob[warning_count] == 0) {
$birthday = $dob['month'] . '/' . $dob['day'];
$dob = date('d M Y', mktime(0, 0, 0, $dob['month'], $dob['day'], $dob['year']));
$my_dob_merge_vars = array("DOB" => $dob, "BIRTHDAY" => $birthday);
}
}
// lookup postcode related data
$postcode = get_user_field("postcode", $user_id);
$my_postcode_merge_vars = get_postcode_data($postcode, false);
// guess gender from first name
$strictness = 9;
// Set this to 1 or 2 for more restrictive matching
$firstname = $vars['fname'];
$result = gender($firstname, $strictness);
if (isset($result)) {
$gender = $result['gender'];
if ($gender === 'f') {
$my_gender_merge_vars = array("GENDER" => 'Female');
} else {
$my_gender_merge_vars = array("GENDER" => 'Male');
}
} else {
$my_gender_merge_vars = array("GENDER" => 'Unknown');
}
return array_merge_recursive($merge, $my_dob_merge_vars, $my_postcode_merge_vars, $my_gender_merge_vars);
}
示例5: dt_sc_subscribed_courses
function dt_sc_subscribed_courses($atts, $content = null)
{
extract(shortcode_atts(array('hide_visit_count' => ''), $atts));
$out = '';
if (dttheme_is_plugin_active('s2member/s2member.php')) {
$user_ccaps = get_user_field("s2member_access_ccaps");
$login_count = get_user_field("s2member_login_counter");
$display_name = get_user_field("display_name");
if ($hide_visit_count != 'true') {
$count_suffix = '';
if ($login_count == 1) {
$count_suffix = '<sup>st</sup>';
} elseif ($login_count == 2) {
$count_suffix = '<sup>nd</sup>';
} elseif ($login_count == 3) {
$count_suffix = '<sup>rd</sup>';
} elseif ($login_count >= 4) {
$count_suffix = '<sup>th</sup>';
}
$out .= '<h2 class="border-title">' . __('Hi ' . $display_name . ', this is your ' . $login_count . $count_suffix . ' visit', 'dt_themes') . '<span> </span></h2>';
}
if (isset($user_ccaps) && !empty($user_ccaps)) {
$out .= '<h3>' . __('Courses you have subscribed so far,', 'dt_themes') . '</h3>';
$out .= '<div class="clear"> </div> <ol class="dt-sc-lessons-list dt-sc-user-subscribed-courses">';
foreach ($user_ccaps as $ccap) {
$ccap = (int) str_replace('cid_', '', $ccap);
$out .= '<li><h6><a href="' . get_permalink($ccap) . '">' . get_the_title($ccap) . '</a></h6></li>';
}
$out .= '</ol>';
}
}
return $out;
}
示例6: get_user_stuff
function get_user_stuff($user, $info = "nickname", $stuff = array())
{
if ($info == "avatar" and filter_var($user, FILTER_VALIDATE_EMAIL)) {
include_once abspath . "/includes/get_avatar.php";
$output = get_avatar($user);
} else {
$field = get_user_field($user);
// Create connection
$conn = new mysqli(servername, dbuser, dbpass, dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT " . $info . " FROM " . prefix . "_users WHERE " . $field . "='" . $user . "';";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while ($row = $result->fetch_assoc()) {
$output = $row[$info];
}
}
$conn->close();
}
return $output;
}
示例7: the_ID
?>
-->
<div id="post-<?php
the_ID();
?>
" <?php
post_class();
?>
>
<?php
the_content();
edit_post_link(__(' Edit ', 'dt_themes'));
$dt_type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'home';
$user_role = IAMD_USER_ROLE;
if ($user_role == 's2member_level2' || $user_role == 's2member_level3' || $user_role == 's2member_level4') {
$s2member_access_label = get_user_field("s2member_access_label");
$s2member_auto_eot_time = get_user_option("s2member_auto_eot_time");
$time_format = get_option('date_format');
$exp_date = date('F j, Y H:i A', $s2member_auto_eot_time);
echo '<p class="dt-sc-info-box">' . __('You have subscribed for our ', 'dt_themes') . $s2member_access_label . '. ' . __('Your subcription will expire on ', 'dt_themes') . $exp_date . '</p>';
echo '<div class="dt-sc-hr-invisible-small"></div>';
}
?>
<div class="column dt-sc-one-fifth first">
<div class="dt-sc-user-details">
<?php
$user_id = get_current_user_id();
$user_info = get_userdata($user_id);
echo get_avatar($user_id, 180);
echo '<div class="dt-sc-username">' . $user_info->display_name . '</div>';
示例8: get_user_field
<?php
$agentData = get_user_field('user_type', $theUserID);
if ($agentData === "Agent") {
wp_redirect(site_url("agent-login"));
exit;
}
get_header('slide');
?>
<div class="col-xs-12 homeslide clear-pad">
<div id="gallery" class="royalSlider rsDefault bannerslider">
<?php
if (have_rows('slideshow')) {
?>
<?php
while (have_rows('slideshow')) {
the_row();
?>
<!-- the_sub_field-->
<div class="rsContent">
<?php
$homepageImage = get_sub_field('slide_image');
?>
<?php
$homepageImageThumb = get_sub_field('slide_thumbnail');
?>
<div class="gradientoverlay">
<div class="slidecontent container">
示例9: dt_get_course_capabilities_id
function dt_get_course_capabilities_id($course_id)
{
$course_id = 'cid_' . $course_id;
$students_list = $students_cap = $new_ccaps = $all_ccaps = array();
$students = get_users(array('role' => 's2member_level1'));
foreach ($students as $student) {
$students_cap = get_user_field("s2member_access_ccaps", $student->data->ID);
if (in_array($course_id, $students_cap)) {
$students_list[] = $student->data->ID;
}
}
$s2members = array('s2member_level2', 's2member_level3', 's2member_level4');
foreach ($s2members as $s2member) {
$s2users = get_users(array('role' => $s2member));
foreach ($s2users as $s2user) {
$students_list[] = $s2user->data->ID;
}
}
return $students_list;
}
示例10: dt_get_statistics_graph_data
function dt_get_statistics_graph_data($graph_type = 'course', $include_zero_sales = 0, $selectedItems = '')
{
$graph_title = $graph_data = $graph_data2 = '';
if ($graph_type == 'course') {
if (isset($selectedItems) && !empty($selectedItems)) {
$course_args = array('include' => $selectedItems, 'posts_per_page' => -1, 'post_type' => 'dt_courses', 'orderby' => 'title', 'order' => 'ASC');
} else {
$course_args = array('posts_per_page' => -1, 'post_type' => 'dt_courses', 'orderby' => 'title', 'order' => 'ASC');
}
$courses = get_posts($course_args);
if (isset($courses) && !empty($courses)) {
$course_title = $courses_subscribed = array();
foreach ($courses as $course) {
$course_id = $course->ID;
$student_cap = dt_get_course_capabilities_id($course_id);
$subscription = count($student_cap);
if ($include_zero_sales == 1 || $subscription > 0) {
$courses_subscribed[] = $subscription;
$course_title[] = '"' . $course->post_title . '"';
}
}
$graph_title = implode(',', $course_title);
$graph_data = implode(',', $courses_subscribed);
echo '<h3>' . __('Courses Vs Subscriptions (sales)', 'dt_themes') . '</h3>';
echo '<div class="dt-graph-marker">';
echo '<div class="dt-graph-marker-box"> <div style="background-color:rgba(14,81,124,1); width:20px; height:20px;"></div></div> - ' . __('Total Subscribtions (Sales)', 'dt_themes');
echo '</div>';
}
} else {
if ($graph_type == 'teacher') {
if (isset($selectedItems) && !empty($selectedItems)) {
$teachers = get_users(array('include' => $selectedItems, 'role' => 'teacher'));
} else {
$teachers = get_users(array('role' => 'teacher'));
}
if (isset($teachers) && !empty($teachers)) {
$teacher_names = $total_courses = $total_subscription = array();
foreach ($teachers as $teacher) {
$teacher_id = $teacher->data->ID;
$teacher_name = $teacher->data->display_name;
$courses_args = array('post_type' => 'dt_courses', 'post_status' => 'publish', 'author' => $teacher_id);
$courses = get_posts($courses_args);
$total_course = count($courses);
if ($include_zero_sales == 1 || $total_course > 0) {
$teacher_names[] = '"' . $teacher_name . '"';
$total_courses[] = $total_course;
$total_course_subscribed = 0;
if (isset($courses) && !empty($courses)) {
foreach ($courses as $course) {
$course_id = $course->ID;
$student_cap = dt_get_course_capabilities_id($course_id);
$course_subscribed = count($student_cap);
$total_course_subscribed = $total_course_subscribed + $course_subscribed;
}
}
$total_subscription[] = $total_course_subscribed;
}
}
$graph_title = implode(',', $teacher_names);
$graph_data = implode(',', $total_courses);
$graph_data2 = implode(',', $total_subscription);
echo '<h3>' . __('Teachers Vs Courses Submitted and Courses Total Subscriptions', 'dt_themes') . '</h3>';
echo '<div class="dt-graph-marker">';
echo '<div class="dt-graph-marker-box"> <div style="background-color:rgba(14,81,124,1); width:20px; height:20px;"></div></div> - ' . __('Total Courses Submitted', 'dt_themes');
echo '</div>';
echo '<div class="dt-graph-marker">';
echo '<div class="dt-graph-marker-box"> <div style="background-color:rgba(51,167,227,1); width:20px; height:20px;"></div></div> - ' . __('Total Subscribtions (Sales)', 'dt_themes');
echo '</div>';
}
} else {
if ($graph_type == 'student') {
if (isset($selectedItems) && !empty($selectedItems)) {
$students = array_merge(get_users(array('include' => $selectedItems, 'role' => 's2member_level1')), get_users(array('include' => $selectedItems, 'role' => 's2member_level2')), get_users(array('include' => $selectedItems, 'role' => 's2member_level3')), get_users(array('include' => $selectedItems, 'role' => 's2member_level4')));
} else {
$students = array_merge(get_users(array('role' => 's2member_level1')), get_users(array('role' => 's2member_level2')), get_users(array('role' => 's2member_level3')), get_users(array('role' => 's2member_level4')));
}
if (isset($students) && !empty($students)) {
$student_names = $total_courses = $courses_completed = array();
foreach ($students as $student) {
$student_id = $student->data->ID;
$student_name = $student->data->display_name;
$student_level = get_user_field("s2member_access_role", $student_id);
if ($student_level == 's2member_level2' || $student_level == 's2member_level3' || $student_level == 's2member_level4') {
$student_cap = dt_get_all_paid_courses();
} else {
$student_cap = get_user_field("s2member_access_ccaps", $student_id);
}
$total_course = count($student_cap);
$course_completed = dt_get_user_completed_course_count($student_id);
if ($include_zero_sales == 1 || $total_course > 0) {
$student_names[] = '"' . $student_name . '"';
$total_courses[] = $total_course;
$courses_completed[] = $course_completed;
}
}
$graph_title = implode(',', $student_names);
$graph_data = implode(',', $total_courses);
$graph_data2 = implode(',', $courses_completed);
echo '<h3>' . __('Students Vs Courses Subscribed and Courses Completed', 'dt_themes') . '</h3>';
echo '<div class="dt-graph-marker">';
//.........这里部分代码省略.........
示例11: header
* ---------------------------------------------------------------------------
*
* Merchant Empires by [Redacted] Games LLC - A space merchant game of war
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
include_once 'tmpl/common.php';
if (!get_user_field(USER_ID, 'admin', 'research')) {
header('Location: viewport.php?rc=1030');
die;
}
include_once 'inc/research.php';
?>
<div class="header2">Base Research Administration</div>
<div class="docs_text">
You can manipulate base research using this page.
</div>
<hr />
示例12: handle_updateUserCourseAccess
/**
* Function just for handling the membership callback, to interpret the parameters
* for the class to take over.
*
* @param Integer $id The ID if the user being changed.
*/
public function handle_updateUserCourseAccess($id)
{
$s2member_access_level = 's2member_level' . get_user_field("s2member_access_level", $id);
// Over to the parent class to handle the sync of data.
parent::handle_courseSync($id, array($s2member_access_level));
}
示例13: eotnot_send_emails
public function eotnot_send_emails()
{
$users = get_users();
$time = time();
foreach ($users as $user) {
if (($eot = get_user_field('s2member_auto_eot_time', $user->ID)) || ($eot = get_user_meta($user->ID, 'eotnot_last_expired_at', true))) {
$lastEmailSent = get_user_meta($user->ID, 'eotnot_last_sent', true);
if (!$lastEmailSent) {
$lastEmailSent = 0;
}
$options = get_option('eotnot_options');
foreach ($options['eotnot_reminder'] as $notification) {
$sendAt = strtotime($notification['eotnot_reminder_trigger_period'] . ' ' . $notification['eotnot_reminder_trigger_number'] . ' ' . $notification['eotnot_reminder_trigger_units'], $eot);
if ($sendAt < $lastEmailSent || $sendAt > $time) {
continue;
}
$sent = $this->eotnot_send_email($notification['eotnot_reminder_subject'], $notification['eotnot_reminder_content'], $user->ID);
if ($sent) {
update_user_meta($user->ID, 'eotnot_last_sent', $time);
}
}
}
}
}
开发者ID:ethanclevenger91,项目名称:s2member-end-of-term-notifications,代码行数:24,代码来源:s2member-end-of-term-notifications.php
示例14: print_assign_to_option_list
function print_assign_to_option_list($p_id = "")
{
global $g_mantis_user_table, $g_mantis_project_table, $g_mantis_project_user_list_table, $g_project_cookie_val;
$t_adm = ADMINISTRATOR;
$t_dev = DEVELOPER;
$t_pub = PUBLICPROJ;
$t_prv = PRIVATEPROJ;
$user_arr = array();
# checking if it's per project or all projects
# 0 is all projects
if ('0000000' == $g_project_cookie_val) {
$query = "SELECT DISTINCT u.id, u.username, u.email\n\t\t\t\t\tFROM \t{$g_mantis_user_table} u,\n\t\t\t\t\t\t\t{$g_mantis_project_user_list_table} l,\n\t\t\t\t\t\t\t{$g_mantis_project_table} p\n\t\t\t\t\tWHERE\t(p.view_state='{$t_pub}' AND\n\t\t\t\t\t\t\tu.access_level>='{$t_dev}') OR\n\t\t\t\t\t\t\t(l.access_level>='{$t_dev}' AND\n\t\t\t\t\t\t\tl.user_id=u.id) OR\n\t\t\t\t\t\t\tu.access_level>='{$t_adm}'\n\t\t\t\t\tORDER BY u.username";
$result = db_query($query);
$user_count = db_num_rows($result);
for ($i = 0; $i < $user_count; $i++) {
$row = db_fetch_array($result);
extract($row, EXTR_PREFIX_ALL, "v");
$user_arr[$v_username] = array($v_username, $v_id);
}
} else {
$temp_arr = array();
# grab the administrators
$query = "SELECT id, username\n\t\t\t\t\tFROM {$g_mantis_user_table}\n\t\t\t\t\tORDER BY username";
$result = db_query($query);
$user_count = db_num_rows($result);
for ($i = 0; $i < $user_count; $i++) {
$row = db_fetch_array($result);
extract($row, EXTR_PREFIX_ALL, "v");
$temp_arr[$v_username] = array($v_username, $v_id);
}
foreach ($temp_arr as $key => $val) {
$v_id = $val[1];
$v_username = $val[0];
# always add all administrators
$t_access_level = get_user_field($v_id, "access_level");
if (ADMINISTRATOR == $t_access_level) {
$user_arr[$v_username] = array($v_username, $v_id);
continue;
}
# see if users belong
$t_project_view_state = get_project_field($g_project_cookie_val, "view_state");
if (PUBLICPROJ == $t_project_view_state) {
$query = "SELECT l.access_level\n\t\t\t\t\t\t\tFROM\t{$g_mantis_project_user_list_table} l,\n\t\t\t\t\t\t\t\t\t{$g_mantis_project_table} p\n\t\t\t\t\t\t\tWHERE\tl.project_id='{$g_project_cookie_val}' AND\n\t\t\t\t\t\t\t\t\tp.id=l.project_id AND\n\t\t\t\t\t\t\t\t\tl.user_id='{$v_id}'";
$result = db_query($query);
$count = db_num_rows($result);
if ($count > 0) {
$t_access_level = db_result($result);
}
if ($t_access_level >= DEVELOPER) {
$user_arr[$v_username] = array($v_username, $v_id);
}
} else {
$query = "SELECT COUNT(*)\n\t\t\t\t\t\t\tFROM\t{$g_mantis_project_user_list_table} l,\n\t\t\t\t\t\t\t\t\t{$g_mantis_project_table} p\n\t\t\t\t\t\t\tWHERE\tl.project_id='{$g_project_cookie_val}' AND\n\t\t\t\t\t\t\t\t\tp.id=l.project_id AND\n\t\t\t\t\t\t\t\t\tl.user_id='{$v_id}' AND\n\t\t\t\t\t\t\t\t\tl.access_level>='{$t_dev}'";
$result = db_query($query);
$count = db_result($result, 0, 0);
if ($count > 0) {
$user_arr[$v_username] = array($v_username, $v_id);
continue;
}
}
}
}
asort($user_arr);
foreach ($user_arr as $key => $val) {
$v_id = $val[1];
$v_username = $val[0];
if ($v_id == $p_user_id) {
print "<option value=\"{$v_id}\" SELECTED>{$v_username}</option>";
} else {
print "<option value=\"{$v_id}\">{$v_username}</option>";
}
}
# end foreach
}
示例15: header
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
include_once 'inc/common.php';
if (!get_user_field(USER_ID, 'admin', 'users')) {
header('Location: viewport.php?rc=1030');
die;
}
do {
// Dummy Loop
if (!isset($_REQUEST['user']) || !validate_username($_REQUEST['user'])) {
break;
}
$db_user = isset($db_user) ? $db_user : new DB(true);
$rs = $db_user->get_db()->query("select record_id, username, session_time from users where lower(username) = lower('" . $_REQUEST['user'] . "')");
$rs->data_seek(0);
if ($row = $rs->fetch_assoc()) {
$spacegame['user_info'] = $row;
} else {
break;
}
$spacegame['user_info']['players'] = array();
$spacegame['user_info']['player_count'] = 0;
$db = isset($db) ? $db : new DB();
$rs = $db->get_db()->query("select players.caption, user_players.session_time from players, user_players where user_players.player = players.record_id and user_players.user = '" . $spacegame['user_info']['record_id'] . "'");
$rs->data_seek(0);
while ($row = $rs->fetch_assoc()) {
$spacegame['user_info']['players'][] = $row;
$spacegame['user_info']['player_count']++;
}
$spacegame['user_info']['fields'] = get_user_field($spacegame['user_info']['record_id']);
} while (false);