Fetch Gmail user information for social login purpose

Hello friends,

To simplify the user signup and login process the use of social login is increasing day by day. Taking this fact in mind here I will discuss about how to fetch Gmail user information for social login purpose.

To fetch Gmail user information we have to use Google API and to access Google API we have to use OAuth 2.0.

Before starting the process of fetching Gmail user information we must register our application through the  Google APIs Console. This registration process accommodates both Google and our application by set of values, like client_id, client_secret, JavaScript orgins, redirect_uri, etc.

Now the process starts from redirecting a user to Google with a set of query string variables to indicate the type of Google API access the user wants. After that Google performs the user authentication and consent, and it returns the access token as a response.

The process of fetching Gmail user information can succeed only if we access a Google API after receiving the access token and validating it.

Now above is the basic process to get Gmail user personal information, but as a developer we have to implement this process by coding. In coding you have to perform the steps given in the below link.


Hope this will help you.


Basics to create a custom module in magento

1. How to create a module


The first directory we will create is a “namespace.” This can be called anything you like, but the convention is some form of the name of the company or module’s author.
So, create the directory app/code/local/[namespace]

Create the directory app/code/local/[namespace]/[module name].
Module name should be according to functionality of our module.
We should now have the following directory structure for our module. These directory and file names are case-sensitive, so capitalize where appropriate.

  - code
      - local
          - [namespace]
              - [modulename]

2. Configure our module

Next, we will begin to configure our module. The configuration files belong inside our module in a directory named etc.
Now, we will create a simple config.xml file, which contains following code:

<?xml version="1.0" encoding="UTF-8"?>
	<!-- The root node for Magento module configuration -->
	        The module's node contains basic 
	        information about each Magento module
	            This must exactly match the namespace and module's folder
	            names, with directory separators replaced by underscores
	            <!-- The version of our module, starting at 0.0.1 -->
	        </ namespace_modulename >

3. Activating Our Module

The next step is to inform our Magneto installation that our module exists, which we do by creating a new XML file in app/etc/modules.
The name of this XML file can be anything you like but it is preferable that we use like below
Let’s create app/etc/modules/[namespace_modulename].xml with the following content:

<?xml version="1.0" encoding="UTF-8"?>

            <!-- Whether our module is active: true or false -->

            <!-- Which code pool to use: core, community or local -->


How to increase the History in Photoshop?

You may be already gone through that bad feeling of clicking “undo” many times but you have realized that Photoshop don’t provide you that many steps you need to get back but this problem can be easily solved by changin History States setting from “Edit > Preferences > Performance”menu.

There are many efficient ways of going back & forward in your projects like using the “Snapshots” feature, which are essentially confortable of your work that you can go back to. If you use Undo a lot and thinking of adding more History States then set it around ’30’ and be aware that adding too many History States on a single image will normally relsult in using so much RAM & if you have less than 2 GB of RAM then you should not use that Undo feature often!

Note: you can add upto 1000 History State levels in Photoshop

How To Get The New Google Bar

There are two way to get the New Google Bar:

1) For Google Chrome:

  1. Go get this extension to change cookies. http://bit.ly/rEmD2O
  2. Load Google.com and right-click to edit the cookies.
  3. Change “PREF” to this:
  4. Don’t forget to save your changes at the bottom.
  5. Reload and you have the new Google bar.

2) For other browsers:

  1. Launch http://www.google.com in Chrome, Firefox or Internet Explorer 8+.
  2. Open “Dev Mode” by pressing – if using Firefox : Ctrl+Shift+K(or F12), if Google Chrome : Ctrl+Shift+J(or F12), and If Internet Explorer : F12 and selecting the “console” tab.
  3. In the developer tools console paste :document.cookie=”PREF=ID=03fd476a699d6487:U=88e8716486ff1e5d: FF=0:LD=en:CR=2:TM=1322688084:LM=1322688085:S=McEsyvcXKMiVfGds; path=/; domain=.google.com”;window.location.reload();

    and hit enter.

  4. Reload Google website and enjoy the new layout, If you’re not in the US then replace “.google.com” with your domain in the code above (for example: “.google.co.uk” or “.google.co.in”).

If you’re successful you’re new Google Bar would be like this…Get New Google Bar

How to fix the Internet Explorer warning – “Do you want to view only the webpage content that was delivered securely?”?

Before few days we have found a problem in our developed site, that it doesn’t display SSL in secure pages like login or checkout, and specially in Internet Explorer it displays warning – “Do you want to view only the webpage content that was delivered securely?”.
While searching this problem in the internet we have found that, this problem can be arise by using HTTP based resources, such as images, CCS or Javascript on a secure HTTPS page.
To solve or avoid this problem we have to remove or avoid the use of mixed content (HTTP and HTTPS) on HTTPS secure pages, because it often becomes an issue when using third party services such as Analytics or Content Delivery Networks (CDN).
For Example, we have to avoid the use of Google hosted Ajax libraries on our site until Google added HTTPS support.

Change The Pasteboard Color In Photoshop

First  select Photoshop’s Paint Bucket Tool from the Tools palette. By default, it’s hiding behind the Gradient Tool  so you’ll need to click and hold on the Gradient Tool for a moment until a fly-out menu appears  then select the Paint Bucket Tool from the fly-out menu

Next, click on the Foreground color swatch in the Tools palette.

This brings up Photoshop’s Color Picker. Select whaterver color you want to use for the pasteboard. I’ll choose a shade of red.

Click OK once you’ve chosen a color to exit out of the Color Picker. Move your mouse cursor into the pasteboard area  hold down your Shift key  and click on the pasteboard. Instantly  the pasteboard changes to the new color.

How to upload file using php?

Once I had a requirement to upload a file using php.
For that I used following sample code.

 <form name="newad" method="post" enctype="multipart/form-data">
 	<tr><td><input type="file" name="txtUploadFile" id="txtUploadFile"></td></tr>
 	<tr><td><input name="btnSubmit" id="btnSubmit" type="submit" value="Upload image"></td></tr>

  if (isset($_POST['btnSubmit']))
    if ($_FILES["txtUploadFile"]["error"] > 0)
      echo "Error: " . $_FILES["txtUploadFile"]["error"] . "<br />";
	  move_uploaded_file($_FILES["txtUploadFile"]["tmp_name"], "images/" . $_FILES["txtUploadFile"]["name"]);
	  echo "<h1>File Uploaded Successfully.</h1>";