/images/mobile/apple-touch.png"> <?php // meta description if ($meta_description = get_field('seo_description')) { echo '<meta name="description" content="' . $meta_description . '">'; } // get current user object (username, etc.) $current_user = wp_get_current_user(); if (!$current_user instanceof WP_User) { return; } // fetch final URL segment $url_endpoint = array_pop(explode('/', rtrim($_SERVER['REQUEST_URI'], '/'))); // get user nicename from URL if (!($user_url_nicename = url_segment(2))) { // this needs to be "2" for the live site $user_url_nicename = $current_user->user_nicename; } // determine if user is viewing his own pages $is_viewing_own_page = true; $current_page_user_id = $current_user->ID; if ($current_user->user_nicename != $user_url_nicename && is_author()) { $is_viewing_own_page = false; $current_page_user_id = get_user_by('slug', $user_url_nicename)->ID; } // get user avatar, and specify a fallback if (!($avatar = get_wp_user_avatar_src($current_page_user_id, 80))) { $avatar = DEFAULT_THUMBNAIL; } if (!($menu_avatar = get_wp_user_avatar_src($current_user->ID, 48))) {
status_header(404); nocache_headers(); include get_404_template(); exit; } // doing it this way vs get_header() gives header access to all variables include TEMPLATEPATH . '/header.php'; $current_user_is_board_author = false; $board_ids = null; if (have_posts()) { while (have_posts()) { the_post(); // store permalink for efficiency $permalink = get_permalink(); // grab URL endpoint (that is, the final segment in the URL) $url_endpoint = url_segment(3); // TO DO: change to 3 on live site // default: user is not a member of this board // $is_member = false; // get board author ID $board_author = get_the_author_meta('id'); // get description if (!($board_description = apply_filters('the_content', get_the_content()))) { $board_description = '<em>Alas, this board has no description.</em>'; } // cache result, since we do this check a few times if ($current_user->ID == $board_author) { $current_user_is_board_author = true; } if (has_post_thumbnail()) { $board_thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail');
function url_path($skip_ajax = false) { if ($skip_ajax == true) { $url = current_url($skip_ajax); } else { $url = false; } $u1 = implode('/', url_segment(-1, $url)); return $u1; }
$follow_button = '<span class="ico follow" data-id="' . $following->ID . '" title="Follow"></span>'; } else { $follow_button = ''; } } // abstract variables to work with individual-member.php $member_home_url = $following_url; $member_avatar = $following_avatar; $member_screen_name = $following->display_name; $member_username = $following->user_nicename; $member_description = $following->description; // load individual members include TEMPLATEPATH . '/individual-member.php'; } } else { $following = get_user_by('slug', url_segment(2)); echo '<p class="message shown info">'; if ($following->user_login == $current_user->user_login) { echo '<strong>You aren\'t following anyone yet.</strong> Check out the <a href="' . home_url() . '/members">Members page</a> for some good people to follow.'; } elseif ($following->user_login == url_segment(2)) { echo $following->display_name . " isn't following anyone yet."; } echo '</p>'; // TO DO: add action boxes to encourage more participation /* * e.g., Tips for Getting Followers * Invite People * Follow Top Quoters (suggested users) */ //echo '</section> <!-- // following-list -->'; }
<?php /* * QUOTEBOARD * Page Template */ // doing it this way vs get_header() gives access to all variables declared in header include TEMPLATEPATH . '/header.php'; // prevent jankiness with pagination $paged = get_query_var('paged') ? get_query_var('paged') : 1; echo '<section class="main">'; switch (url_segment(1)) { /** * Main Authors Page - shows newest site members */ case 'authors': echo '<h3 style="margin-top: 0;">Author Archive <span class="pagenum">Page ' . $paged . '</span></h3>'; $args = array('number' => RESULTS_PER_PAGE, 'order' => 'DESC', 'orderby' => 'registered', 'paged' => $paged, 'role' => 'member_added'); $wp_user_query = new WP_User_Query($args); $users = $wp_user_query->get_results(); $user_count = $wp_user_query->get_total(); foreach ($users as $user) { include TEMPLATEPATH . '/individual-author.php'; } $total_pages = ceil($user_count / RESULTS_PER_PAGE); echo '<div class="pagination">' . paginate_links(array('base' => get_pagenum_link(1) . '%_%', 'current' => $paged, 'show_all' => false, 'total' => $total_pages, 'type' => 'plain')) . '</div>'; break; /** * Leave Feedback Page */ /**
<?php /* * QUOTEBOARD * Validate board invite code * * Called from page-invite.php. Checks the validation code in the URL * and ensures it is valid and associated with the logged in user's * email address. If so, add user as a collaborator and delete the invite. */ if (url_segment(2)) { // clean and sanitize invite code $invite_code = ltrim(url_segment(2), '?'); $invite_code = sanitize_text_field($invite_code); $can_collab = false; if (is_user_logged_in()) { // check if this invite code is valid for this email if ($board_id = $wpdb->get_var("SELECT board_id FROM wp_qb_invite_codes WHERE invite_email = '{$current_user->user_email}' AND invite_code = '{$invite_code}'")) { // check if user is already following the board foreach ($members = get_field('board_members', $board_id) as $key => $member) { if ($member['board_members_user']['ID'] == $current_user->ID) { $updated = update_post_meta($board_id, 'board_members_' . $key . '_can_collaborate', 'y'); $can_collab = true; break; } } // if not, add user as a collaborator if (!$can_collab) { $field_key = 'field_5077ae931b6f6'; $value = get_field($field_key, $board_id); $value[] = array('board_members_user' => $current_user->ID, 'can_collaborate' => 'y');