Skip to content

Instantly share code, notes, and snippets.

View wpo365's full-sized avatar

WPO365 wpo365

View GitHub Profile
@wpo365
wpo365 / loading-template.html
Created October 4, 2020 19:25
Exemplary template to change the loading template to replace the default loading bars that users will see when the WordPress + Office 365 plugin redirects them to Microsoft (see https://docs.wpo365.com/article/114-customize-the-loading-template for details)
<style>
.lds-grid{display:inline-block;position:relative;width:80px;height:80px}.lds-grid div{position:absolute;width:16px;height:16px;border-radius:50%;background:#000;animation:lds-grid 1.2s linear infinite}.lds-grid div:nth-child(1){top:8px;left:8px;animation-delay:0s}.lds-grid div:nth-child(2){top:8px;left:32px;animation-delay:-.4s}.lds-grid div:nth-child(3){top:8px;left:56px;animation-delay:-.8s}.lds-grid div:nth-child(4){top:32px;left:8px;animation-delay:-.4s}.lds-grid div:nth-child(5){top:32px;left:32px;animation-delay:-.8s}.lds-grid div:nth-child(6){top:32px;left:56px;animation-delay:-1.2s}.lds-grid div:nth-child(7){top:56px;left:8px;animation-delay:-.8s}.lds-grid div:nth-child(8){top:56px;left:32px;animation-delay:-1.2s}.lds-grid div:nth-child(9){top:56px;left:56px;animation-delay:-1.6s}@keyframes lds-grid{0%,100%{opacity:1}50%{opacity:.5}}
.centered{height: 80px;position: absolute;left: 50%;top: 50%;transform: translate(-50%, -50%);}
</style>
<div class="lds-grid centered"><div></div><div></div><div
@wpo365
wpo365 / wpo365-samesite.php
Last active January 15, 2024 05:59
Plugin for WordPress websites that require a user to sign in (e.g. with Microsoft) and that are loaded inside an iframe (e.g. inside a Microsoft Teams App / Tab or similar). The plugin overrides the pluggable WordPress function wp_set_auth_cookie to set SameSite=None to enable third-party usage.
<?php
/**
* Plugin Name: WPO | SAMESITE
* Plugin URI: https://www.wpo365.com/downloads/wordpress-office-365-samesite/
* Description: Plugin for WordPress websites that require a user to sign in (e.g. with Microsoft) and that are loaded inside an iframe (e.g. inside a Microsoft Teams App / Tab or similar). The plugin overrides the pluggable WordPress function wp_set_auth_cookie to set SameSite=None to enable third-party usage.
* Version: 1.0
* Author: support@wpo365.com
* Author URI: https://www.wpo365.com/
* License: GPL2+
*/
@wpo365
wpo365 / contacts.intranet.list.template.html
Created May 25, 2020 19:56
Default Handlebars template that can be used (and customized) when a Microsoft Graph based Org Chart app in a WordPress page or post using the WPO365 (WordPress + Office 365) plugin (see https://www.wpo365.com/working-with-handlebars-templates/ for details).
<content>
<script id="jshelpers">
</script>
<header id="header" type="x-handlebars-template">
<style>
.pintraContacts,
.pintraContactsResults {
box-sizing: border-box;
font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
}
@wpo365
wpo365 / yammer.feed.template.html
Created May 25, 2020 19:54
Default Handlebars template that can be used (and customized) when embedding a Yammer feed in WordPress page or post using the WPO365 (WordPress + Office 365) plugin (see https://www.wpo365.com/working-with-handlebars-templates/ for details).
<content>
<script id="jshelpers">
if (!!window.wpo365
&& 'registerHandlebarsHelper' in window.wpo365
&& 'handlebarsSafeString' in window.wpo365
&& 'moment' in window.wpo365) {
window.wpo365.registerHandlebarsHelper('formatSummary',
function (summary) {
return window.wpo365.handlebarsSafeString(
summary
@wpo365
wpo365 / wpo365-hooks.php
Last active June 6, 2023 08:15
An example of a plugin that hooks into the various WPO365 login hooks and filters. See https://docs.wpo365.com/article/82-developer-hooks for details.
<?php
/**
* Plugin Name: WPO365 Hooks (samples)
* Plugin URI: https://www.wpo365.com/downloads/wordpress-office-365-hooks/
* Description: An example of a plugin that hooks into the various WPO365 login hooks.
* Version: 0.5
* Author: marco@wpo365.com
* Author URI: https://www.wpo365.com
* License: GPL2+
*/
@wpo365
wpo365 / cbs.intranet.events.template.html
Last active April 19, 2020 18:19
Example of a Handlebars template that can be used (and customized) when surfacing calendar events as tabular data from a Microsoft SharePoint Online search query result in WordPress using the WPO365 (WordPress + Office 365) plugin (see https://www.wpo365.com/ for details).
<content>
<script id="jshelpers">
if (!!window.wpo365
&& 'registerHandlebarsHelper' in window.wpo365
&& 'handlebarsSafeString' in window.wpo365
&& 'moment' in window.wpo365) {
window.wpo365.registerHandlebarsHelper('formatSummary',
function (summary) {
return window.wpo365.handlebarsSafeString(
summary
@wpo365
wpo365 / functions.php
Last active April 27, 2020 19:37
Add a Sign in with Microsoft button to your (default or custom) WordPress login form. See https://docs.wpo365.com/article/74-add-sign-in-with-microsoft-button-to-a-wordpress-login-form for details.
add_action( 'login_form', 'sign_in_with_microsoft', 10, 1 );
function sign_in_with_microsoft( $input = '' ) {
?>
<!-- For details visit https://docs.wpo365.com/article/74-add-sign-in-with-microsoft-button-to-a-wordpress-login-form -->
<div>
<style>
.wpo365-mssignin-wrapper {
box-sizing: border-box;
display: block;
@wpo365
wpo365 / wordpress.displayerrormessage.shortcode
Created November 22, 2019 16:06
WordPress + Office 365 "Display error message" shortcode for WordPress (for details see https://www.wpo365.com/error-page/)
[wpo365-display-error-message-sc]
@wpo365
wpo365 / ed.intranet.list.template.html
Created November 22, 2019 06:45
Default Handlebars template that can be used (and customized) when surfacing Microsoft Graph user results in WordPress using the WPO365 (WordPress + Office 365) plugin (see https://www.wpo365.com/working-with-handlebars-templates/ for details).
<content>
<script id="jshelpers">
</script>
<header id="header" type="x-handlebars-template">
<style>
.pintraItemCell {
position: relative;
outline: transparent;
min-height: 54px;
padding: 10px;
@wpo365
wpo365 / cbs.intranet.list.template.html
Last active November 22, 2019 06:44
Default Handlebars template that can be used (and customized) when surfacing SharePoint Online search results in WordPress using the WPO365 (WordPress + Office 365) plugin (see https://www.wpo365.com/working-with-handlebars-templates/ for details).
<content>
<script id="jshelpers">
if (!!window.wpo365
&& 'registerHandlebarsHelper' in window.wpo365
&& 'handlebarsSafeString' in window.wpo365
&& 'moment' in window.wpo365) {
window.wpo365.registerHandlebarsHelper('formatSummary',
function (summary) {
return window.wpo365.handlebarsSafeString(
summary