Jump to content

Help with code to log out of Wordpress


Recommended Posts

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...