How to check whether any node is accessed in past or not
During one of my project development I need to check whether in past any node is accessed by logged in user or not.
Fortunately node module and “history table of database ”came to help me.
In node module there is function node_last_viewed($nid) which returns the last unix timestamp of node access time.
Basically I was using Og forum module so I wanted to check whether any forum topic is viewed previously by logged in user or not.
So first I filtered all the groups of the logged in user.
After that I checked field_data_group_audience table which stores the relation between group node and forum topics in that node.
So I just accessed all the forum nodes of group in which user is member and checked the time stamp.
function get_latest_unread_nodecount() {
global $user;
$unreadcount = 0;
$query = '';
$usergroups = og_get_groups_by_user($user);
$query = db_select('field_data_group_audience', 'f');
$query->fields('f',array('entity_id'));
$query->condition(db_or()->condition('f.bundle', 'forum', '=')->condition('f.bundle', 'post', '='));
$query->condition('f.group_audience_gid', $usergroups, 'IN');
$result = $query->execute();
$rows = array();
foreach ($result as $row) {
$viewstatus = node_last_viewed($row->entity_id);
if($viewstatus == 0) {
$unreadcount++;
}
}
if($unreadcount > 0) {
return $unreadcount;
}
else {
return 'No';
}
}
$unread count will fetch the latest unread forum posts for the group in which user is member.
Comments
Roland (not verified)
Mon, 11/05/2012 - 13:14
Permalink
It is really helpful
It is really helpful.
I would like to know other way do it using views module
viessmann mirola (not verified)
Wed, 07/03/2013 - 02:39
Permalink
Add new comment | Mohit Aghera
I went over this website and I conceive you have a
lot of superb in a row, saved to fav (:.
buy instagram f... (not verified)
Thu, 09/26/2013 - 09:59
Permalink
Add new comment | Mohit Aghera
I just like the valuable information you supply on your articles.
I'll bookmark your weblog and take a look at once more
here frequently. I am moderately sure I'll be told a lot of new stuff proper right
here! Best of luck for the next!
Anonymouses (not verified)
Wed, 02/12/2014 - 15:23
Permalink
My spouse and I absolutely
My spouse and I absolutely love your blog and find most of your post's to be what precisely I'm looking for. Does one offer guest writers to write content to suit your needs? I wouldn't mind composing a post or elaborating on most of the subjects you write with regards to here. Again, awesome site! Agen Texas Online Indonesia Terpercaya | MobilSedan COrolla
Cipto junaedy (not verified)
Sat, 05/10/2014 - 23:52
Permalink
No matter if some one
No matter if some one searches for his required thing, so he/she desires to be available that in detail, therefore that thing is maintained over here. Cipto junaedy
where to buy ga... (not verified)
Tue, 04/08/2014 - 04:21
Permalink
I would definitely rate this
I would definitely rate this as excellent subject to review, a much needed one for future concerns and it must be share too with others'Excellent explanations shown here, would make me more notifiable in future need of this occurrence a noteworthy experience seen before.
where to buy garcinia cambogia
where can I buy garcinia cambogia
stores that sell garcinia cambogia
what stores sell garcinia cambogia
Garcinia Cambogia Walgreens
العاب فلاش (not verified)
Mon, 04/29/2013 - 23:27
Permalink
m6nsh
thanks for thes guys صور
centrumdominik (not verified)
Mon, 09/23/2013 - 01:47
Permalink
Add new comment | Mohit Aghera
The courses for the most part are taken way up by experienced coupled with trained faculties.
buy Shimano (not verified)
Thu, 12/12/2013 - 12:59
Permalink
Add new comment | Mohit Aghera
If you are going for most excellent contents like
me, simply pay a visit this website all the time as it
offers feature contents, thanks
ni (not verified)
Sun, 06/16/2013 - 01:23
Permalink
helpful
Thanks for sharing your idea.cell phone
web page (not verified)
Tue, 07/02/2013 - 10:50
Permalink
Add new comment | Mohit Aghera
I'd like to thank you for the efforts you have put in penning this site. I am hoping to check out the same high-grade blog posts by you in the future as well. In fact, your creative writing abilities has motivated me to get my very own website now ;)
blog (not verified)
Sun, 07/28/2013 - 08:37
Permalink
Add new comment | Mohit Aghera
Grеat post. I used to bе checking continuously thіs blog аnd Ι'm inspired! Very helpful information specifically the remaining phase :) I care for such info a lot. I used to be seeking this particular info for a long time. Thank you and good luck.
is it safe to b... (not verified)
Wed, 08/14/2013 - 15:51
Permalink
Add new comment | Mohit Aghera
I am curious to find out what blog system you're using? I'm experiencing some small security issues with my latest site and I'd like to find something more secure. Do you have any recommendations?
mohit.aghera
Thu, 08/22/2013 - 16:17
Permalink
You can try Drupal Gardens
I am using Drupal Gardens. Drupal gardens is built upon powerful content management framework Drupal. You can certainly try for your blog. Here is the link http://www.drupalgardens.com
calgary interna... (not verified)
Sun, 04/06/2014 - 11:38
Permalink
Add new comment | Mohit Aghera
Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something.
I think that you could do with some pics to drive the message home a little bit, but
other than that, this is fantastic blog. A great read.
I'll definitely be back.
sites de rencontres (not verified)
Thu, 09/12/2013 - 05:21
Permalink
Add new comment | Mohit Aghera
Hi to every one, it's genuinely a fastidious for me to pay a visit this site, it consists of important Information.
Jason Dworson (not verified)
Fri, 12/06/2013 - 17:34
Permalink
It's my honor to have the
It's my honor to have the chance to post my comment here to stand by your article and express my happiness to see your post.I will bookmark your blog and have my friends check up here often. I am quite sure they will learn lots of new stuff here than anybody else. Thanks for sharing this information. singles looking affairs lonely personals maker woman online personals date woman looking cheating personals
Wiki - China (not verified)
Thu, 08/14/2014 - 23:34
Permalink
Add new comment | Mohit Aghera
Do you have a spam problem on this website; I also amm a blogger, andd I was
wondering your situation; many of us have developeed some nice
procedures and we are looking to exchange strategies with other folks,
be sure to shoot me an email if interested.
wrathfufl.posta... (not verified)
Sun, 10/20/2013 - 03:44
Permalink
Add new comment | Mohit Aghera
Way cool! Some extremely valid points! I appreciate you writing this write-up and also the rest of the website is also very good.
test bank (not verified)
Thu, 07/31/2014 - 22:53
Permalink
Add new comment | Mohit Aghera
Hello There. I found your blog using msn. This is a really well
written article. I'll make sure to bookmark it
and come back to read more of your useful information. Thanks for the post.
I'll definitely comeback.
buy instagram f... (not verified)
Mon, 03/17/2014 - 03:11
Permalink
Add new comment | Mohit Aghera
It's amazing designed for me to have a web page,
which is good in favor of my knowledge. thanks admin
Buy Soundcloud Plays (not verified)
Thu, 10/03/2013 - 19:01
Permalink
Add new comment | Mohit Aghera
Hmm is anyone else encountering problems with the images on this blog loading?
I'm trying to figure out if its a problem on my end or if it's the blog.
Any feedback would be greatly appreciated.
mohit.aghera
Sun, 10/06/2013 - 07:57
Permalink
Hi I am Mohit, the author of
Hi I am Mohit, the author of this Blog.
The blog is currently up and running fine. How ever i can't ingore your suggestion, i will look at it and fix it if any issue is found.
sibersoft.com (not verified)
Sat, 01/25/2014 - 01:07
Permalink
Add new comment | Mohit Aghera
My spouse and I absolutely love your blog and find most of your post's to
be what precisely I'm looking for. Does one offer guest writers
to write content to suit your needs? I wouldn't mind composing a post or
elaborating on most of the subjects you write with regards to here.
Again, awesome site!
justcool1122 (not verified)
Sat, 03/22/2014 - 14:38
Permalink
I'm glad to see the great
I'm glad to see the great detail here!. urlopner
ni (not verified)
Sun, 06/16/2013 - 01:28
Permalink
useful
Thanks for your post. tablet pc
ebiz247.net (not verified)
Fri, 08/23/2013 - 23:57
Permalink
Add new comment | Mohit Aghera
The morning of her wedding was her final dress fitting and
I went with her. That s worth the cost of distribution is virtually nothing, and they are news another form
of financial help. Some issues are safe to report on
news it But they needed people on the idea mentioned in the first place.
Of natural causes 2012 is perhaps a turning pointDrudge Report found at 1:
55Fri, 13 Jul 2012Anchorage law does technically permit
the homeless to register to vote based on" where they sleep," according to
the AP.
sad (not verified)
Sun, 11/03/2013 - 10:16
Permalink
Thanks for your post.
Thanks for your post. برودكاست بلاك بيري
Amanda (not verified)
Mon, 11/04/2013 - 02:39
Permalink
I like this article. It is
I like this article. It is really good. This is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion. You also know how to make people rally behind it, obviously from the responses. Nice site and the article are posting are very nice. Hi, good luck man and thanks for sharing this post with us. Game of Thrones Season 3 DVD Box Set | Friends Seasons 1-10 DVD Box set | Breaking Bad Season 5 DVD Box Set | Mad Men Season 6 DVD Box Set | Pretty Little Liars Season 3 DVD Box Set | The Office Seasons 1-9 DVD Box Set
best-home-secur... (not verified)
Thu, 03/27/2014 - 12:56
Permalink
Add new comment | Mohit Aghera
Hello mates, its fantastic paragraph about educationand entirely defined, keep it up all the time.
Rodene (not verified)
Tue, 11/12/2013 - 06:57
Permalink
Pretty Interesting post.
Pretty Interesting post. Could not be written any better. Thanks for sharing!
Gas engine generator
Rodene (not verified)
Tue, 11/12/2013 - 06:58
Permalink
This is highly informatics,
This is highly informatics, crisp and clear. I think that Everything has been described in systematic manner so that reader could get maximum information and learn many things
Gas genset and Desulphurization
Rodene (not verified)
Tue, 11/12/2013 - 10:13
Permalink
I really appreciate the fact
I really appreciate the fact that you approach these topics from a stand point of knowledge and information.
Turnkey Solution
flor (not verified)
Wed, 11/27/2013 - 03:21
Permalink
Wonderful article, thanks for putting this together! This is obviously one great post. Thanks for the valuable information and insights you have so provided here. I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. <a href="http://monsterbeatstourheadphones.tumblr.com/" rel=dofollow>monster beats tour headphones</a> | <a href="http://monsterbeatssoloheadphones.tumblr.com/" rel=dofollow>monster beats solo hd headphones</a> | <a href="http://monsterbeatsstudioheadphones.tumblr.com/" rel=dofollow>monster beats studio headphones</a> | <a href="http://monsterbeatsproheadphones.tumblr.com/" rel=dofollow>monster beats pro headphones</a>
eavedrop44 (not verified)
Wed, 03/12/2014 - 13:49
Permalink
I like what your blog stands
I like what your blog stands for. this is my first time and here and I am pleased that i was able to find such an excellent resource for travel information. i have bookmarked your site and will be back to what new blog posts you create moving forward.
Double Glazing Preston
flor (not verified)
Wed, 11/27/2013 - 03:22
Permalink
Thanks a ton for being the
Thanks a ton for being the mentor on this theme. My spouse and i enjoyed the article a lot and most of all enjoyed reading the way you handled the issues I regarded as being controversial. You are always very kind towards readers really like me and assist me in my existence. Thank you. I like you recommendation. Your recommendation is of well use to people. A great article post, this is something very interesting. <a href="http://thewireseasons1-5dvduk.tumblr.com/" rel=dofollow>The Wire Seasons 1-5 DVD Box Set</a> | <a href="http://entourageseasons1-8dvduk.tumblr.com/" rel=dofollow>Entourage Seasons 1-8 DVD Box Set</a> | <a href="http://batmantheanimatedseriesdvd.tumblr.com/" rel=dofollow>The Batman - The Complete Animated Series</a> | <a href="http://fringeseason1-5dvduk.tumblr.com/" rel=dofollow>Fringe Season 1-5 DVD Box Set</a> | <a href="http://csilasvegasseasons1-13uk.tumblr.com/" rel=dofollow>CSI Las Vegas Seasons 1-13 DVD Box Set</a> | <a href="http://monterbeatsheadphonesale.tumblr.com/" rel=dofollow>Monster Beats Headphones for Sale</a>
Amanda (not verified)
Wed, 11/27/2013 - 05:42
Permalink
This is such a great resource
This is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free. It?s the old what goes around comes around routine. I like you recommendation. Your recommendation is of well use to people. A great article post, this is something very interesting. <a href="http://supernaturalseasons1-8uk.tumblr.com/" rel=dofollow>Supernatural Seasons 1-8 DVD Box Set</a> | <a href="http://breakingbadseasons1-5uk.tumblr.com/" rel=dofollow>Breaking Bad Seasons 1-5 DVD Box Set</a> | <a href="http://curbyourenthusiasmseasons1-8uk.tumblr.com/" rel=dofollow>Curb Your Enthusiasm Seasons 1-8 DVD Box Set</a> | <a href="http://waltdisneys100yearsofmagic172.tumblr.com/" rel=dofollow>Walt Disney’s 100 Years Of Magic 172 Discs DVD Box Set</a> | <a href="http://chuckseasons1-5dvduk.tumblr.com/" rel=dofollow>Chuck Seasons 1-5 DVD Box Set</a> | <a href="http://monsterbeatsbydrdresale.tumblr.com/" rel=dofollow>monster beats by dr dre headphones</a>
Webdesign (not verified)
Wed, 12/18/2013 - 09:47
Permalink
web designing company
This is very much interesting. Thanks for sharing this useful information.
Web designing company
best beard shaper (not verified)
Sun, 02/09/2014 - 08:48
Permalink
Add new comment | Mohit Aghera
No matter if some one searches for his required thing, so he/she
desires to be available that in detail, therefore that thing is maintained over here.
sara10 (not verified)
Sun, 12/22/2013 - 12:53
Permalink
Great post
A very wonderful article. It touches a lot of urgent issues of our society. We can not be indifferent to these problems. This article gives good ideas and concepts. Keep it up. yellow throw pillows
flor (not verified)
Mon, 12/30/2013 - 03:46
Permalink
hi..I read your blogs and
hi..I read your blogs and found it very Interesting. Thanks for writing such useful blogs. waiting for more that laymen like me can relate to. I just say thanks for writing such topics with your effort and precises time for user who search for unique and useful information. South Park Seasons1-16 DVD Box Set | It's Always Sunny in Philadelphia Seasons 1-7 DVD Box Set | The Simpsons Seasons 1-24 DVD Box Set | White Collar Seasons 1-4 DVD Box Set | Human Target Seasons 1-2 DVD Box Set
personalized gifts (not verified)
Mon, 12/30/2013 - 15:18
Permalink
An interesting article
This is the very good idea! Just want to say thank you for information, Just continue to the write such a position. I will be your faithful reader. Thank you again. personalized gifts
rosie (not verified)
Sat, 01/11/2014 - 07:22
Permalink
I will be wondering on route
I will be wondering on route you are writing lower this particular issue can be so finely detailed. It is the sort of content and articles designed to offer clearance to this very predicament, agen online indonesia terpercaya Mobil Sedan Corolla
jhon321 (not verified)
Tue, 01/14/2014 - 08:08
Permalink
i was looking for a tip to
i was looking for a tip to get my node stats and you have explained it beautifully thanks for great output. Web Design Manchester web design service.
dark (not verified)
Tue, 01/21/2014 - 17:20
Permalink
Basically I was using Og
Basically I was using Og forum module so I wanted to check whether any forum topic is viewed previously by logged in user or not. torrent downloads
increase cow milk (not verified)
Fri, 03/14/2014 - 04:56
Permalink
exllent info
Well, I am so excited that I have found this cattle farming your post because I have been searching for animal feed some information about it.
justcool1122 (not verified)
Sat, 03/22/2014 - 14:37
Permalink
It was a very good post
It was a very good post indeed. I thoroughly enjoyed reading it in my lunch time. Will surely come and visit this blog more often. Thanks for sharing. urlopner
merit gold bett... (not verified)
Sat, 07/19/2014 - 00:45
Permalink
Add new comment | Mohit Aghera
Excellent post. I was checking continuously this weblog and I am inspired!
Very helpful information specifically the remaining section :) I take care
of such info much. I was seeking this particular information for a long time.
Thanks and best of luck.
Pharmd515 (not verified)
Fri, 04/25/2014 - 06:12
Permalink
Enjoyed studying this, very
Enjoyed studying this, very good stuff, regards . A man may learn wisdom even from a foe. by Aristophanes. keeafbddcbea
Pharmc323 (not verified)
Fri, 04/25/2014 - 06:12
Permalink
I appreciate, cause I
I appreciate, cause I discovered just what I used to be looking for. You have ended my four day long hunt! God Bless you man. Have a nice day. Bye aacgfgkdegbe
Pages
Add new comment