function custom_export_download_file_form_submit($form, &$form_state) { $sql = "select users.uid as uid,users.name as name ,users.pass as pass ,users.mail as mail,\n retailer.EANCode as eancode, userpoints_total.points as points, retaileruser.Phone as phone from users inner join retaileruser on retaileruser.ID = users.uid inner join retailer on retaileruser.RetailerID = retailer.id\n left join userpoints_total on userpoints_total.uid = users.uid where users.language = :language"; $res = db_query($sql, array(':language' => $form_state['values']['language'])); $file_name = "{$form_state['values']['language']}_custom_users.csv"; header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header('Content-Description: File Transfer'); header("Content-type: text/csv; charset=utf-8"); header("Content-Disposition: attachment; filename={$file_name}"); header("Expires: 0"); header("Pragma: public"); $fh = @fopen('php://output', 'w'); //write the header row. fputcsv($fh, array('name', 'password', 'email', 'phone', 'eancode', 'points', 'cash', 'lottery')); while ($row = $res->fetchObject()) { $points = userpoints_get_current_points($row->uid); $cash = custom_cash_get_cash('cash', $row->uid); $lottery = custom_cash_get_cash("lottery", $row->uid); //write row. fputcsv($fh, array($row->name, $row->pass, $row->mail, $row->phone, $row->eancode, $points, $cash, $lottery)); } // Close the file fclose($fh); // Make sure nothing else is sent, our file is done exit; }
/** * Node preprocessing */ function commons_roots_preprocess_node(&$vars) { // Only build custom submitted information if it was first available // If it's not, that indicates that it's been turned off for this // node type if ($vars['submitted']) { // Load the node author $author = user_load($vars['node']->uid); // Author picture if (theme_get_setting('toggle_node_user_picture')) { $picture = $vars['picture']; unset($vars['picture']); $submitted = $author->uid && user_access('access user profiles') ? l($picture, "user/{$author->uid}", array('html' => TRUE)) : $picture; } // Author information $submitted .= '<span class="submitted-by">'; $submitted .= t('Submitted by !name', array('!name' => theme('username', $author))); $submitted .= '</span>'; $vars['submitted_name'] = theme('username', $author); // User points if ($author->uid && module_exists('userpoints')) { $points = userpoints_get_current_points($author->uid); $submitted .= '<span class="userpoints-value" title="' . t('!val user points', array('!val' => $points)) . '">'; $submitted .= "({$points})"; $submitted .= '</span>'; } // User badges if ($author->uid && module_exists('user_badges')) { if (is_array($author->badges)) { foreach ($author->badges as $badge) { $badges[] = theme('user_badge', $badge, $author); } } if (!empty($badges)) { $submitted .= theme('user_badge_group', $badges); } } // Created time $submitted .= '<span class="submitted-on">'; $submitted .= format_date($vars['node']->created); $submitted .= '</span>'; $vars['submitted'] = $submitted; } }
function yui_grid_node_submitted($node) { $user = user_load(array("uid" => $node->uid)); $vars = array("account" => $user); gravatar_preprocess_user_picture($vars); $html = <<<HTML <div class="usercard clearfix"> <div class="submitted margin_bottom_1em">@datetime</div> <div class="left"> !picture </div> <div class="right"> <div class="name">!username</div> <div> <!-- <span class="role">Journalist</span> not sure how to do this part yet --> <span class="points">!points</span> </div> </div> </div> HTML; return t($html, array('!username' => theme('username', $node), '!picture' => $vars["picture"], '!points' => userpoints_get_current_points($node->uid), '@datetime' => ago($node->created))); }
if (isset($account->badges)) { ?> <?php foreach ($account->badges as $badge) { $badges[] = theme('user_badge', $badge, $account); } if (!empty($badges)) { print theme('user_badge_group', $badges); } ?> <?php } ?> <span class="user-points"> <?php print isset($account) ? userpoints_get_current_points($account->uid) . ' ' . t('points') : ''; ?> </span> </div> <div class="user-job"><?php print isset($account) ? $account->profile_job : ''; ?> </div> <?php if (FALSE && isset($account) && user_has_role(ROL_CONTEST_JURY, $account)) { ?> <div class="jury-member"> <?php print t('Jury of Arquideas'); ?> </div>
function _bluemod_estrellas() { global $user; $uid = arg(0) == 'user' && is_numeric(arg(1)) ? arg(1) : $user->uid; $topepuntaje = variable_get('topepuntaje', '10000'); $puntaje = userpoints_get_current_points($uid, 'all'); $salida = ""; if ($puntaje > 0) { $porc_cumplido = ceil($puntaje * 100 / $topepuntaje); $cant_estrellas = $porc_cumplido < 10 ? 1 : ceil($porc_cumplido / 10); $salida .= "<div class='estrellas-" . $cant_estrellas . "'></div>"; } return $salida; }
print t('Send by !name', array('!name' => l($realname, 'user/' . $node->uid))); ?> </div> <div class="userpoints"> <?php $user_badges = user_badges_get_badges($node->uid); if (count($user_badges) > 0) { foreach ($user_badges as $key => $badge) { print theme('user_badge', $badge, $account); break; } } ?> <?php print t('!points points', array('!points' => userpoints_get_current_points($node->uid))); ?> </div> </div> <?php } ?> <div class="date"> <?php print $field_date_news_rendered; ?> </div> <?php if ($terms) {