# Google Classroom

{% embed url="<https://www.youtube.com/watch?t=1174s&v=98LKgphFSCY>" %}

**Google Classroom** add-on is an additional feature created specifically to ease the process of structuring classes and your workflow. With a new function, you can connect your Google Classroom account with your website and import the needed classes. Students will get a special code to enter the right class.

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FpMu8vyCiu5zBWZtaO4Ki%2Fimage.png?alt=media&#x26;token=02c46155-befc-4aed-8f06-e47e1502ac72" alt=""><figcaption><p>WP Dashboard > MS LMS > Pro Addons</p></figcaption></figure>

{% hint style="info" %}
To successfully use this feature, you need **PHP version 7.2** or higher.
{% endhint %}

## How to get API Credentials <a href="#how-to-get-api-credentials" id="how-to-get-api-credentials"></a>

Firstly, you need to create an app in the **Google Console** to get credentials.&#x20;

{% stepper %}
{% step %}
Follow to <https://console.developers.google.com/apis/credentials> to open the Google Developers Console:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FNUdxT2q9GNXuMhBTMIO4%2Fimage.png?alt=media&#x26;token=bf09c2d3-a776-4766-93af-db950698827a" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
You can use the existing projects or create a new project to keep your console organized.&#x20;

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FBWxAiiw5vZU9htPTtlD1%2Fimage.png?alt=media&#x26;token=c0acff1a-7453-4615-a99c-311cc239cb78" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
A new project can easily be created simply by providing its name.
{% endhint %}
{% endstep %}

{% step %}
On the Credentials page,  click on the **Create Credentials** button.&#x20;

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2F5W8rcCT7br0TceJTV6EP%2Fimage.png?alt=media&#x26;token=8c12c2fb-7300-402c-9f78-c0e41b5989f7" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
From the dropdown menu, select the option **OAuth Client ID**.

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FqLLyQXjIXDIAKjHLKTl5%2Fimage.png?alt=media&#x26;token=b278fde3-263a-4b17-904b-e56181a8caa3" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
On the opened page:

* choose  the application type as **Web Application**;
* give a **name** to it (eg, *Google Classroom for MS LMS*)
* click on the **Add URI** button on the **Authorized redirect URIs** section

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FFDdg5j4APOlGtvJxPw4h%2Fimage.png?alt=media&#x26;token=b32c6537-9899-44d2-b2ee-adb3550b3036" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Now we have to get the Redirect URI from MasterStudy LMS. Go back to the admin panel of your website, and follow **WP Dashboard > MS LMS > Addons > Google Classroom** and click on the :gear: gear icon. It opens the addon settings.

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FlFwWjV5rjxH9RdhHsfvA%2Fimage.png?alt=media&#x26;token=b0a7d306-05e0-4188-bbfe-3852509c6adc" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
At the top of the opened page, you will find the Redirect URI Link. Kindly copy it:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FUPstUBa4NSFkXl35Nevn%2Fimage.png?alt=media&#x26;token=cfa7033c-78e4-4c1e-a1c7-a1c477760c06" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Paste this link to the designated area and click on the **Create** button:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2F38k01PB0zTrzgNfn36MD%2Fimage.png?alt=media&#x26;token=d2753870-fa10-4a66-8706-91eb03a1fc41" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Usually, it will take several seconds to process. However, it may take 5 minutes to a few hours forthe  settings to take effect
{% endhint %}
{% endstep %}

{% step %}
The following messages confirm that you have created the **OAuth Client** successfully. You can see the **Client ID** and **Secret key** here as well:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2Fh9veeHM8kVAiQNIESvPw%2Fimage.png?alt=media&#x26;token=281c8aaa-a3f0-4bea-ad9a-dd613a603831" alt=""><figcaption></figcaption></figure>

Later you can find this key in the same (Credentials) page by following this:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2F22QlO5GmJjW31xlOwpJ1%2Fimage.png?alt=media&#x26;token=595f1fc7-d480-445a-8f07-167974dc02af" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Download the JSON File

Now we have to download the **JSON** file of our **OAuth Client**. Click on the **download** :arrow\_down: button to do it:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FxFCnR7qh3qH5sJhfao6I%2Fimage.png?alt=media&#x26;token=7c349433-8966-4990-a03f-e7465f0975fc" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Now API for the Google Classroom service should be enabled. Find the Library menu on the **APIs & Services:**.

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FbqGHgu6FtLT6LYsZZb42%2Fimage.png?alt=media&#x26;token=d209a50e-f7b9-4e0c-ab00-df6c049b4e95" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Using the search bar, search for the **Google Classroom** and choose it:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FN5Q0vcLVvPbYv8SBoubY%2Fimage.png?alt=media&#x26;token=25b7823b-654c-4b9d-b00b-cddf5e3ad05b" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Click on the Enable button to enable it:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FRTyCjyART18JD4WTZCno%2Fimage.png?alt=media&#x26;token=d4a9b1d9-b029-4f90-b386-49ab5aa4d5bc" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
That's it. We have successfully obtained our working credentials to use for **Google Classroom.**
{% endhint %}
{% endstep %}
{% endstepper %}

## Importing Google Classrooms <a href="#importing-google-classrooms" id="importing-google-classrooms"></a>

Importing existing Google Classrooms is also a straightforward action.

