function community_features_user_feed() { $uid = $GLOBALS['user']->uid; $flags = flag_get_user_flags('user', null, $uid); //dpm($flags); //unset($flags['cf_follow_user']); if (isset($flags['cf_follow_user'])) { //dpm($flags['cf_follow_user']); foreach ($flags['cf_follow_user'] as $flag) { //dpm($flag); $author_uid = $flag->entity_id; $query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'cm_show')->propertyCondition('status', 1)->propertyCondition('uid', $author_uid)->propertyOrderBy('created', 'DESC')->fieldCondition('field_show_vod', 'fid', 'NULL', '!=')->pager(5); //->range(0, 100); $result = $query->execute(); if (isset($result['node'])) { $nids = array_keys($result['node']); $nodes = entity_load('node', $nids); foreach ($nodes as $node) { $items[$node->nid] = array('node' => $node); } } } $build['pager'] = array('#theme' => 'pager', '#weight' => 5); //dpm($items); // Send data to TPL. return theme('cf_user_feed_all', array('content' => isset($items) ? $items : '', 'pager' => $build['pager'])); } else { return '<br/> You are currently not following any users. Please follow some users and their videos will appear here.'; } }
/** * Perform custom validation on a flag before flagging/unflagging. * * @param $action * The action about to be carried out. Either 'flag' or 'unflag'. * @param $flag * The flag object. * @param $entity_id * The id of the entity the user is trying to flag or unflag. * @param $account * The user account performing the action. * @param $flagging * The flagging entity. * * @return * Optional array: textual error with the error-name as the key. * If the error name is 'access-denied' and javascript is disabled, * drupal_access_denied will be called and a 403 will be returned. * If validation is successful, do not return a value. */ function hook_flag_validate($action, $flag, $entity_id, $account, $skip_permission_check, $flagging) { // We're only operating on the "test" flag, and users may always unflag. if ($flag->name == 'test' && $action == 'flag') { // Get all flags set by the current user. $flags = flag_get_user_flags('node', NULL, $account->uid, $sid = NULL, $reset = FALSE); // Check if this user has any flags of this type set. if (isset($flags['test'])) { $count = count($flags[$flag->name]); if ($count >= 2) { // Users may flag only 2 nodes with this flag. return array('access-denied' => t('You may only flag 2 nodes with the test flag.')); } } } }
* Default simple view template to display a list of rows. * * @ingroup views_templates */ if (!empty($title)) { ?> <h3><?php print $title; ?> </h3> <?php } // dsm($rows); // dsm($view); // Get all the flags for the user. $flagged = flag_get_user_flags('node'); // dsm($flagged); // Build a grid that we can use for our table. foreach ($rows as $id => $row) { $results[$view->result[$id]->node_data_field_session_day_field_session_day_value][$view->result[$id]->node_data_field_session_room_field_session_time_value][$view->result[$id]->node_data_field_session_day_field_session_room_value] = array('content' => $row, 'nid' => $view->result[$id]->nid, 'id' => 'node-' . $view->result[$id]->nid); } dsm($results); // Sorting so that time goes ASC. ksort($results['saturday']); ksort($results['sunday']); // Gather the room cck field values for the table headers $field_rooms = content_fields('field_session_room'); $allowed = content_allowed_values($field_rooms); $saturday_header = array($allowed[1], $allowed[2], $allowed[3], $allowed[4], $allowed[5], $allowed[8]); $sunday_header = array($allowed[2], $allowed[3], $allowed[4], $allowed[5], $allowed[8]); // Add some js magic to catch a vote request and then update the td class
<?php //dpm($cf_user_statistics_blocks); ?> <?php print render($cf_user_statistics_blocks['content']); ?> <div class="clearfix"></div> </div> <div class="col-lg-9 col-md-9 col-xs-12 user-profile-third-col"> <h2><?php echo $account['user']->name; ?> Likes</h2> <div class="user-shows-likes-container"> <?php $flags = flag_get_user_flags('node', null, $account['user']->uid); ?> <?php //dpm($flags); ?> <?php if (!empty($flags)) { ?> <ul class="user-shows-likes"> <?php foreach ($flags['cf_like_show'] as $flag) { ?> <?php //dpm($flag); ?> <?php
* - $logged_in: Flags true when the current user is a logged-in member. * - $is_admin: Flags true when the current user is an administrator. * * Field variables: for each field instance attached to the node a corresponding * variable is defined; for example, $node->body becomes $body. When needing to * access a field's raw values, developers/themers are strongly encouraged to * use these variables. Otherwise they will have to explicitly specify the * desired field language; for example, $node->body['en'], thus overriding any * language negotiation rule that was previously applied. * * @see template_preprocess() * @see template_preprocess_node() * @see template_process() */ //Flags info keyed by flag name (machine name) $flags = flag_get_user_flags('node', $node->nid); $flag_counts = flag_get_counts('node', $node->nid); // like flag breakdown $likes_count = isset($flag_counts['like']) ? $flag_counts['like'] : 0; if (isset($flags['like'])) { $likes_count -= 1; } $likes = ''; if ($likes_count > 0) { $likes = $likes_count . (isset($flags['like']) ? ' other ' : ' ') . ($likes_count > 1 ? 'people like ' : 'person likes ') . 'this.'; } $bannerTitle = $title; // unset($content['links']['comment']); //dump_pre($content['links']); ?>
//dpm($cf_user_statistics_blocks); ?> <?php print render($cf_user_statistics_blocks['content']); ?> <div class="clearfix"></div> </div> <div class="col-lg-9 col-md-9 col-xs-12 user-profile-third-col"> <h2><?php echo $account->name; ?> Followers</h2> <ul class="user-grid"> <?php $flags = flag_get_user_flags('user'); if (!empty($flags['cf_follow_user'])) { foreach ($flags['cf_follow_user'] as $flag) { $flagged_user = user_load($flag->entity_id); ?> <li> <a class="user-avatar" href="/user/<?php echo $flagged_user->uid; ?> "> <?php echo theme('image_style', array('style_name' => 'user_avatar', 'path' => !empty($flagged_user->picture) ? $flagged_user->picture->uri : variable_get('user_picture_default'))); ?> <h5><?php echo $flagged_user->name; ?>
<div class="phone-header hidden-600"> <a href="#"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve"> <path d="M11.001,0H5C3.896,0,3,0.896,3,2c0,0.273,0,11.727,0,12c0,1.104,0.896,2,2,2h6c1.104,0,2-0.896,2-2 c0-0.273,0-11.727,0-12C13.001,0.896,12.105,0,11.001,0z M8,15c-0.552,0-1-0.447-1-1s0.448-1,1-1s1,0.447,1,1S8.553,15,8,15z M11.001,12H5V2h6V12z"></path> <!--<img src="<?php print base_path() . path_to_theme(); ?> /img/png-icons/phone-icon.png" alt="" width="16" height="16" style="vertical-align: top;">--> </svg> </a> </div> <?php if (module_exists('flag')) { $flags = flag_get_user_flags('node'); ?> <?php if (!theme_get_setting('comparelist')) { ?> <div class="compare-header flag-status-compare" <?php print !isset($flags['compare']) ? 'style="display:none"' : ''; ?> > <a href="<?php print url('product-compare'); ?> "> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve"> <path fill="#1e1e1e" d="M16,3.063L13,0v2H1C0.447,2,0,2.447,0,3s0.447,1,1,1h12v2L16,3.063z"></path> <path fill="#1e1e1e" d="M16,13.063L13,10v2H1c-0.553,0-1,0.447-1,1s0.447,1,1,1h12v2L16,13.063z"></path>