Fix custom access settings and redirection

This commit is contained in:
champsupertramp
2016-09-07 17:07:51 +08:00
parent 48eb28bfc4
commit 78bd045dc1
2 changed files with 128 additions and 47 deletions
+24 -6
View File
@@ -11,9 +11,10 @@ class UM_Access {
}
/***
*** @do actions based on priority
***/
/**
* Set custom access actions and redirection
*/
function template_redirect() {
global $post, $ultimatemember;
@@ -44,9 +45,12 @@ class UM_Access {
}
/***
*** @get meta
***/
/**
* Get custom access settings meta
* @param integer $post_id
* @return array
*/
function get_meta( $post_id ) {
global $post;
$meta = get_post_custom( $post_id );
@@ -64,4 +68,18 @@ class UM_Access {
return array('');
}
/**
* Sets a custom access referer in a redirect URL
* @param string $url
* @param string $referer
*/
function set_referer( $url, $referer ){
$enable_referer = apply_filters("um_access_enable_referer", false );
if( ! $enable_referer ) return $url;
$url = add_query_arg('um_ref',$referer, $url);
return $url;
}
}