{% stepper %}
{% step %}
Follow **WP Dashboard > Classrooms> Import Classrooms** and upload the [**downloaded JSON file**](https://docs.stylemixthemes.com/masterstudy-lms/lms-pro-addons/google-classroom#download-the-json-file)**,** then click on the **Load Credentials** button:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FLg9nHUy3FNIZdSDOAqjB%2Fimage.png?alt=media&#x26;token=c99691bc-2f66-4b10-81bf-816c3ad353f0" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Now, we need to get an access token. Click on the **Get Access Token** button. You will be offered to select the needed profile in the popup window. Sign in to move to your app and you will be redirected back to the **Import Classrooms** page.&#x20;

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2Fvc5lHDMGKUNyXWJWCVyN%2Fimage.png?alt=media&#x26;token=0d058a73-b4c0-43be-a2f2-734579dd78bf" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Now you can see all the classes available in your Google account. You can import all classes or select just several and publish them.

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2F91ZyxFCU4lut06AFHN7K%2Fimage.png?alt=media&#x26;token=8a170f77-3cc5-49d0-81e7-b70d9f84676c" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

Once the classrooms are imported and published, you can see them on the Google Classroom Archive Page:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FVOhh5N2FovxCh5gIbo6T%2Fimage.png?alt=media&#x26;token=2683dc65-31c5-40c8-849c-ac64210f8c71" alt=""><figcaption></figcaption></figure>

Students can find the course codes to enter the required class.

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2F4BtWsywdvhlK8DaaiPIV%2Fimage.png?alt=media&#x26;token=da29b34d-628d-4fc4-b5ed-723c3eca71e0" alt=""><figcaption><p>Google Clasroom Page</p></figcaption></figure>

## Addon Settings <a href="#googleclassroom-enablingpopup" id="googleclassroom-enablingpopup"></a>

You can find the addon settings in the [Imported Classrooms ](#user-content-fn-1)[^1]page:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FyE3iuPFqUN0x05nXKGyM%2Fimage.png?alt=media&#x26;token=acad8ef6-9ee9-48b8-b4b8-4b849cd490b4" alt=""><figcaption></figcaption></figure>

* **Only signed-in students will see the code** - enable this option so that only students who are signed in will see the Google Classroom code

### Enabling Popup <a href="#googleclassroom-enablingpopup" id="googleclassroom-enablingpopup"></a>

This setting lets you display a modal pop-up notice about the available Google Classrooms on your website when users visit. It occurs only on the first visit.&#x20;

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2F77gqkBq8LGUbj3Z94Yue%2Fimage.png?alt=media&#x26;token=2166bd65-ceed-49d9-9d3f-358f38e75a66" alt=""><figcaption></figcaption></figure>

Here are the available settings:

* **Popup Title** - provide a title for the pop-up.
* **Popup Editor** - write down the brief description of the classrooms feature and describe why they are necessary. You can write whatever you want and design it using the special text editor.
* **Popup Image** - indicate the image that will be used to display on the pop-up. Once the user clicks on the image, it brings users to the special page that you specified.
* **Google Classrooms page** - indicate the URL of the page that users will be directed to by clicking the Pop-up Image. You can also use the link on the classes page on your Google Classroom account.

## Google Clasroom Elementor Widget

You can customize the Google Classroom page using the special widget for Elementor.&#x20;

{% stepper %}
{% step %}
Open the page that you want to specify as a Google Classroom page using Elementor:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FhhetMSxATg5UMWexqP0h%2Fimage.png?alt=media&#x26;token=f88975d4-a405-4c9f-bd7e-71c3584321e8" alt=""><figcaption><p>WP Dashborad > Pages > All Pages > Edit with Elementor</p></figcaption></figure>
{% endstep %}

{% step %}
Search for '**Google Classrooms**' and add the widget to the desired place according to your needs:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FUa1flJswCge1NAxLYFSL%2Fimage.png?alt=media&#x26;token=74f3225e-b156-443f-96b0-eb75c30f680b" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
You can provide the title for the Grid and indicate the number of the items (classes) that need to be displayed:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FpkPiiQR6uUIva2NLlMvO%2Fimage.png?alt=media&#x26;token=8cc850e4-7c76-4761-9c18-2e59f1c4461d" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Once you are finished, you can publish/update the page:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FsfgTUqenl1kFatt02kBc%2Fimage.png?alt=media&#x26;token=748077f1-61f8-4fb3-a972-1c8a477e2749" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## Google Classroom WP Backery Widget

Similar to the [**Elementor widget**](#google-clasroom-elementor-widget), there is a special Google Classroom widget for WP Backery for users who prefer the WP Backery Page builder.

{% stepper %}
{% step %}
Edit the page that you want to specify as a Google Classroom page with WP Backery, and click on **Add Element**:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2F7Dl59IPYYh1RMbJdFslC%2Fimage.png?alt=media&#x26;token=cfe96aaf-35a4-41ad-aa30-d4cee267ca29" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Search for '**Google Classrooms**' and add it to your page:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2FfqyfaAaiIJnv1RtZiHlj%2Fimage.png?alt=media&#x26;token=f1e0f332-a73b-4eb0-8835-7b4007dde737" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
You can provide the title for the widget and indicate the number of the items (classes) that need to be displayed, then update/publish the page:

<figure><img src="https://2021837383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDO9V_qgvV5cQdw04iz%2Fuploads%2F4SVqAx7MxzE8zQ87i9XA%2Fimage.png?alt=media&#x26;token=d39f5149-f150-497c-a859-592dee714ca3" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

[^1]: WP Dashboard > Classrooms > Importeed Classrooms
