Recent Activities

How can i get all the latest activities on my website in one single part of the site. For example, codeNIGERIA shows all the current activities related to you (whose account is currently logged in) all that has occurred since you last logged in the Activity bar and also shows all activities that has occurred in the website under Recent Activity. How can i load this two events from my database. P.S the language is PHP.