Forum Replies Created

Viewing 15 replies - 1 through 15 (of 37 total)
  • Thread Starter nusi

    (@nusi)

    I think I had jetpack installed. But as far as I can remember I checked if the plugins were the reason for the failure (they weren’t).
    But anyway, things do work now… maybe some file-/directory-permissions thing? I’ve had problems with that before…

    Thread Starter nusi

    (@nusi)

    … for whatever reason, it’s working now:

    I made another (test-)childtheme, activated it instead of my. The test-theme worked as expected. Then I reactivated to my allegedly broken one and – whoops – it worked! Really mysterious… whatever the reason for the failure was, I’ll keep an eye on it and return to this thread if I find out more.

    Thread Starter nusi

    (@nusi)

    hmm… doesn’t change anything, unfortunately.

    Forum: Hacks
    In reply to: TinyMCE AJAX
    Thread Starter nusi

    (@nusi)

    Well, as I wrote earlier I already found out why I didn’t find ‘wp_ajax_my_action’ by grepping through the sources. However, I followed your advice and also tried ‘wp_ajax_nopriv_(my_action)’ which didn’t change anything. Basically I believe ‘wp_ajax_’ is the right hook as the user has to be logged in when opening the page (there’s a check for that at the beginning of my code).

    Out of curiosity I added the ‘add_action’ call in both, my custom page and functions.php within my theme. That resulted in an error ‘Cannot redeclare add_post_meta_bs() (previously declared in … /window.php’ which leads me to the assumption that the call basically works ok (of course I can’t redeclare it – it’s php…).

    Regarding wp_enqueue_scripts(): If I understand the documentation correctly that’s supposed to be used only for frontend pages. In the backend resp. admin-area one should use admin_enqueue_scripts(). However, I don’t really think that causes a problem here – all of my JavaSripts are basically working as they should besides that AJAX thing (there’s quite a lot of JS functionality on that page which I simply stripped out for the sake of conciseness). Also, I am already on the page into which I’m embedding those JavaScripts – how should wp_enqueue_scripts() or admin_enqueue_scripts() be used here? (once again, it’s a custom page that’s quite a bit different from other admin pages like post.php, edit.php or whatever).

    So, I’m still at the point of not getting a response after wp-admin/admin-ajax.php got called. I can see in the console what got sent and jQuery.post().success().error() gives me
    Object { readyState=0, status=0, statusText="error"}
    but no response like I get e.g. from the autosave-process which also calls wp-admin/admin-ajax.php.

    I think I’ll give up if some lucky coincidence doesn’t reveal the real source of my problem. Very possible that I should have done it all differently, rather following the standard wordpress-way of building admin-pages. But I simply don’t have the time for that and my client won’t pay the extra effort. It’s not a big drama.

    Thanks again for your patience and attention to my little problem. Maybe I’ll find a solution one day and I’ll be able to help others when going through the same.

    Stefan

    Forum: Hacks
    In reply to: TinyMCE AJAX
    Thread Starter nusi

    (@nusi)

    … and sorry once again for posting my last reply twice – I got a ‘bad gateway’ error but obviously posting worked…

    Forum: Hacks
    In reply to: TinyMCE AJAX
    Thread Starter nusi

    (@nusi)

    p.p.s.: I know know why I didn’t find ‘wp_ajax_my_action’ documented: https://codex.ww.wp.xz.cn/Plugin_API/Action_Reference/wp_ajax_(action)

    … but maybe there’s something else I’m doing wrong

    Forum: Hacks
    In reply to: TinyMCE AJAX
    Thread Starter nusi

    (@nusi)

    (Sorry, the previous post accidentally got posted before it was finished…)

    Interestingly I found ‘admin_print_scripts’ but not ‘wp_ajax_my_action’, so I did a quick grep through the sources which revealed that the hook indeed isn’t defined anywhere (maybe it is in 3.5.x but I’m hesitant to upgrade from 3.4.2 due to a plugin that hasn’t been updated to 3.5.x yet).

    Is it possible (or even necessary in this case) to define a custom action-hook ahead from using it in an ‘add_action’ call?

    Last but not least here’s my code:

    window.php (the page within my modal window. Irrelevant parts stripped off): http://pastebin.com/TUxPegB0

    Thanks again for your support!

    P.s.: If it all doesn’t work out it’s not a big drama as my AJAX-functionality only adds a meta-value that can also be created manually. However, it’s essential that the user creates the meta-value as it determines whether a not so small chunk of JavaScript shall be loaded with the page (e.g. the jQuery library) and also that JS has some unwanted sideeffects on regular pages.

    Forum: Hacks
    In reply to: TinyMCE AJAX
    Thread Starter nusi

    (@nusi)

    Thanks for the reply! If I understand correctly what I did wasn’t that wrong. First I tried to execute the ‘add-action’ part from within my custom page (the one within my modal window). However I only did that for the function that was supposed to be executed within wp-admin/admin-ajax.php. The other action, containing the jQuery-JavaScript part (jQuery.post(…)) was just written into the header of my page (I can see on the console that it’s being executed. I didn’t bother much for the ‘ajaxurl’ not being recognized. I just used hardcoded the path to wp-admin/admin-ajax.php).

    Also I tried to put the ‘add_action’ call into functions.php within my theme (it’s a thematic-childtheme). However that didn’t have the desired effect either. As a consequence I digged a bit deeper into the docs in order to get a better understanding on how ‘add_action’ basically works. I finally found this page which documents the existing action-hooks. Interesting

    Forum: Hacks
    In reply to: TinyMCE AJAX
    Thread Starter nusi

    (@nusi)

    Thanks for the reply. At first sight AJAX in Plugins seemed to be the missing reference that I was looking for but after playing around with what’s described on the page I’m still stuck.
    Just to make it clear once again – I’m not writing a wordpress plugin. I’ve written a TinyMCE plugin, following this tutorial. That means my jQuery/AJAX functionality exists within a custom HTML-page. Obviously that page doesn’t know anything about a global ‘ajaxurl’ variable. Nevertheless it’s no problem to reference wp-admin/admin-ajax.php directly (hardcoded).
    But how can I get wp-admin/admin-ajax.php to execute my desired action (add a meta-value to the database)? Hooking up an action with add_action (from within the same page) doesn’t seem to have any effect. I’m obviously missing something that isn’t mentioned on AJAX in Plugins. Though the ‘ajaxurl’ variable doesn’t exist on my (custom) page I can see usual wp functionality is working (e.g. I can create a ‘nonce’ value with wp_create_nonce(“nonce”)). (Again, I don’t want to write a wordpress-plugin – I’m just extending the functionality of my theme).

    Any clues?

    ok, after fiddling around and even deleting the plugin-related entries in the options-table of the database I finally got the plugin working again (really, did the same things over and over again and then suddenly my username – the one with the “-” – got accepted).

    So, thanks very much – I’m happy 😉

    well, that *is* my username. but it gets rendered to http://soundcloud.com/5tefan-negulesco. so, maybe that’s confusing the plugin somerhow…

    I’m having the same problem, using WP 3.3.1 and soundcloud is gold v. 2.1 – deactivating and reactivating the plugin resp. deleting and reinstalling didn’t help 🙁 – guess I’ll have to go back to v. 1.x …
    (username: 5tefan.negulesco)

    interesting…

    whois tells me that jquery.org belongs to someone named “John Resig” – well, is it that John Resig who developed jQuery?
    https://en.wikipedia.org/wiki/John_Resig

    i’ve removed the wordpress-database-backup-plugin now…

    ok, i see was probably wrong assuming wpstats.org belongs to ww.wp.xz.cn – calling http://wpstats.org only forwards to http://ww.wp.xz.cn.

    http://www.wordpressconnect.net/wordpress-database-backup-plugin/ is one of many plugins that links resp. embeds jQuery.js from http://www.wpstats.org/jquery-1.6.3.min.js (i’ve removed the call from the pugin’s code manually).

    indeed, http://www.wordpressconnect.net/wordpress-database-backup-plugin/ doesn’t seem to be listed on http://ww.wp.xz.cn/extend/plugins – i only remember very vaguely i installed after it was recommended from my blog’s dashboard (usually i’m looking for plugins on http://ww.wp.xz.cn/extend/plugins and don’t go searching the web over google or the like). maybe i should try to contact someone http://www.wordpressconnect.net … anyway this isn’t the only plugin resp. theme that links to wpstats.org…

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