function wpbilbao_template_miembros_do_loop() { $miembros = get_users('orderby=nicename&role=miembro'); echo '<div class="lista-miembros row">'; foreach ($miembros as $miembro) { $miembro_id = $miembro->ID; $miembro_imagen = get_cimyFieldValue($miembro_id, 'IMAGEN'); ?> <div class="miembro-lista col-xs-6 col-sm-2"> <a href="<?php echo get_author_posts_url($miembro_id); ?> " title="<?php printf(__('Pefil de %s', 'wpbilbao'), esc_html($miembro->display_name)); ?> "> <?php if ($miembro_imagen) { ?> <img src="<?php echo cimy_uef_sanitize_content($miembro_imagen); ?> " alt="<?php echo esc_html($miembro->display_name); ?> "/> <?php } else { ?> <img src="<?php echo get_bloginfo('stylesheet_directory'); ?> /images/miembros/wpbilbao-sin-foto.jpg" alt="<?php echo esc_html($miembro->display_name); ?> "/> <?php } ?> <h4><?php echo esc_html($miembro->display_name); ?> </h4> </a> </div><!-- .miembro-lista --> <?php } echo '<div class="clearfix"></div>'; echo '</div><!-- .lista-miembros -->'; }
function cimy_um_export_data() { global $wpdb, $wpdb_data_table, $wpdb_fields_table, $cimy_um_domain, $cum_upload_path; global $userid_code, $useremail_code, $username_code, $firstname_code, $lastname_code, $nickname_code, $website_code, $aim_code, $yahoo_code, $jabber_code, $password_code, $role_code, $desc_code, $registered_code, $displayname_code, $usernicename_code, $cimy_uef_name; $results = array(); if (!current_user_can('list_users')) { return; } set_time_limit(0); $field_separator = stripslashes($_POST["db_field_separator"]); $text_separator = stripslashes($_POST["db_text_separator"]); // fputcsv has been introduced with PHP v5.1.0 and works when delimiters are 1 character long $use_fput_csv = strlen($field_separator) == 1 && strlen($text_separator) == 1 && version_compare(PHP_VERSION, "5.1.0", '>=') ? true : false; if (isset($_POST["db_extra_fields"]) && isset($cimy_uef_name)) { global $wpdb_data_table; $extra_fields = get_cimyFields(); $all_radio_fields = array(); } else { $extra_fields = false; } if (isset($_POST['db_date_format'])) { $db_date_format = $_POST['db_date_format']; } else { $db_date_format = ""; } $tmpfile = $cum_upload_path . "cimy_um_exported_users-" . date("Ymd-His") . ".csv"; $fd_tmp_file = fopen($tmpfile, "w"); if ($use_fput_csv && !empty($_POST['db_excel_compatibility'])) { // http://www.skoumal.net/en/making-utf-8-csv-excel // add BOM to fix UTF-8 in Excel fputs($fd_tmp_file, chr(0xef) . chr(0xbb) . chr(0xbf)); } if ($use_fput_csv) { $header_array = array($userid_code, $username_code, $role_code, $firstname_code, $lastname_code, $nickname_code, $displayname_code, $usernicename_code, $useremail_code, $website_code, $aim_code, $yahoo_code, $jabber_code, $desc_code, $registered_code); } else { $line = $text_separator . $userid_code . $text_separator . $field_separator . $text_separator . $username_code . $text_separator . $field_separator . $text_separator . $role_code . $text_separator . $field_separator . $text_separator . $firstname_code . $text_separator . $field_separator . $text_separator . $lastname_code . $text_separator . $field_separator . $text_separator . $nickname_code . $text_separator . $field_separator . $text_separator . $displayname_code . $text_separator . $field_separator . $text_separator . $usernicename_code . $text_separator . $field_separator . $text_separator . $useremail_code . $text_separator . $field_separator . $text_separator . $website_code . $text_separator . $field_separator . $text_separator . $aim_code . $text_separator . $field_separator . $text_separator . $yahoo_code . $text_separator . $field_separator . $text_separator . $jabber_code . $text_separator . $field_separator . $text_separator . $desc_code . $text_separator . $field_separator . $text_separator . $registered_code . $text_separator; } if ($extra_fields) { foreach ($extra_fields as $field) { // avoid radio fields duplicates if ($field["TYPE"] == "radio") { if (in_array($field["NAME"], $all_radio_fields)) { continue; } else { $all_radio_fields[] = $field["NAME"]; } } else { if ($field["TYPE"] == "registration-date") { continue; } } if ($use_fput_csv) { $header_array[] = $field["NAME"]; } else { $line .= $field_separator . $text_separator . $field["NAME"] . $text_separator; } } } if ($use_fput_csv) { fputcsv($fd_tmp_file, $header_array, $field_separator, $text_separator); } else { $line = str_replace(array("\r\n\r\n", "\r\n", "\n\r", "\r", "\n"), " ", $line); $line .= "\r"; // UTF-16LE is needed to open and use the csv-file in Excel (thanks to Jean-Pierre) // http://www.php.net/manual/en/function.iconv.php#104287 // http://www.php.net/manual/en/function.fwrite.php#69566 if (!empty($_POST['db_excel_compatibility'])) { $line = mb_convert_encoding($line, 'UTF-16LE', 'UTF-8'); } fwrite($fd_tmp_file, $line); } $results["exported"] = array(); $offset = 0; // max number of users to be retrieved at once // bigger number increases speed, but also memory usage, be reasonable $limit = 250; $args = array('blog_id' => $GLOBALS['blog_id'], 'role' => '', 'meta_key' => '', 'meta_value' => '', 'meta_compare' => '', 'include' => array(), 'exclude' => array(), 'orderby' => $_POST['db_sort_by'], 'order' => 'ASC', 'offset' => $offset, 'search' => '', 'number' => $limit, 'count_total' => true, 'fields' => 'all_with_meta', 'who' => ''); // needed otherwise does not export everything if (is_network_admin()) { $args['blog_id'] = 0; } $all_users = get_users($args); $tot_users = count($all_users); while ($tot_users > 0) { foreach ($all_users as $current_user) { $results["exported"][] = $current_user->user_login; if ($use_fput_csv) { $field_array = array($current_user->ID, $current_user->user_login, $current_user->roles[0], $current_user->first_name, $current_user->last_name, $current_user->nickname, $current_user->display_name, $current_user->user_nicename, $current_user->user_email, $current_user->user_url, $current_user->aim, $current_user->yim, $current_user->jabber, $current_user->user_description, $current_user->user_registered); } else { $line = $text_separator . $current_user->ID . $text_separator . $field_separator . $text_separator . $current_user->user_login . $text_separator . $field_separator . $text_separator . $current_user->roles[0] . $text_separator . $field_separator . $text_separator . $current_user->first_name . $text_separator . $field_separator . $text_separator . $current_user->last_name . $text_separator . $field_separator . $text_separator . $current_user->nickname . $text_separator . $field_separator . $text_separator . $current_user->display_name . $text_separator . $field_separator . $text_separator . $current_user->user_nicename . $text_separator . $field_separator . $text_separator . $current_user->user_email . $text_separator . $field_separator . $text_separator . $current_user->user_url . $text_separator . $field_separator . $text_separator . $current_user->aim . $text_separator . $field_separator . $text_separator . $current_user->yim . $text_separator . $field_separator . $text_separator . $current_user->jabber . $text_separator . $field_separator . $text_separator . $current_user->user_description . $text_separator . $field_separator . $text_separator . $current_user->user_registered . $text_separator; } if ($extra_fields) { $all_radio_fields = array(); $ef_db = get_cimyFieldValue($current_user->ID, false); $i = 0; foreach ($extra_fields as $field) { $db_name = ""; $db_value = ""; // avoid radio fields duplicates if ($field["TYPE"] == "radio") { if (in_array($field["NAME"], $all_radio_fields)) { continue; } else { $all_radio_fields[] = $field["NAME"]; } } if (isset($ef_db[$i])) { $db_name = $ef_db[$i]['NAME']; } // can happen if the field's data has not been written in the DB yet // this issue has been introduced with the get_cimyFieldValue calls optimization in v1.1.0 if ($field["NAME"] == $db_name) { if (isset($ef_db[$i])) { $db_value = $ef_db[$i]['VALUE']; } $i++; if ($field["TYPE"] == "registration-date") { continue; } // $db_value = cimy_get_formatted_date($db_value, $db_date_format); } if ($use_fput_csv) { $field_array[] = $db_value; } else { $line .= $field_separator . $text_separator . $db_value . $text_separator; } } } if ($use_fput_csv) { fputcsv($fd_tmp_file, $field_array, $field_separator, $text_separator); } else { $line = str_replace(array("\r\n\r\n", "\r\n", "\n\r", "\r", "\n"), " ", $line); $line .= "\r"; // UTF-16LE is needed to open and use the csv-file in Excel (thanks to Jean-Pierre) // http://www.php.net/manual/en/function.iconv.php#104287 // http://www.php.net/manual/en/function.fwrite.php#69566 if (!empty($_POST['db_excel_compatibility'])) { $line = mb_convert_encoding($line, 'UTF-16LE', 'UTF-8'); } fwrite($fd_tmp_file, $line); } } // get next round of users (if any) $offset += $tot_users; $args["offset"] = $offset; $all_users = get_users($args); $tot_users = count($all_users); } fclose($fd_tmp_file); $results["tmp_file"] = $tmpfile; return $results; }
function recentContributors() { global $wpdb; $fiverecentAuthors = $wpdb->get_results("SELECT post_author, max(post_date) as postdate FROM wp_posts WHERE post_type = 'post' AND (post_author <> '4490' AND post_author <> '3573' ) AND post_status='publish' GROUP BY post_author ORDER BY postdate DESC LIMIT 6"); echo "<ul>"; foreach ($fiverecentAuthors as $recentAuthor) { $userId = $recentAuthor->post_author; $user = get_userdata($userId); if (function_exists(get_cimyFieldValue) && (get_cimyFieldValue($userId, 'LOCATION') || get_cimyFieldValue($userId, 'POSITION'))) { //using a plugin, sorry $userExtra = '<span class="userextra">' . get_cimyFieldValue($userId, 'LOCATION') . '<br />' . get_cimyFieldValue($userId, 'POSITION') . '</span>'; } /* echo "<li><a href='/columnists/" . $user->user_nicename . "'>" . $user->display_name . "</a><br />" . $userExtra . "</li>"; */ //Get page id by slug $slug = $user->user_nicename; $thisId = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_name = '" . $slug . "'AND post_type = 'page'"); $thisLink = get_permalink($thisId); echo "<li><a href='" . $thisLink . "'>" . $user->display_name . "</a><br />" . $userExtra . "</li>"; $userExtra = ''; } echo "</ul>"; }
function cimy_uef_mail_fields($user = false, $activation_data = false) { global $wp_hidden_fields, $cimy_uef_domain, $fields_name_prefix, $wp_fields_name_prefix; $message = ""; $meta = false; if (empty($user) && empty($activation_data)) { return $message; } if (empty($user)) { $user_login = $activation_data["user_login"]; // $user_email = $activation_data["user_email"]; if (!is_array($activation_data["meta"])) { $meta = unserialize($activation_data["meta"]); } else { $meta = $activation_data["meta"]; } // neet to do it here, otherwise I pick up main options instead of blog's ones if (is_multisite()) { cimy_switch_to_blog($meta); } $options = cimy_get_options(); if (is_multisite()) { restore_current_blog(); } if (!$options["mail_include_fields"]) { return $message; } $user = new WP_User($user_login); } if (empty($meta)) { // normal fields foreach ($wp_hidden_fields as $field) { if (!empty($user->{$field["post_name"]}) && $field["type"] != "password") { $message .= sprintf(__('%s: %s', $cimy_uef_domain), $field["label"], $user->{$field["post_name"]}) . "\r\n"; } } } else { $fields = get_cimyFields(true); foreach ($fields as $field) { if (!empty($meta[$wp_fields_name_prefix . $field["NAME"]]) && $field["TYPE"] != "password") { $message .= sprintf(__('%s: %s', $cimy_uef_domain), $field["LABEL"], $meta[$wp_fields_name_prefix . $field["NAME"]]) . "\r\n"; } } } $message .= "\r\n"; // extra fields; if (empty($meta)) { $ef_data = get_cimyFieldValue($user->ID, false); foreach ($ef_data as $field) { if (!empty($field["VALUE"])) { $message .= sprintf(__('%s: %s', $cimy_uef_domain), $field["LABEL"], $field["VALUE"]) . "\r\n"; } } } else { $extra_fields = get_cimyFields(false, true); foreach ($extra_fields as $field) { if (!empty($meta[$fields_name_prefix . $field["NAME"]])) { $message .= sprintf(__('%s: %s', $cimy_uef_domain), $field["LABEL"], $meta[$fields_name_prefix . $field["NAME"]]) . "\r\n"; } } } return $message; }
function wpbilbao_page_author_related_members() { $miembros = get_users(); // Get random order of the members shuffle($miembros); echo '<div class="lista-miembros row">'; echo '<h2>' . __('Otros Miembros', 'wpbilbao') . '</h2>'; $i = 0; foreach ($miembros as $miembro) { $miembro_id = $miembro->ID; $miembro_imagen = get_cimyFieldValue($miembro_id, 'IMAGEN'); $miembro_descripcion = get_cimyFieldValue($miembro_id, 'DESCRIPCION'); // Show 6 members if ($i == 6) { break; } ?> <?php if ($miembro_descripcion) { ?> <div class="miembro-lista col-xs-6 col-sm-2"> <a href="<?php echo get_author_posts_url($miembro_id); ?> " title="<?php printf(__('Pefil de %s', 'wpbilbao'), esc_html($miembro->display_name)); ?> "> <?php if ($miembro_imagen) { ?> <img src="<?php echo $miembro_imagen; ?> " alt="<?php echo esc_html($miembro->display_name); ?> "/> <?php } else { ?> <img src="<?php echo get_bloginfo('stylesheet_directory'); ?> /images/miembros/wpbilbao-sin-foto.jpg" alt="<?php echo esc_html($miembro->display_name); ?> "/> <?php } ?> <h3><?php echo esc_html($miembro->display_name); ?> </h3> </a> </div><!-- .miembro-lista --> <?php $i++; ?> <?php } } echo '<div class="clearfix"></div>'; echo '<p>'; echo '<a class="btn btn-primario" href="' . site_url() . '/miembros/" title="' . __('Ver todos los miembros', 'wpbilbao') . '">' . __('Ver todos los miembros', 'wpbilbao') . '</a>'; echo '</p>'; echo '</div><!-- .lista-miembros -->'; }
function cw_show_authors_level($level, $list = false) { global $wpdb; $author_query = "SELECT {$wpdb->users}.ID FROM {$wpdb->users} JOIN wp_cimy_uef_data ON wp_cimy_uef_data.USER_ID = {$wpdb->users}.ID JOIN wp_usermeta ON {$wpdb->users}.ID = wp_usermeta.user_id WHERE {$wpdb->users}.user_nicename != 'admin' AND wp_cimy_uef_data.FIELD_ID = '7' AND wp_usermeta.meta_key = 'last_name' AND wp_cimy_uef_data.VALUE = '{$level}' ORDER BY wp_usermeta.meta_value, {$wpdb->users}.user_nicename"; $users = $wpdb->get_results($author_query); foreach ($users as $user) { $user_info = get_userdata($user->ID); if ($list == true) { echo '<li><a href="' . get_author_posts_url($user_info->ID, $user_info->user_nicename) . '">' . $user_info->first_name . ' ' . $user_info->last_name . '</a></li>'; } else { echo '<div class="staff-member">'; echo '<h2><a href="' . get_author_posts_url($user_info->ID, $user_info->user_nicename) . '">' . $user_info->first_name . ' ' . $user_info->last_name . '</a></h2>'; echo '<p>' . get_cimyFieldValue($user->ID, 'JOBTITLE') . '</p>'; echo '</div>'; } } }
function shortcode_carnet() { if (is_user_logged_in()) { // $current_user = wp_get_current_user(); $current_user = wp_get_current_user(); ob_start(); ?> <div class="carnet-titulo"><?php echo 'Carnet Provisional'; ?> </div><?php ?> <div class="contenedor-carnet"><?php ?> <div class="carnet-codigo"><?php echo 'Carnet No.: 040' . ($user_ID = get_current_user_id()); ?> </div><?php ?> <div class="carnet-nombre"><?php echo 'Nombre: ' . $current_user->user_firstname . ' ' . $current_user->user_lastname; // echo '<br />'; ?> </div><?php // ------------------------------------------ if ($current_user->ID) { $cedula = cimy_uef_sanitize_content(get_cimyFieldValue($current_user->ID, 'CEDULA')); $ciudad = cimy_uef_sanitize_content(get_cimyFieldValue($current_user->ID, 'CIUDAD')); $telefono = cimy_uef_sanitize_content(get_cimyFieldValue($current_user->ID, 'TELEFONO')); ?> <div class="carnet-nombre"><?php echo 'Cédula:' . ' ' . $cedula; ?> </div><?php // echo '<hr>'; ?> <div class="carnet-nombre"><?php echo 'Ciudad:' . ' ' . $ciudad; ?> </div><?php ?> <div class="carnet-nombre"><?php echo 'Teléfono:' . ' ' . $telefono; ?> </div><?php } // ------------------------------------------ ?> <div class="carnet-logo"><?php // echo get_avatar(); // echo get_avatar( $user_id, 45 ); // echo get_avatar( $user_id ); ?> <img class="carnet-logo_img" src="http://cambiogeneracional.org/carnetizate/wp-content/uploads/logo.png"></img><?php ?> </div><?php ?> </div><?php return ob_get_clean(); } }
} else { $current_user = get_userdata(intval($author)); } ?> <div id="content" class="staff"> <?php // Used to generate ID for vcard $firstname = strtolower($current_user->first_name); $lastname = strtolower($current_user->last_name); // Gets values from DB with the Cimy Users Extra Fields plugin. $title = get_cimyFieldValue($current_user->ID, 'TITLE'); $picture = get_cimyFieldValue($current_user->ID, 'IMAGE'); $bio = get_cimyFieldValue($current_user->ID, 'BIO'); $institution = get_cimyFieldValue($current_user->ID, 'INSTITUTION'); $twitter = get_cimyFieldValue($current_user->ID, 'TWITTER'); $twitter_name = str_replace("http://twitter.com/", "", $twitter); $twitter_url = 'http://twitter.com/' . $twitter_name; ?> <div class="vcard" id="hcard-<?php echo $lastname; ?> "> <h2 class="fn"><?php echo $current_user->first_name; echo ' '; echo $current_user->last_name; ?> </h2> <img id="photo" src="<?php
<?php /*Template Name: Single User*/ include 'inc/header.php'; include 'inc/nav-bar.php'; $author = get_user_by('slug', get_query_var('author_name')); $authorID = $author->ID; $author = get_user_meta($authorID); $coverImage = get_cimyFieldValue($authorID, 'COVER_IMAGE'); $tagline = get_cimyFieldValue($authorID, 'SUBTITLE'); $profileImgArgs = array('size' => '250', 'force_default' => true); //echo '<pre>'; //var_dump($author); //die(); ?> <!-- User Page start --> <section class="user-hero"> <div class="user-hero__image" style="background-image:url(<?php echo $coverImage; ?> );"></div> </section> <main class="single-user content-wrapper"> <section class="user-bio"> <div class="user-bio__image"> <?php
function cimy_extra_field_sc($atts) { get_currentuserinfo(); $user_id = get_current_user_id(); $value = get_cimyFieldValue($user_id); return $value; }
<?php /** * Template Name: PROFILE * * * @package Cocoro */ $cardNo = get_cimyFieldValue($current_user->ID, "CARD_NO"); $firstName = get_cimyFieldValue($current_user->ID, "FIRST_NAME"); $lastName = get_cimyFieldValue($current_user->ID, "LAST_NAME"); get_header(); ?> <main id="main" class="site-main" role="main"> <header class="entry-header"> <h1 class="entry-title">User profile page</h1> </header> <div class="entry-content"> <?php if (is_user_logged_in()) { $royaltyCardAPI = new royaltyCardAPI(); $balance = $royaltyCardAPI->getCardInfo($cardNo); ?> <p>Royalty point balance : <?php echo $balance; ?> </p> <?php global $current_user;
* @subpackage Longform * @since Longform 1.0 */ get_header(); global $longform_site_width; $sm_author_id = get_the_author_meta('ID'); $sm_authot_description = get_the_author_meta('description', $sm_author_id); if (function_exists('get_cimyFieldValue')) { $author_style = ''; $author_class = ''; $social_content = ''; $sm_author_social['twitter'] = get_cimyFieldValue($sm_author_id, 'USER-TWITTER'); $sm_author_social['facebook'] = get_cimyFieldValue($sm_author_id, 'USER-FACEBOOK'); $sm_author_social['pinterest'] = get_cimyFieldValue($sm_author_id, 'USER-PINTEREST'); $sm_author_social['googleplus'] = get_cimyFieldValue($sm_author_id, 'USER-GOOGLE'); $sm_author_background = get_cimyFieldValue($sm_author_id, 'USER-BACKGROUND'); if (!empty($sm_author_background)) { $author_class = ' with_bg_image'; $author_style = ' style="background-image: url(\'' . $sm_author_background . '\');"'; } $social_content = '<ul class="author-social-links">'; foreach ($sm_author_social as $key => $value) { if (!empty($value)) { $social_content .= '<li class="genericon genericon-' . $key . ' author-s-' . $key . '"><a href="' . $value . '" target="_blank"> </a></li>'; } } $social_content .= '</ul>'; } ?> <div id="main-content" class="main-content row<?php
function addRoyaltyPoint($order_id) { if (!get_current_user_id()) { return false; } $order = new WC_Order($order_id); $subtotal = $order->get_subtotal(); $pointsAdjustment = $subtotal - $order->cart_discount; $cardNo = get_cimyFieldValue(get_current_user_id(), 'CARD_NO'); $userInfo = array("CARD_NO" => $cardNo, "PLUS_POINT" => number_format($pointsAdjustment, 2)); $royaltyCardAPI = new royaltyCardAPI(); $rtnIncrementPoints = $royaltyCardAPI->incrementPoints($userInfo); if ($rtnIncrementPoints == 'SUCCESS') { //echo 'aaaa'; } else { return new WP_Error(444, $rtnIncrementPoints); } }
?> " >Flickr do <?php echo get_the_author_meta('display_name', $autor); ?> </a> </li> <?php } ?> <?php if (get_cimyFieldValue($autor, "YOUTUBE")) { ?> <li id="youtube-btn" class="social-icons-btn"> <a href="<?php echo cimy_uef_sanitize_content(get_cimyFieldValue($autor, "YOUTUBE")); ?> " title="Youtube do <?php echo get_the_author_meta('display_name', $autor); ?> " >Youtube do <?php echo get_the_author_meta('display_name', $autor); ?> </a> </li> <?php } ?> </ul> </div><!-- .redes-sociais-wrapper -->
<?php /** * Template Name: Profile Page * */ get_header(); get_template_part('partials/header'); $cUser = wp_get_current_user(); $currentUser = $cUser->ID; $all_meta_for_user = array_map(function ($a) { return $a[0]; }, get_user_meta($currentUser)); $cimyUserId = get_cimyFieldValue($currentUser, false); ?> <main role="main"> <div class="container"> <hr> <div class="col-md-6 col-sm-6"> <?php echo $all_meta_for_user['first_name']; ?> <?php echo $all_meta_for_user['last_name']; ?> </div> <div class="col-md-6 col-sm-6"> <?php foreach ($cimyUserId as $cimyUser) { echo $cimyUser['VALUE'];