Jump to content
Sign in to follow this  
ice1000

Help with code to log out of Wordpress

Recommended Posts

ice1000

My code used to work ok until this latest wordpress update. The latest version has the Log out link in a ul inside a div. I can get my script to simulate a click on the div but after that I can't figure out how to click on the Log Out link. Any ideas?

Here is the WP HTML:

<div id="user_info_links_wrap">
 <div id="user_info_links">
  <ul>
   <li>
    <a title="Edit your profile" href="profile.php">Your Profile</a>
   </li>
   <li>
    <a title="Log Out" href="http://mysite.com/wp-login.php?action=logout&_wpnonce=f93479b1b">Log Out</a>
   </li>
  </ul>
 </div>
</div>

Here is my code. The loop looking at the inner text used to work but does not work now. The first two lines do work and open up the div.

;Logout
    $oLinks = _IEGetObjById($oIE, 'user_info_links');
    _IEAction($oLinks,"click")


    ;Find and click text link
    $oLinks = _IELinkGetCollection($oIE)
    For $oLink in $oLinks
        $sLinkText = _IEPropertyGet($oLink, "innerText")
        If StringInStr($sLinkText, "Log Out") Then
            _IEAction($oLink, "click")
            ExitLoop
        EndIf
    Next

Share this post


Link to post
Share on other sites
wakillon

when log out it return to the login page.

So, you could try :

_IENavigate ( $oIE, 'http://wordpress.com/wp-login.php?loggedout=true' )

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
ice1000

when log out it return to the login page.

So, you could try :

_IENavigate ( $oIE, 'http://wordpress.com/wp-login.php?loggedout=true' )

Yup, that did it. Thanks for the help!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×