Anyone know of resources re: error messages/notifications with Ghost Members.
I am wanting to show a Bootstrap alert with the notification in when members signup/login.
Any help or push in the right direction would be much appreciated. Thanks.
Hey there.
You might benefit from taking a look at our Lyra theme, which uses Members and taps into the sign in states that can be pulled out of the URL parameters:
{{!-- Scripts for Members subscription --}}
<script>
// Parse the URL parameter
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
// Give the parameter a variable name
var action = getParameterByName('action');
var stripe = getParameterByName('stripe');
var success = getParameterByName('success');
$(document).ready(function () {
This file has been truncated. show original
The JavaScript then conditionally shows these different notifications depending on the Member signed in state
<div class="notification notification-subscribe">
<a class="notification-close" href="javascript:;"></a>
You've successfully subscribed to {{@site.title}}
</div>
<div class="notification notification-signup">
<a class="notification-close" href="javascript:;"></a>
Great! Next, complete checkout for full access to {{@site.title}}
</div>
<div class="notification notification-signin">
<a class="notification-close" href="javascript:;"></a>
Welcome back! You've successfully signed in.
</div>
<div class="notification notification-signin-failure">
<a class="notification-close" href="javascript:;"></a>
Unable to sign you in. Please try again.
</div>
This file has been truncated. show original
1 Like
Thanks, I’ll give this a try
1 Like
Thanks David, I’ve got that working!
1 Like