Forums

I can't get to pages in the Admin that use Dir/file.php (35 posts)

  1. JPigford
    Member
    Posted 7 years ago #

    This mainly relates to plugins as they are the only ones that do this, but I have 2 plugins that add a tab to the Options page of the Admin. They format the links like this:

    http://www.website.com/wp-admin/options-general.php?page=BAStats/BAStats.php
    http://www.website.com/wp-admin/options-general.php?page=SK2/spam_karma_2_plugin.php

    Notice how they have a folder/directory before the actual page name as that is where the file is inside the plugins folder.

    For whatever reason, when I go to those pages, it just shows the regular WP Admin interface but no content...no options for either of those plugins.

    Any ideas?

  2. JPigford
    Member
    Posted 7 years ago #

    Edit, I take that back, it does the same for this link to:

    http://www.website.com/wp-admin/options-general.php?page=subscribe-to-comments.php

    Now i'm just confused.

  3. ColdForged
    Member
    Posted 7 years ago #

    You running straight 1.5 Strayhorn release?

  4. JPigford
    Member
    Posted 7 years ago #

    Yes, I am.

  5. ColdForged
    Member
    Posted 7 years ago #

    And when you say "it just shows the regular WP Admin interface but no content", what does that mean? Do you mean it has the appropriate headers -- including perhaps even a highlighted "tab" for the current page -- and then the footer immediately following?

  6. JPigford
    Member
    Posted 7 years ago #

    Here's a screen shot from one of them:

    http://www.joshpigford.com/misc/wordpress/wpadminissue01.gif

  7. ColdForged
    Member
    Posted 7 years ago #

    Has this always happened or did it just start?

  8. JPigford
    Member
    Posted 7 years ago #

    Has always been that way.

  9. ColdForged
    Member
    Posted 7 years ago #

    Waitaminute... are you on a Windows or Unix or Apple host? Didn't I recall you having trouble with pathnames before? Or am I thinking of someone different?

  10. JPigford
    Member
    Posted 7 years ago #

    I'm on a *nix box and haven't had pathnames issues other than this.

  11. ColdForged
    Member
    Posted 7 years ago #

    Save a copy of your wp-admin/admin-functions.php file and edit it. Replace the add_menu_page() function with this version and see if it helps:

    function add_menu_page($page_title, $menu_title, $access_level, $file, $function = '') {
    global $menu, $admin_page_hooks;
    $file = plugin_basename($file);
    $menu[] = array($menu_title, $access_level, $file, $page_title);
    $admin_page_hooks[$file] = sanitize_title($menu_title);
    $hookname = get_plugin_page_hookname($file, '');
    if ( !empty($function) && !empty($hookname) )
    add_action($hookname, $function);
    return $hookname;
    }

  12. JPigford
    Member
    Posted 7 years ago #

    I'm afraid I had no luck with that.

  13. ColdForged
    Member
    Posted 7 years ago #

    In what way? It does the same thing?

  14. JPigford
    Member
    Posted 7 years ago #

    Same thing...no change at all.

  15. ColdForged
    Member
    Posted 7 years ago #

    I'm at a loss. If you know PHP this may be the time to start narrowing it down with echo calls to print out important stuff in the admin.php file. Figure out which path it's heading down in the part that says

    // Handle plugin admin pages.
    if (isset($_GET['page'])) {

    by echoing the $page_hook variable and such. Goofy indeed.

  16. JPigford
    Member
    Posted 7 years ago #

    Okay, I've done some stupid things before when troubleshooting problems...but before i start doing a ton of stuff....where can i make sure and be absoutely positive i'm using strayhorn? i'm 99.999% sure i am....but i've been wrong before.

  17. ColdForged
    Member
    Posted 7 years ago #

    Erm. Only way to tell for sure would be to download Strayhorn and diff it against your installation.

  18. JPigford
    Member
    Posted 7 years ago #

    Blah, yeah...I am using 1.5 strayhorn...

    {scurries off to start debugging}

  19. JPigford
    Member
    Posted 7 years ago #

    Okay, i'm echoing $page_hook for one of the pages and got this:

    options_page_BAStats/BAStats

    for this page:

    http://www.website.com/wp-admin/options-general.php?page=BAStats/BAStats.php

  20. ColdForged
    Member
    Posted 7 years ago #

    How about the "subscribe-to-comments" one, since that one isn't a subdirectory (and, I have it installed in my installation :])? What might also be useful would be dumping the page_hook calculated from within the add_menu_page() function to compare it.

  21. JPigford
    Member
    Posted 7 years ago #

    subscribe-to-comments shows "options_page_subscribe-to-comments"

    I will say this...I have that Contact Form plugin and it's URL is:

    admin.php?page=options-contactform.php

    as opposed to the others being

    options-general.php?page=.......

    Not sure exactly what that means but the admin.php plugin isn't having trouble while the options-general.php ones are...

    Also, pardon my ignorance but you what dyou mean dump the page_hook?

    Right now I have:

    if (isset($_GET['page'])) {
    $plugin_page = plugin_basename($_GET['page']);
    $page_hook = get_plugin_page_hook($plugin_page, $pagenow);
    echo $page_hook;

    to echo things.

  22. ColdForged
    Member
    Posted 7 years ago #

    Also, pardon my ignorance but you what dyou mean dump the page_hook?

    Yup, precisely.

  23. JPigford
    Member
    Posted 7 years ago #

    Haha...sorry, was typing WAY to fast...again:

    "Also, pardon my ignorance, by what do you mean dump the page_hook?"

  24. ColdForged
    Member
    Posted 7 years ago #

    No, you're fine. What you have is precisely what I intended :).

  25. JPigford
    Member
    Posted 7 years ago #

    alrighty....so do you have a solution to my problem or what? :-P (kidding)

  26. ColdForged
    Member
    Posted 7 years ago #

    alrighty....so did you "dump[ing] the page_hook calculated from within the add_menu_page() function to compare it" or what? ;)

  27. JPigford
    Member
    Posted 7 years ago #

    I think i'm confused about your use of "dump"...the only thing I've done is add the echo $page_hook; to the add_menu_page() function as well as the:

    // Handle plugin admin pages.
    if (isset($_GET['page'])) {

    The only thing I've seen is the "options_page_subscribe-to-comments" that gets echoed at the top of the page.

  28. ColdForged
    Member
    Posted 7 years ago #

    Ah. But it's only printing it once? That's interesting, there'd have to be more than one if you've got 2 echos. Make sure you have echos in all conditional paths in the admin.php file, and make sure you cna tell the echos apart (e.g. echo "1. $page_hook"; for one and echo "2. $page_hook"; for another).

  29. JPigford
    Member
    Posted 7 years ago #

    My admin.php looks like this:

    http://www.codepaste.net/54

    And my add_menu_page() function in admin-functions.php looks like this:

    http://www.codepaste.net/55

    With that I'm only getting the number 1.

  30. ColdForged
    Member
    Posted 7 years ago #

    Hmm, wait a sec... which version of Subscribe To is that? The latest preview is only for 1.5.1, and as far as I know that's the only one that has an admin interface.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.