Over the past few days I’ve been poking around here updating a few things, and generally making things more shiny (I hope). The biggest change is that I’ve moved the blog down to the root directory, that is, to see this page the URL used to be redradar.net/wp/, and it is now just redradar.net. /wp/ will still get you where you want to go, but if you’re linking here I’d appreciate if you would update your links. Thanks!
I also finally got around to making a blurb for the slide-down header thing, and will continue to add in sharing links. All this housecleaning isn’t just because I’m avoiding schoolwork, surprisingly enough. November will be a busy month, so I’m preparing. I’m going to be attending WordCamp NYC, and I plan on releasing post-from-site v 2.0 sometime before then*. I’m excited for wordcamp, not just because it gives me an excuse to go into NYC (for someone who grew up on LI I didn’t go nearly as much as I would have liked), but also because of the tracks – they’ve got an advanced developer track & a hacker room. Also I’ve never been to a developer conference, so it’ll be a new experience (though I guess it’s not strictly a dev conference).
*Hopefully the week before. New features will be multiple file uploads, submission using AJAX, and better support for internationalization.
In other geekery, I got my windows 7 key, so I can install that whenever I get a chance, and Ubuntu 9.10 is coming out soon so I’ll have to install that too… Now I’m not sure if I want to leave my old laptop alone, just update the Ubuntu partition & leave XP, and install Win7 on my Wind. Apparently it can handle it? So says a few reviews of the beta, that’s all I get from a quick google search. And then there’s the question of whether I want to dual boot Win7/Ubuntu there… Decisions, decisions… Whatever I do, I’ll make sure to post about it here.
Hi, Kelly, I’m a little confused — there seems to be no way to contact you and no forum to discuss post-from-site — only these comments.
So anyway, I’ve been trying to use pfp, with (finally) good results, but having to fix what appear to be fatal bugs. For example, the wp_queue_..()’s don’t put out the correct paths (leaving out the /’s around plugins). Maybe this is a WAMP thing — you probably develop on Ubuntu so don’t notice the Windows backslash thing. (But split() is deprecated, and you don’t need RE’s here anyway.) I fixed that part with this slightly cleaner approach:
//Set plugin dirname
define(‘POSTFROMSITE_PLUGIN_DIR’, dirname(plugin_basename(__FILE__)));
add_action(‘init’,'pfs_includes’);
function pfs_includes(){
wp_enqueue_script( ‘pfs_display’, WP_PLUGIN_URL.’/’.POSTFROMSITE_PLUGIN_DIR.’/pfs_display.js’);
wp_enqueue_style( ‘pfs_style’, WP_PLUGIN_URL.’/’.POSTFROMSITE_PLUGIN_DIR.’/pfs_style.css’); //KAK static css file
return; //KAK added return to avoid crash on login/out!?
}
Note here I also changed to a static css (filling in all the dynamic parts); I could never get the php loaded as css (a text/css vs text/html problem — in all browsers, not just Firefox, which is known to be fussy about this). Maybe not everyone will have this problem, but unless you have instructions on fixing it, I think dynamic css is the wrong way to go for a public plugin.
In pfs_submit, I removed the login link from the final alert. IE8 couldn’t handle it — and since I use sidebar-login, it isn’t even useful to me. But what’s the deal with IE on this? It just displays the html as text. Maybe entity-fy the brackets?
I’m now going to try to install the stock version on my live site, to see if my problems were Windows vs Linux. I’ll let you know.
This plugin is crucially important to the student area of the school website I’m constructing — it solves many problems (particularly training). So I’ll probably continue to modify it (the popup needs to be draggable and resizable, for one thing). If you want to communicate via email, I can keep you informed.
Thanks
Kim
Ok, I installed on my live site (Linux). The paths to the style and script files were correct (I’m sure my earlier problem was a Windows difficulty with WAMP — backslashes are special RE characters).
But even so, no popup until I uploaded my variants. So there is some difficulty with your code.
I just noticed that what I though was just a graphic for the product is actually a quick post link — I guess that is what we should use instead of commenting. I’ll try that next time.
Kim
You’ve got the right place, kind of. I answer questions in the comments to the plugin’s post, or anywhere here, really.
I know the pathing to the scripts/styles is not the best approach, that has changed in 2.0 (which should be out this week). You also had trouble with the dynamic CSS, and the login link in IE8? I admit I might’ve missed that in testing, but the CSS issue I haven’t heard from anyone else. Do you have any idea what might be causing it? Another WAMP issue? The style.php file should be setting the headers to text/css, is there something that might overwrite that on your server?
Also, how different is your filesystem set up from that of a default wordpress install? Because in some places I require files using ../../../, assuming that I know where I’m starting from. (though maybe you caught that and fixed it?)
If you’re still not getting the popup with my code, are you sure you’re using the latest version? This was a known problem with early versions (<1.6.3).
If there are other problems, let me know, I’ll help you however I can.
OK, I’ll continue this here for now, but place new comments on the plugin post page.
Just to be clear, here is a copy of the page source (same for css file — I’ve suppressed the html brackets) from your stock install on a WAMP (XAMPP). Note the missing /’s around plugins.
script type=’text/javascript’ src=’http://localhost/wp-contentpluginspost-from-site/pfs_display.js?ver=2.8.5′ /script
With a fresh install on my Linux server instead, this path is correct (with slashes placed properly) so this is a Windows problem.
On IE8 (WAMP and Linux server) the unlogged-in message looks like (direct copy from screen)
You need to be logged in to post. Log in
Doesn’t seem to change if I make the brackets entities < >
However, with the fresh install on Linux, I still get no popup. (The style.php does install, though. So maybe that’s not a problem.)
When I click quick post, Firebug error console:
Error: postboxes[i].style is undefined
Source file: http://riogallinasschool.org/wp-content/plugins/post-from-site/pfs_display.js?ver=2.8.5
Line: 17
and there’s no popup. So, if I remove “.style” from line 17, making it
postboxes[i].display = ‘none’;
everything works! This is true for all browsers I’ve tested (FF, IE8, Chrome, Opera, Safari).
I don’t know JS well enough to see what’s going on, and it must have worked for you.
So to summarize,
1. under windows your path calculation won’t work, but it’s ok under Linux.
2. IE8 doesn’t like the message that contains html.
3. Whatever was wrong with loading the style php must have been due to one of my debugging attempts before I got things working. I can’t repeat it.
4. HOWEVER, I have to make a serious, strange change –removing style. from your js on one line but not others.
I am working with downloads of 1.9.0 done in the past two days, and WP 2.8.5.
I’ve done fresh installs to both WAMP and Linux servers, and find the following:
1. As before, the path to the script and style files is incorrect in WAMP, missing /’s around plugins:
…/wp-contentpluginspost-from-site/pfs_display.js
So in WAMP I have to fix these paths, while in Linux it works either way.
I suggest you either fix this (as follows), or warn of the (potential) Windows incompatibility.
//Set plugin dirname
define(‘POSTFROMSITE_PLUGIN_DIR’, dirname(plugin_basename(__FILE__)));
add_action(‘init’,'pfs_includes’);
function pfs_includes(){
wp_enqueue_script( ‘pfs_display’, WP_PLUGIN_URL.’/’.POSTFROMSITE_PLUGIN_DIR.’/pfs_display.js’);
wp_enqueue_style( ‘pfs_style’, WP_PLUGIN_URL.’/’.POSTFROMSITE_PLUGIN_DIR.’/pfs_style.php’);
}
2. The problem with pfs_style.php not loading due to text/html problems (as reported by Firebug) must have been caused by some of my attempts to fix other problems. With the new installs and the much less intensive fiddling to get pfs to work, this file loads OK.
3. The problem with the “You must be logged in…” message in IE8 is due to improper quoting of $page in post_from_site.php line 147 — this is what you provide:
echo “You need to be logged in to post. Log in“;
There is no quote before $page, and a single quote after, which does not match the double-quote at the end. Fix the quotes, IE8 likes it. [Amazing -- for once IE8 makes sense -- this shouldn't work in any browser, but it does work in all others!]
4. So here is the problem that seems to arise, and I don’t know javascript well enough to know why (or why it works for you):
In pfs_display.js, line 17, you have
postboxes[i].style.display = ‘none’;
Firebug complains that postboxes[i].style is not defined. (And I don’t get it to work in any browser, not just Firefox.)
But if I remove style. from this line, making it
postboxes[i].display = ‘none’;
everything works!
Also, everything works with i in place of postboxes[i]:
i.display = ‘none’;
which makes more sense to me, given the “for (i in …)” statement.
But I don’t see why style isn’t appropriate in either case. It’s what I would have written.
So the upshot is — all my problems are fixed if the path computation is done properly, if the quotes are fixed in that “must be logged in” message, and if style. is removed in that one place.
But the files must work for you in their original form, so I wonder why that “style.” works for you and not for me.
Sorry. This should work:
3.The problem with the “You must be logged in…” message in IE8 is due to improper quoting of $page in post_from_site.php line 147 — this is what you provide:
echo “<div id=\”alert\”>You need to be logged in to post. <a href=”.get_bloginfo(‘url’).”/wp-login.php?redirect_to=$page’>Log in</a></div><br />”;
There is no quote before $page, and a single quote after, which does not match the double-quote at the end. Fix the quotes, IE8 likes it. [Amazing -- for once IE8 makes sense -- this shouldn't work in any browser, but it does work in all others!]
Internet Explorer 8 is very good because it is as stable as Opera. I hate the previous versions of IE like IE6 because it hangs frequently. `