jackzelig
Forum Replies Created
-
Oops, I forgot to mask the dot after the www in the reg exp.
It should be:
$host = preg_replace('/www\./', '', $_SERVER['HTTP_HOST'], 1);After spending all day on this, I’ve solved my own problem.
Here’s what I did, in case it helps someone else:It seems that when the plugin catches a non-logged in user trying to view protected content, it creates a
$redirect_tovariable, which it then passes to wp-login.php.$redirect_to = urlencode($proto . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);The problem is, that if I enter ‘http://www.mysite.com/blog’,
$_SERVER['HTTP_HOST']will hold ‘www.mysite.com’. If site address is set to ‘http://mysite.com’ in my WP backend however, this will confuse the login script and the user will end up at the dashboard (presumably by default).To sort this out, one could hard code the site url into the
$redirect_tovariable, although this is a bit ugly.Alternatively, one could check if
site_url()starts with ‘www.’ and if it doesn’t, remove it from$_SERVER['HTTP_HOST']Something like this:
if (preg_match('/^www./', site_url())){ $host= $_SERVER['HTTP_HOST']; }else{ $host = preg_replace('/www./', '', $_SERVER['HTTP_HOST'], 1); } $redirect_to = urlencode($proto . $host . $_SERVER['REQUEST_URI']);Hi shirazdrum,
The complicating factor in all of this, is that we have to keep our url, which is www . some-uni. de / our-department.
My boss doesn’t really give a monkey’s *** if I build the site with WordPress, by hand, or with strange cosmic rays which emanate from my fingertips.
Fact is, if I can find a way to hand off updating the site to other people, it would be a load off my plate. Fact also is, as you pointed out earlier, WP is a piece of cake to use and therefore, if I can (mis)use it to do this task, everyone would be a winner.
As a pet project I wrote a mini CMS in ruby to update certain parts of the site and this worked quite well. However, I really don’t have the time to maintain this and it doesn’t really scale. That’s why I had the idea with WP.
I find I learn best when I have a real world application to work on, so that’s why I quite fancy seeing if I can get this to work.
Nonetheless, your comments have given me food for thought, so thanks for that.
BTW, I do get paid for working for the uni, but nothing like $120 per hour. If you genuinely pull that in for web development work, then good for you.
Jack
There are other systems designed to do what you want — for example Adobe Contribute
I’ve worked with Contribute and found it to be ok too. The disadvantage of this is that I would have to install it on every PC of anyone who wanted to update anything. And, despite the very reasonable price for a CLP licence, my boss won’t pay for this.
Note that that plug-in has not been updated in 2.5 years — so do some research and testing…
True, true. I’m hoping that I can check out the source and extract the core functionality that I need. Hopefully it’ll be a good exercise in getting to grips with WP internals.
Thanks for your reply Michael.
Sorry if I didn’t provide enough detail in my initial post, but you seem to have understood my question correctly.The situation is this: we have a website, consisting of a bunch of static HTML pages on a server which doesn’t run PHP or MySQL. This I cannot change.
These pages were created and are maintained by me. However, it would take a load off my plate if I could have some of the other people in the department make changes to them as necessary.
I agree that it’s not an ideal use case for WP, and I’m very probably trying to have my cake and eat it, but I was thinking of installing WP on a virtual server which I have access to within the same domain (which obviously does run PHP etc), and having WP create static pages which it can then push to the uni’s main WWW server. This is how the uni’s own CMS works.
My question was twofold: is this possible and if so, could you give me a pointer as to where to look.
I’ve been scouring Google since posting this last night and have just struck lucky: http://ww.wp.xz.cn/extend/plugins/really-static/.
This doesn’t do 100% what I want, but provides a good basis to move forward.
Thanks again for pointing me in the right direction.
Jack.
P.S. If this really is a backwards way of approaching this problem, or if someone has a better idea I would be really glad to hear it.