Forums

Passing wp_logout_url to a button in Flash -- why isn't this working? (5 posts)

  1. Raymeo
    Member
    Posted 2 years ago #

    Hello!

    I've made a flash banner that's being used for navigation in my WordPress header. I'm trying to get the Log Out button to function correctly though, and it's giving me some trouble.

    What I've tried is making a FlashVar named logout_url. The contents of this FlashVar are:

    <?php echo wp_logout_url( get_bloginfo('url') )); ?>

    I have the contents of this FlashVar getting passed to the swf file, which uses the following ActionScript 3 code to first call the FlashVar and then place it into the Log Out button:

    var logout_url:String = flashvars.logout_url;
    
    this.user_logged_in_button.addEventListener(MouseEvent.CLICK,user_logged_in_function);
    function user_logged_in_function(event:MouseEvent):void{
    navigateToURL(new URLRequest(flashvars.logout_url), "_self");
    }

    When I view my site, I can View Source and see the URL being generated just fine as the FlashVar, including the _wpnonce and redirect info. I've even pasted the same PHP into a normal text link on the page for testing purposes, and it functions perfectly. However, the Log Out button in the flash banner is not working correctly. It's taking me to a page that simply says:

    You are attempting to log out of YourSiteName
    Please try again.

    Like I said, when I View Source I can see that the entire URL is indeed being generated in the FlashVar. For some reason that I can't explain though, the Log Out button in the swf is not working the way that the regular text link does, when both the FlashVar and the text link use identical code. It's as if only the _wpnonce part of the URL is failing to be passed to Flash, although I can't say with certainty that that's exactly what's going on and causing this.

    Does anybody have any ideas as to what the problem might be? I'm totally stumped.

  2. Raymeo
    Member
    Posted 2 years ago #

    Bump

  3. alism
    Member
    Posted 2 years ago #

    If you check the server logs and compare the two entries (from a request made from the normal link and the one from the flash app), is there anything different about them?

  4. Raymeo
    Member
    Posted 2 years ago #

    Yes, the Flash link is definitely requesting:

    "GET beingray.net/blog/wp-login.php?action=logout HTTP/1.1" 500 1270 "http://beingray.net/blog/" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)"

    While the normal link, if I remember the time correctly, is requesting:

    "GET beingray.net/blog/wp-login.php?action=logout&_wpnonce=af91afa33f HTTP/1.1" 302 5 "http://beingray.net/blog/" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"

    Followed immediately by:

    "GET beingray.net/blog/wp-login.php?loggedout=true HTTP/1.1" 200 2249 "http://beingray.net/blog/" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"
  5. alism
    Member
    Posted 2 years ago #

    Well, yeah, the lack of _wpnonce in the http request does kinda suggest it's not being passed properly to Flash. Have you tried URL encoding?

Topic Closed

This topic has been closed to new replies.

About this Topic