Tuesday, 27 January 2015

Google trends api php - How to get hot trends

Google trends api php - How to get hot trends


Google Trends is a public web facility of Google Inc., based on Google Search, that shows how often a particular search-term is entered relative to the total search-volume across various regions of the world, and in various languages. 
From: en.wikipedia.org/wiki/Google_Trends


Use following code to get the hot trends from google.
  
try {            
            $url='http://www.google.com/trends/hottrends/atom/hourly';                        
            $client = new Zend_Http_Client($url);
            $response = $client->request('GET');
            $jsonData = ($response->getBody());
            echo 'Google Trends';            
            preg_match_all('/(.*)<\/a>/', $jsonData, $trends);
            /** preg_match_all('/(.*)<\/a>/', $jsonData, $trends);**/
             foreach($trends[0] as $trend) {
                echo "{$trend}";
                }

        } catch (Exception $e) {
            echo 'Error' . $e->getMessage();
        }     

Thursday, 22 January 2015

How can delete a user without deleting the post and comments in wordpress?

How can delete a user without deleting the post and comments in wordpress?

In this blog, I will expalin how to delete a user/Editor/Subscriber/Author/Administor without deleting the post and comments. When you start deleting the post application will be prompt that you want to assign the post to another user. To keep the user's post, this you have to assign the deleteing user post to another user.


Follow the following simple steps.
1. Login as Administrator (must be not login to whom you are going to delete).
2. Go to User Listing.
3. Click on check box in front of user to whom you want to delete. See below screenshot.
wordpress admin user listing



4. Click on delete icon. It will bring to you new page.
5. Now assign all post to another user/administrator. See below Screenshot.
wordpress admin user delete page

6. Click on "Confirm Deletion". User deleted successfully.

Now deleting the user, same user wouldn't be able to login to system. If he is currently login will logout automatically.