Skip to content

Instantly share code, notes, and snippets.

@mrcave
Last active December 10, 2015 19:08
Show Gist options
  • Save mrcave/4479282 to your computer and use it in GitHub Desktop.
Save mrcave/4479282 to your computer and use it in GitHub Desktop.
5 secrets for building a powerful members-only area
<a href="/contact?field_92375_1015030=[first]&field_92375_1015031=[last]&field_92375_1015032=[email]">Contact us</a>
<$loginstatus$>
<$loggedin$><strong>Welcome, [first]</strong><$/loggedin$>
<$loggedout$><a href="/login">Click here to login</a><$/loggedout$>
<$/loginstatus$>
http://yoursite.com/login?ReturnUrl=http://yoursite.com/members
<script type="text/javascript">
$(function(){
//Set your return URL here. It should be relative to
//website root and should not include domain name.
var return_url = "/dashboard";
var current_action = $('form[name="frm"]').attr("action");
if(document.location.search.length) {
//query string already exists so we'll just add a return URL on the end with "&"
var query_start = "&";
} else {
//there's no query string yet so we'll create one with "?"
var query_start = "?";
}
new_action = current_action + query_start + "ReturnUrl=" + encodeURIComponent("http://" + document.domain + return_url);
$('form[name="frm"]').attr("action", new_action);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment