Jump to content

oc1ober

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by oc1ober

  1. I use the Code to get the name of the User to login:
    function show_loggedin_function( $atts ) {
    	global $current_user, $user_login;
          	get_currentuserinfo();
    	add_filter('widget_text', 'do_shortcode');
    	if ($user_login) 
    		return 'Welcome ' . $current_user->display_name . '!';
    	else
    		return '<a href="' . wp_login_url() . ' ">Login</a>';
    }
    add_shortcode( 'show_loggedin_as', 'show_loggedin_function' );
    - It works well when inserting into widgets or posts in the form [show_loggedin_as]
    - But when I insert it into Input in the Form, it doesn't work:
    <input name="user" id="u1" type="text" class="field-long" value="[show_loggedin_as]" autocomplete="off"  required="">
    Thanks for watching for me with…Thank you.
  2. I'm Shortcode wordpress but it doesn't work, the purpose is to show the content to designated members...

    For example: in a post or page, Only allow members id1, id7, id25...Visit, And other members cannot view the content, Please edit it for me...

    Thank you.

    add_shortcode( 'userid', 'check_user_id' );
    function check_user_id($atts, $content = null) {
        if(current_user_id) {return '<p>' . $content . '</p>';}
        else {return "";}
    }
    
    [userid_logged_in id = "id1","id7","id25","id27"] 
    Content displayed
    [/userid_logged_in]

     

  3. Hi guys, I am having problems using dynamic data list, It doesn't work when I insert a form into Blogspot, how should I fix it?
    <html>
    <head>
    </head>
    <body contenteditable="false">
    <script>
    function populate(Ts7, Ts8){
    	var Ts7 = document.getElementById(Ts7);
    	var Ts8 = document.getElementById(Ts8);
    	Ts8.innerHTML = "";
    	if(Ts7.value == "Phòng kế hoạch"){
    		var optionArray = ["|","|Phòng kế hoạch"];
    	} else if(Ts7.value == "Bản"){
    		var optionArray = ["|","|Bản1","|Bản2","|Bản3"];
    	} else if(Ts7.value == "Huyện"){
    		var optionArray = ["|","|Huyện1","|Huyện2"];
    	} else if(Ts7.value == "Tỉnh"){
    		var optionArray = ["|","|Tỉnh1","|Tỉnh2"]; 
    	} else if(Ts7.value == "Trung ương"){
    		var optionArray = ["|","|Trung ương1","|Trung ương2"];         
    	}
    	for(var option in optionArray){
    		var pair = optionArray[option].split("|");
    		var newOption = document.createElement("option");
    		newOption.value = pair[0];
    		newOption.innerHTML = pair[1];
    		Ts8.options.add(newOption);
    	}
    }
    </script>
    <p>1. Cấp</p>
    <select name="entry.694698089" id="Ts7" required="" onchange="populate(this.id,'Ts8')">
    <option value="">Chọn</option>
    <option value="Phòng kế hoạch">Phòng kế hoạch</option>
    <option value="Bản">Bản</option>
    <option value="Huyện">Huyện</option>
    <option value="Tỉnh">Tỉnh</option>
    <option value="Trung ương">Trung ương</option>
    </select>
      
    <p>2. Nội dung</p>
    <select id="Ts8" name="entry.1049020395" required=""></select>
    </body>
    </html>

     

  4. 15 minutes ago, Ingolme said:
    
    

    Để xóa lời nhắc mật khẩu, chỉ cần thay thế dòng trên bằng bất kỳ giá trị cố định nào bạn muốn.

    
    

     

    Mã này không tốt lắm, các biến không được khai báo đúng cách và chúng đang sử dụng các thuộc tính lỗi thời. Nếu bạn đang có ý định giấu mã nguồn của mình với mọi người, tôi sẽ phải cảnh báo bạn rằng điều đó là không thể. Nếu trình duyệt có thể đọc mã nguồn thì bất kỳ ai cũng có thể.

    Thanks for your help, can you guide me on another encoding?

  5. I found a snippet of code to get data from a cell in a Google sheet into an HTML input ... It works fine, but not met ... My requirement is that it should work. after I press the button, do not automatically run when opening or loading the Web page as it is now ... Can you please fix it according to my mind, Thank you very much in advance.
    
    <html>
    <body>
      <input name="form1_1" id="f1_1" type="text" /> 
      <button name="submit_form1" id="submit_form1" type="button" onclick="">Click here to get data</button>
    </body>
    <script>
      const onDataLoaded = (data) => {
        const e20Content = data.feed.entry.find((entry) => entry.title.$t == 'E20').content.$t
        document.getElementById('f1_1').value = e20Content
      }
    </script>
    <script src="https://spreadsheets.google.com/feeds/cells/1TbMrtJl01i-Q5YudlhdAB_E1LTYkkLswnql5LHyiIuk/1/public/basic?alt=json-in-script&callback=onDataLoaded"></script>
    </html>
    
     
×
×
  • Create New...