Skip to content

Commit

Permalink
Merge branch 'donor_portal_links' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
tamw-wnet committed Dec 8, 2023
2 parents dbdfe6b + b409f53 commit b7fc0c6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
12 changes: 10 additions & 2 deletions assets/js/jquery.pids.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jQuery(document).ready(function($) {
var station_call_letters_lc = 'wnet';
var learnmorelink = '/passport/';
var vppalink = '/pbsoauth/vppa/';
var portallink = '';

if (typeof pbs_passport_authenticate_args !== "undefined"){
authenticate_script = pbs_passport_authenticate_args.laas_authenticate_script;
Expand All @@ -21,6 +22,9 @@ jQuery(document).ready(function($) {
if (typeof pbs_passport_authenticate_args.vppalink !== "undefined"){
vppalink = pbs_passport_authenticate_args.vppalink;
}
if (typeof pbs_passport_authenticate_args.portallink !== "undefined"){
portallink = pbs_passport_authenticate_args.portallink;
}
}

/* in case the loginform url has no protocol */
Expand Down Expand Up @@ -197,8 +201,12 @@ jQuery(document).ready(function($) {

if ($(".pbs_passport_authenticate div.messages-new")[0]){
// new version of messages with drop down menu...
if (user.thumbnail_URL) {thumbimage = "<span><img src='" + user.thumbnail_URL + "' alt='' /></span>";}
welcomestring = '<a href="#" class="toggle-user-drop userlink">' + thumbimage + '<span class="name">' + user.first_name + '</span></a> <ul class="user-drop"><li><a href="' + userinfolink + '">USER STATUS</a></li><li><a class="signout">SIGN OUT</a></li></ul>';
if (user.thumbnail_URL) {thumbimage = "<span><img src='" + user.thumbnail_URL + "' alt='' /></span>";}
portal_list_entry = '<li><a href="' + userinfolink + '">YOUR ACCOUNT</a></li>';
if (portallink.length > 0) {
portal_list_entry= '<li><a href="' + portallink + '">MEMBER PORTAL</a></li>';
}
welcomestring = '<a href="#" class="toggle-user-drop userlink">' + thumbimage + '<span class="name">' + user.first_name + '</span></a> <ul class="user-drop">'+ portal_list_entry + '<li><a class="signout">SIGN OUT</a></li></ul>';
$('.pbs_passport_authenticate div.messages-new').html(welcomestring);

if (typeof makeNavObserverPids == 'function') {
Expand Down
1 change: 1 addition & 0 deletions classes/class-pbs-passport-authenticate-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function register_settings() {
add_settings_field( 'join_url', 'Join/Donate URL', array( $this, 'settings_field'), 'pbs_passport_authenticate', 'general_settings', array('setting' => 'pbs_passport_authenticate', 'field' => 'join_url', 'class' => 'regular-text', 'label' => 'Link to the specific donate form people should be directed to from the login screen.' ) );
add_settings_field( 'watch_url', 'Watch Programs URL', array( $this, 'settings_field'), 'pbs_passport_authenticate', 'general_settings', array('setting' => 'pbs_passport_authenticate', 'field' => 'watch_url', 'class' => 'regular-text', 'label' => 'Link to your watch programs landing page.' ) );
add_settings_field( 'landing_page_url', 'Post-Login Landing Page URL', array( $this, 'settings_field'), 'pbs_passport_authenticate', 'general_settings', array('setting' => 'pbs_passport_authenticate', 'field' => 'landing_page_url', 'class' => 'regular-text', 'label' => 'URL a member is sent to after successfully logging in if not clicking in from a video page (or some other page that sets the "login_referrer" cookie). Defaults to your site home page.' ) );
add_settings_field( 'donor_portal_url', 'Donor Portal URL', array( $this, 'settings_field'), 'pbs_passport_authenticate', 'general_settings', array('setting' => 'pbs_passport_authenticate', 'field' => 'donor_portal_url', 'class' => 'regular-text', 'label' => 'URL for your Donor Portal. Leave blank if you do not have a donor portal.' ) );


add_settings_section('pbslaas_settings', 'PBS LAAS settings', array( $this, 'settings_section_callback'), 'pbs_passport_authenticate');
Expand Down
5 changes: 3 additions & 2 deletions classes/class-pbs-passport-authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct($file) {
$this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/', $file ) ) );
$this->token = 'pbs_passport_authenticate';
$this->defaults = get_option($this->token);
$this->version = '0.3.1.5';
$this->version = '0.3.2.0';

// Load public-facing style sheet and JavaScript.
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
Expand Down Expand Up @@ -118,9 +118,10 @@ public function do_shortcode( $atts ) {
$args['userinfolink'] = site_url('pbsoauth/userinfo/');
$args['vppalink'] = site_url('pbsoauth/vppa/');
$args['station_call_letters_lc'] = strtolower($defaults['station_call_letters']);
$args['portallink'] = !empty($defaults['donor_portal_url']) ? $defaults['donor_portal_url'] : '';
$json_args = json_encode($args);
$button = '<div class="pbs_passport_authenticate"><button class="launch">' . $args['login_text'] . '</button><div class="messages"></div></div>';
$jsonblock = '<script language="javascript">var pbs_passport_authenticate_args = ' . $json_args . ' </script>';
$jsonblock = '<script language="javascript">var pbs_passport_authenticate_args = ' . $json_args . '; </script>';
$style = '';
$return = '';
if ($render == 'all'){
Expand Down
2 changes: 1 addition & 1 deletion pbs-passport-authenticate.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
* Plugin Name: PBS Passport Authenticate
* Version: 0.3.1.5 -- cleanup PHP warnings
* Version: 0.3.2.0 -- donor portal link support
* Plugin URI: https://github.com/tamw-wnet/pbs-passport-authenticate
* Description: PBS Passport Authenticate
* Author: William Tam, Brian Santalone
Expand Down
4 changes: 3 additions & 1 deletion templates/userinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
$station_nice_name = $defaults['station_nice_name'];
$join_url = $defaults['join_url'];
$watch_url = $defaults['watch_url'];

$donor_portal_url = trim($defaults['donor_portal_url']);


echo "<div class='passport-username'><strong>MEMBER:</strong> " . $userinfo['first_name'] . " " . $userinfo['last_name'] . "</div>";
Expand All @@ -62,6 +62,7 @@

echo "<p class='passport-status'>$station_nice_name Passport <i class='fa fa-check-circle passport-green'></i></p>";
if (!empty($watch_url)) {echo "<div class='activate-options cf'><ul><li class='service-login-link watch'><p><a href='$watch_url'><button class='pp-button-blue'>Watch Programs</button></a></p></li></ul></div>";}
if (!empty($donor_portal_url)) {echo "<div class='activate-options cf'><ul><li class='service-login-link watch'><p><a href='$donor_portal_url'><button class='pp-button-blue'>Member Portal</button></a></p></li></ul></div>";}

}

Expand Down Expand Up @@ -119,6 +120,7 @@
echo "<div class='passport-username'><strong>MEMBER:</strong> " . $userinfo['first_name'] . " " . $userinfo['last_name'] . "</div>";
echo "<p class='passport-status'><strong>STATUS:</strong> Expired <i class='fa fa-times-circle passport-red'></i></p>";
if (!empty($join_url)) {echo "<p>Your $station_nice_name Passport membership has expired. Please renew your $station_nice_name membership to continue enjoying $station_nice_name Passport content.</p><div class='activate-options cf'><ul><li class='service-login-link watch'><a href='$join_url'><button class='pp-button-blue'>Renew Membership</button></a></li></ul></div>";}
if (!empty($donor_portal_url)) {echo "<div class='activate-options cf'><ul><li class='service-login-link watch'><p><a href='$donor_portal_url'><button class='pp-button-blue'>Member Portal</button></a></p></li></ul></div>";}
}


Expand Down

0 comments on commit b7fc0c6

Please sign in to comment.