News:

Create A Forum Installed

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

0 Members and 1 Guest are viewing this topic.

Offline aIURbliS

  • Hero Member
  • *****
  • Posts: 1215
  • Karma: 45
  • Gender: Male
  • Location: U.S.
    • View Profile

Badges: (View All)
Level 6 Sixth year Anniversary Fifth year Anniversary
[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