Forum Replies Created

Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter drking

    (@drking)

    I’m sorry to say I ended up rebuilding the entire site – would have moved away from WP if I could because it was a long process. I’m running what was the latest version. But who knows when the wretched thing is next going to say, “Hiya – you’ve been updated (and by the way your site doesn’t work any more)”. The “Hiya” was particularly galling :).

    James’ advice above is very good – hope it helps you. But I suspect that the update itself was buggy, and that’s why there were probs.

    Thread Starter drking

    (@drking)

    Aha! I remembered that I shared how I set up WP with a colleague, who has used the same plugins on another site. He’s actually got the thing working on all the latest versions, so maybe that is what I have to try.

    I’d still like to be able to rewind back to my previous version though – in case that is the only fix. Can it be done?

    Many thanks

    Thread Starter drking

    (@drking)

    OK, thank you – that’s very helpful.

    I renamed the plugins folder to ‘pluginsoff’ via ftp. All plugins deactivated, and I got in as admin. I renamed the plugins folder back to ‘plugins’, and activated the plugins one by one, logging in on a different browser each time. There are two plugins with issues – Theme My Login, which causes the redirect loop I think. And WordPress Access Control, which prevents admin from seeing the actual website while logged in.

    The update to Theme My Login needs WP 4.5 or so. There’s no update to WordPress Access Control.

    I could update to the latest WP 4.6.1, but it’s very unlikely that the issue with WordPress Access Control will go away.

    So I either have to replace WordPress Access Control, which probably means writing a new plugin myself, or trying to change the existing code. Or I have to go back to my previous version of WP.

    Can I rewind the version somehow?

    Thanks again – I’m a lot further forward than I was

    Thread Starter drking

    (@drking)

    Thanks: both are correct. I’m thinking it may be theme related (one of the Weaver themes I think). But how to get in as admin to find out? Or how to roll back to the original version?

    Thread Starter drking

    (@drking)

    Chrome (on a mobile) says: “This page has a redirect loop. ERR_TOO_MANY_REDIRECTS”

    So it’s presumably not a browser issue. Any idea the the best way to tackle this?

    Many thanks.

    Thread Starter drking

    (@drking)

    All sorted – thanks very much for your help!

    Thread Starter drking

    (@drking)

    Brilliant – thank you.

    Perhaps I’m a little too cautious about accessing the WP database in a separate program – one worry being to acquire the password (yes, I know it’s in config.php or somewhere but that’s presumably not readable by another progam so it needs human intervention – less than great here as I’m not the human who’d have to do that). But it’s not out of the question, I agree. I’d not need CRON in fact, as any new request for a pdf could check for old files and delete them. So yes, this is one possible solution.

    Another idea I’ve come up with is to have a <a href='xyz/file.pdf' onclick='myfunction()'>construct where I write the pdf file url, but only construct the file itself on the click. That would probably work too, if the function returned true. My previous idea to make a javascript function return a pdf file url to href (<a href="javascript:myfunction()">) doesn’t work; there is probably no specification of what should happen (I’ve waded through the HTML5 spec), and 2 browsers I tried simply return the text output of the javascript function to a new page, even converting boolean values to text.

    But the one I really like is to call wp-admin/admin-post.php. I’ll try that first.

    Thanks very much – very helpful.

    Thread Starter drking

    (@drking)

    Yes, I’m afraid the pdf is generated from custom tables in the WP database. I guess I could try to access the database from outside WP but that would be a nightmare.

    There is something I have failed to underdstand here, and it may well be obvious:

    output the PDF file through the WordPress system. Just output the right download and file type headers, then output the files contents from FPDF, and die()

    Exactly how can this be done? I’m expecting to use <a href="???"> or something similar; how can I get WordPress to output the right headers, and not output headers itself? Are there hooks to intercept all of WordPress’ normal page output?

    Thanks again!

    [It looks as if I can place a generated file into a subfolder of the plugin folder on the server and it’ll be publicly available, so that is one hurdle out of the way. Luckily the data isn’t very private, although it’s only available to logged in members.]

    Thread Starter drking

    (@drking)

    Thanks. Sending the right headers etc is actually easy outside WordPress – FPDF handles that, and it works well. The issue is to stop WordPress sending anything else (eg the normal webpage headers).

    Overnight I’ve wondered whether my link could be something like
    <a href="javascript:myJsFunction();">
    where the javascript function calls the WP ajax mechanism which generates a pdf file in a unique folder (and deletes old folders), then returns the url of the generated file.

    I need unique folders because I want the pdf files to have a sensible name, rather than a unique name.

    Anyone any experience of this? Will the browser respond to the href that the js function returns in all circumstances/with all browsers?

    Thanks

    Thread Starter drking

    (@drking)

    Thank you Jerry – brilliant! For simplicity I did it in the php (avoids js cache issues); the <form> line now reads:

    $html .= "<form method='post' id='test_form' onsubmit='event.preventDefault(); test_submit();'>";

    and this now works on FF, IE, Ipad and Android.

    An alternative might be to have a simple button outside the form with onclick.

    Incidentally, if you submit a form with js, how do you actually do it without onclick, if the user has to initiate the submission?

    ================
    notes for me:

    1. The gist code is an IIFE, see eg here:
    benalman.com/news/2010/11/immediately-invoked-function-expression/
    2. function test_submit( evt ) {..} would have to be called in the form with test_submit( event ) I think.
    3. I can’t yet find where the name ‘event’ is specified in the docs. I found it on another site.

    Thread Starter drking

    (@drking)

    Thanks again.

    Yes, it does have to redirect to the new site. http://www.oldsite.org.uk/dir/?page_id=19 has to redirect to http://www.newsite.org.uk/?page_id=34

    The repidtables site suggests:
    Redirect 301 /dir/?page_id=19 http://www.newsite.org.uk/?page_id=34
    presumably to be included in an .htaccess file in the root directory, whereas I’ve been using an htaccess file in /dir/

    But it still doesn’t work. I suspect this may be to do with the exact url that’s required – I don’t understand the mechanism, but the existing .htaccess file in /dir/ has a line:

    DirectoryIndex index.cgi index.php

    which may possibly already be doing some redirection?

    This is a one-off task – I actually don’t need to understand – I just need a line that works and to know where to put it 🙂

    Thanks

    Thread Starter drking

    (@drking)

    Thank you. I’ve tried:
    RedirectMatch 301 ^//$ http://www.newsite.org.uk/
    RedirectMatch 301 ^/$ http://www.newsite.org.uk/
    RedirectMatch 301 ^/?page_id=19/$ http://www.newsite.org.uk/?page_id=34
    RedirectMatch 301 ^/?page_id=19$ http://www.newsite.org.uk/?page_id=34

    but it now doesn’t redirect at all
    I’ve also tried including the line:
    RewriteEngine On

    My intention here was to direct the home page and a single sub-page
    http://www.oldsite.org.uk/dir/
    http://www.oldsite.org.uk/dir/?page_id=19

    Doubtless I haven’t understood your instructions properly …. I would be grateful for further advice! Thanks again

    Thread Starter drking

    (@drking)

    Thanks for the reply – but this is an even more basic question than you have answered I’m afraid. For example I have a file myplugin.php which contains (at the top, not in a function):
    // enqueue and localise scripts
    wp_enqueue_script( ‘my-ajax-handle’, plugin_dir_url( __FILE__ ) . ‘ajax.js’, array( ‘jquery’ ) );

    (and a whole lot of other stuff of course). It works – I can do clever things with Jquery. But at some point WordPress must open up the file myplugin.php, find the line wp_enqueue_script(…) and execute that. When does it do that?

    Almost certainly I have misunderstood some basic concept that everyone else knows…

    Thank you!

    Thread Starter drking

    (@drking)

    Do you honestly expect anyone to test a design in all 300?

    No, I’ve not suggested that was necessary or useful, have I? I think you have misunderstood.

    I wanted to design a simple site, which will look OK (not exactly the same, just OK) for 95% of the people that look at it.

    I’m not going to do this more than once or twice, and it’s not paid work. I’m not a ‘good, experienced, web developer’.

    I’m not going to allow injection of css; the theme is to provide that.

    I am indeed grateful for your help – the key for me is that you (and it’s clear that you are a good, experienced, web developer) think that with a WordPress theme only “70 – 80% at least” of site visitors see the content as expected.

    If no-one can identify a specific theme that does better than that, I guess I just choose a theme at random and like you expect maybe 20-30% of visitors not to be able to see the content properly.

    I am surprised that this isn’t a big issue for the professional web design industry though.

    Thank you for sharing your insights.

    Thread Starter drking

    (@drking)

    I’d estimate 70 – 80% at least. Possibly more.

    That’s my worry :(. If I was addressing a room of 1000 people and only 70% could hear me, then 300 could not. That would not be acceptable.

    I was really hoping that designers would have realised by now that the same applies to websites… that someone would have done a survey and made a list of the top 95% of real browsers out there (how many? – less than 20 I bet) and tested a theme on them. I was hoping that it wouldn’t be necessary for each individual web designer to do that work for themselves (or not I suspect!)

    Is there not even one theme that claims to be OK with 95% of actual browsers?

    Thanks yet again 🙂

Viewing 15 replies - 1 through 15 (of 18 total)