ndp
Forum Replies Created
-
Forum: Plugins
In reply to: [Plugin: TDO Mini Forms] Create a subpage, choose a parent pageI did this.
It’s not pretty, and there’s probably better ways to do this.
But you need to insert this “hack” code into your form:
Immediately before the form-start comment.
<?php
$this_forms_id = get_the_ID();
$this_page = get_page($this_forms_id);
$form_parent = $this_page->post_parent ;
?>This sets some variables that contain information we need. The main one we need is $form_parent.
You need to pass this information to the backend-code, and this is where I think I did this wrong; but it works.
This stuff goes between form method tag, and the widget-start comment.<div><input type=’hidden’ id=’formwpid’ name=’formwpid’ value='<?php echo $this_forms_id ; ?>’ /></div>
<div><input type=’hidden’ id=’formparent’ name=’formparent’ value='<?php echo $form_parent ; ?>’ /></div>Then, on the backend, in a file I suppose I’m not supposed to touch; tdomf-form.php file, look for a function called tdomf_create_post($args). The variables passed to this function are in the form of an Associative Array called $args. When a form is submitted, the two new values are “formwpid” and “formparent”. These are just wordpress page ID numbers.
Further down in the tdomf_create_post() function, find the “$post = array (” statement. This is where our page attributes are loaded into the array named $post. We need to add a line in there, “post_parent” => $args[‘formparent’], (dont forget the comma). Then when tdomf_create_post() fires $post_ID = wp_insert_post($post); the extra post_parent parameter that you shoved into $post, now replaces the default post_parent attribute of 0, with the ID of the parent post of your FORM. Therefore, in terms of page hierarchy, you get a page that is a sibling of your FORM.
Of course, this breaks all your other forms, unless they’ve been similarly hacked to post that “formparent” parameter.
What I did, is I also put in a third parameter “ismycustomform”=true. Then I test for that value $args[‘ismycustomform’], and if it’s set to true, I add my post_parent parameter to $post. Otherwise, I let the post be the way it is by default.
There’s a lot of other things you can do: I set categories this way too. You can change your “hack” php to grab a different post’s ID to use as a parent, if you like.
I started to try to figure out how to add this functionality via a widget, but I didn’t have time to figure that out. Tight deadlines cause bad coding!
Forum: Fixing WordPress
In reply to: “do you want to display non-secure items?” . . . IE security popupThe theme idea helped me to narrow it down significantly.
(on my test site): I chopped out blocks of php code from template pages, until I found the two lines in template/start.php:
<!– script START –>
<script type=”text/javascript” src=”<?php bloginfo(‘template_url’); ?>/js/base.js”></script>
<script type=”text/javascript” src=”<?php bloginfo(‘template_url’); ?>/js/menu.js”></script>
<!– script END –>Functionality was broken, when I removed these lines, but I stopped getting the security popup.
I replaced those lines, then I dug into these two .js files. I had already suspected the menu.js file, based on the removeChild() call, from the Microsoft KB Article.
What I found, at the bottom of the file, was this decision:
if (document.addEventListener) {
document.addEventListener(“DOMContentLoaded”, loadMenus, false);} else if (/MSIE/i.test(navigator.userAgent)) {
document.write(‘<script id=”__ie_onload_for_generic23″ defer src=”javascript:void(0)”></script>’);
var script = document.getElementById(‘__ie_onload_for_generic23’);
script.onreadystatechange = function() {
if (this.readyState == ‘complete’) {
loadMenus();
}
}} else if (/WebKit/i.test(navigator.userAgent)) {
var _timer = setInterval( function() {
if (/loaded|complete/.test(document.readyState)) {
clearInterval(_timer);
loadMenus();
}
}, 10);} else {
window.onload = function(e) {
loadMenus();
}
}When I removed the test for the MSIE user agent, that whole “else if” block, everything seemed to work fine, and there was no IE security popup. Can anyone explain what this code is doing?
Forum: Fixing WordPress
In reply to: “do you want to display non-secure items?” . . . IE security popupThe idea to shut off my themes was a good one.
If I use either my custom theme, or Generic Plus (on which my custom theme was based), I have the problem. If I go back to the generic WP theme, the problem seems to go away.
Unfortunately, the site is now live, so I can only play around with our backup site like this. I need to isolate what is exactly doing this and change only that, because the live site is developed dependent on this custom theme.
Forum: Fixing WordPress
In reply to: “do you want to display non-secure items?” . . . IE security popupWhen I use tools like PageInfo in Firefox, or Safari’s Activity window, they list every element of the page, and they’re all coming from https.
Forum: Fixing WordPress
In reply to: “do you want to display non-secure items?” . . . IE security popupI don’t see any http references when I do a view->source. Other than the standard stuff in the headers:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head profile=”http://gmpg.org/xfn/11″>Forum: Fixing WordPress
In reply to: “do you want to display non-secure items?” . . . IE security popupMy theme is a slightly modified version of Generic Plus; fwiw.
Following the microsoft kb article, above, there’s a section of javascript in my mytheme/js/menu.js file:
cleanWhitespace = function(list) {
var node = list.firstChild;
while (node) {
var nextNode = node.nextSibling;
if(node.nodeType == 3 && !/\S/.test(node.nodeValue)) {
list.removeChild(node);
}
node = nextNode;
}
return list;
}I think it’s responsible for clearing the popup menu graphics, when the user mouseovers the menu bar. I tried just remarking-out the “list.removeChild(node);” line, knowing that it would break some other functionality – and sure enough, the menubar mouseovers stopped working. And I was still getting the security popup in IE. So I know that this is not the cause of the issue either.
(put the code back safe-and-sound, and the feature’s working again).
Forum: Fixing WordPress
In reply to: “do you want to display non-secure items?” . . . IE security popupAll of my IE users are complaining about this.
All of our images are either in /wp-admin/images, or wp-content/themes/mytheme/img. It’s really a very non-graphics-intensive site.I’m doing “view source” on every page, and there’s no content coming from any other site.
I tried changing my style.css from:
body {
background:#767877 url(img/bg.jpg) repeat-x;
color:#555;
font-family:Verdana,”BitStream vera Sans”,Helvetica,Sans-serif;
font-size:12px;to:
body {
background:#767877 url(https://mysite.com/wp-content/themes/mytheme/img/bg.jpg) repeat-x;
color:#555;
font-family:Verdana,”BitStream vera Sans”,Helvetica,Sans-serif;
font-size:12px;No luck.