瀏覽代碼

Bumped version to 0.0.42

Jannick Knudsen 4 年之前
父節點
當前提交
37dbc442f5
共有 5 個文件被更改,包括 49 次插入20 次删除
  1. 1 1
      VERSION
  2. 1 0
      VERSIONLOG
  3. 1 1
      package.json
  4. 44 16
      plug_login.php
  5. 2 2
      plugin.php

+ 1 - 1
VERSION

@@ -1 +1 @@
-v0.0.41
+v0.0.42

+ 1 - 0
VERSIONLOG

@@ -40,3 +40,4 @@ v0.0.38
 v0.0.39
 v0.0.40
 v0.0.41
+v0.0.42

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "dagsplug",
-  "version": "0.0.41",
+  "version": "0.0.42",
   "description": "",
   "main": "script_backend.js",
   "scripts": {

+ 44 - 16
plug_login.php

@@ -151,6 +151,16 @@ if (!class_exists("plug_login")) {
 			}
 		}
 
+		function get_page_by_name($post_name, $output = OBJECT) {
+			global $wpdb;
+			$post = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type='page'", $post_name));
+			if ($post) {
+				return get_post($post, $output);
+			}
+
+			return null;
+		}
+
 		function l_stylesheet_directory_uri($t) {
 			return str_replace(WP_SITEURL, WP_SITEURL_CDN, $t);
 		}
@@ -211,7 +221,25 @@ if (!class_exists("plug_login")) {
 									<p>';
 
 			if (isset($_GET['action'])) {
-				$str .= get_option($this->pluginname . "_login_support_splash_" . $_GET['action'], false);
+				$type = isset($_GET['type']) ? $_GET['type'] : 'default';
+
+				if ($type !== "default") {
+
+					//print_r($args);
+					$page = $this->get_page_by_name($type);
+
+					if ($page) {
+						$str .= apply_filters('the_content', $page->post_content);
+
+					} else {
+						$str .= get_option($this->pluginname . "_login_support_splash_" . $_GET['action'], false);
+
+					}
+
+				} else {
+					$str .= get_option($this->pluginname . "_login_support_splash_" . $_GET['action'], false);
+
+				}
 			} else {
 				$str .= get_option($this->pluginname . "_login_support_splash", false);
 			}
@@ -228,15 +256,15 @@ if (!class_exists("plug_login")) {
 }
 
 		function login_head() {
-			$type = (empty($_REQUEST['type']) || !($_REQUEST['type'] == "Select" || $_REQUEST['type'] == "Pro")) ? " " : $_REQUEST['type'];
-			if ($type !== "") {
+			$type = isset($_GET['type']) ? $_GET['type'] : 'default';
+			if ($type !== "default") {
 				?>
 		<script type='text/javascript' src='/wp-includes/js/jquery/jquery.js?ver=1.4.2'></script>
 		<script type="text/javascript">
 			jQuery(document).ready(function(){
 				if(jQuery("form").length>0 && jQuery("form").attr('action').indexOf('register')>-1){
 					console.log("SPECIAL REGV");
-					jQuery("form").prepend('<h3><?php echo ($type) ?></h3><br>');
+					//jQuery("form").prepend('<h3><?php echo ($type) ?></h3><br>');
 					jQuery("p:contains('Brugernavn')").hide();
 
 					jQuery("#user_email").attr("tabindex","24")
@@ -284,7 +312,7 @@ if (!class_exists("plug_login")) {
 		}
 
 		function plugin_form() {
-			$type = "Perspektiv"; //;(empty($_REQUEST['type']) || !($_REQUEST['type'] == "Select" || $_REQUEST['type'] == "Pro")) ? "Select" :  $_REQUEST['type'];
+			$type = isset($_GET['type']) ? $_GET['type'] : 'default';
 
 			//19094	__system_side_medlem_af
 			//$tt = get_post( 19094);
@@ -296,15 +324,16 @@ if (!class_exists("plug_login")) {
 
 			$arr = explode("\n", get_option($this->pluginname . "_login_groups", false));
 
-			$sel = '<select name="r_membership" id="r_membership" class="input nnl"  tabindex="26">';
-			$sel .= '<option ' . ((!isset($_POST['r_membership']) || $_POST['r_membership'] === "") ? "selected" : "") . '>Vælg </option>';
-			foreach ($arr as $ii => $title) {
-				if (strlen($title) > 3) {
-					$sel .= '<option value="' . $title . '" ' . (isset($_POST['r_membership']) && $_POST['r_membership'] === $title ? "selected" : "") . '>' . $title . '</option>';
-				}
-			}
-			$sel .= '</select>';
-
+/*			$sel = '<select name="r_membership" id="r_membership" class="input nnl"  tabindex="26">';
+$sel .= '<option ' . ((!isset($_POST['r_membership']) || $_POST['r_membership'] === "") ? "selected" : "") . '>Vælg </option>';
+foreach ($arr as $ii => $title) {
+if (strlen($title) > 3) {
+$sel .= '<option value="' . $title . '" ' . (isset($_POST['r_membership']) && $_POST['r_membership'] === $title ? "selected" : "") . '>' . $title . '</option>';
+}
+}
+$sel .= '</select>';
+ */
+			$sel = '<input type="hidden" name="r_membership" id="r_membership" value="' . $type . '">';
 			$html = '
  			<style type="text/css">
  				.nnl {
@@ -335,9 +364,8 @@ if (!class_exists("plug_login")) {
 
 
  					<p>
- 						<label style="display: block; margin-bottom: 5px;">' . __('Vælg', 'Vælg') . '
  								' . $sel . '
-					</label>
+
 					</p>
 
 

+ 2 - 2
plugin.php

@@ -4,7 +4,7 @@ Plugin Name: dagsopt
 Plugin URI: https://git.tum.dk/tum.dk/dagsplug/
 Description: Tools
 Author: iskedk
-Version: 0.0.41
+Version: 0.0.42
 Date: 2021-01-14
 Author URI: https://iske.dk/
 Text Domain: dagsopt
@@ -17,7 +17,7 @@ function wppluginspage() {
 $wp_dagsopt = new dagsopt();
 
 class dagsopt {
-	var $version = "0.0.41";
+	var $version = "0.0.42";
 	var $publish_date = "2021-01-14";
 	var $pluginname;
 	var $plugintitle;