Author Topic: [API] accID  (Read 581 times)

0 Members and 0 Guests are viewing this topic.

Offline aIURbliS

  • Hero Member
  • *****
  • Posts: 1215
  • Karma: 45
  • Gender: Male
  • Location: U.S.
    • View Profile
[API] accID
« on: June 05, 2014, 11:43:17 pm »
For coders only!


This code utilizes jQuery, please use the latest version found in this thread: http://support.createaforum.com/5/jquery-v1-8-update/

Code: [Select]
function accID(n){var t,i;return $.ajax({url:smf_scripturl+"?action=mlist;sa=search",async:!1,type:"POST",data:"search="+n+"&fields%5B%5D=name"}).done(function(r){if(t=$(r).find("#mlist").children("table").children("tbody").children("tr").eq(0).children("td").eq(1).children("a"),t.html()!==n)return console.log("accID: Username "+n+" not found"),!1;i=t.attr("href")}).fail(function(){return console.log("accID: Failed to send POST request"),!1}),i.split("u=")[1]}

Usage:
Code: [Select]
accID(username);
« Last Edit: December 13, 2014, 07:52:44 pm by aIURbliS »
All codes I make are tested on the latest version of Google Chrome and upon request of other browsers.

Share on Facebook Share on Twitter