Tutu Posted March 17, 2014 Share Posted March 17, 2014 Well, for some odd reason the IPB api makes all user-info besides their avatars easily accessible, and it was somewhat necessary for a 3rd party app. I was working on. Long story short, the following code snippet will allow you to easily grab a user's avatar location, connect.php <?php $mysql_hostname = '...'; $mysql_user = '...'; $mysql_password = '...'; $mysql_database = '...'; $prefix = ""; $bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die('Could not connect database'); mysql_select_db($mysql_database, $bd) or die('Could not select database'); ?> user.php class User { function avatar($user) { require_once('connect.php'); try { $sql = "SELECT * FROM members WHERE name='$user'"; $query = mysql_query($sql); if(!$query) { exit('Fail'); } $member = mysql_fetch_assoc($query); $id = $member['member_id']; $sql_2 = "SELECT * FROM profile_portal WHERE pp_member_id='$id'"; $query = mysql_query($sql_2); $profile = mysql_fetch_assoc($query); $avatar = $profile['pp_main_photo']; if(!isset($avatar) || $avatar=='') { exit('Fail'); } exit('http://myforum.com/uploads/'.$avatar); } catch(Exception $ex){ exit('Fail'); } } } Usage, <?php $user = new User; $name = 'USERNAME'; $user->avatar($name); 1 Link to comment Share on other sites More sharing options...
GROTiUS Posted May 9, 2014 Share Posted May 9, 2014 Its possible to ask: If a user uploaded a custom avatar or not ? So if a user dont have a avatar uploaded, a message will displayed "Please costumize your profile, by uploading a avatar" Link to comment Share on other sites More sharing options...
Arif Posted July 18, 2014 Share Posted July 18, 2014 Its possible to ask: If a user uploaded a custom avatar or not ? So if a user dont have a avatar uploaded, a message will displayed "Please costumize your profile, by uploading a avatar" I also want to have this is it possible? Link to comment Share on other sites More sharing options...
CyberLord Posted August 8, 2014 Share Posted August 8, 2014 Nice.. Link to comment Share on other sites More sharing options...
M0L0Z Posted August 15, 2014 Share Posted August 15, 2014 Its possible to ask: If a user uploaded a custom avatar or not ? So if a user dont have a avatar uploaded, a message will displayed "Please costumize your profile, by uploading a avatar" Yeah! That is something I would use too... Link to comment Share on other sites More sharing options...
Jeiko Posted August 18, 2014 Share Posted August 18, 2014 maybe any preview to check what we will do here? Link to comment Share on other sites More sharing options...
cl45 Posted September 20, 2014 Share Posted September 20, 2014 thanks for it. Link to comment Share on other sites More sharing options...
Droid Posted September 20, 2014 Share Posted September 20, 2014 Awesome. Link to comment Share on other sites More sharing options...
thekid490 Posted November 8, 2014 Share Posted November 8, 2014 Looks interesting. not sure what you used this for i would just copy and paste or copy the image and get the link and download it. seems nifty though. Link to comment Share on other sites More sharing options...
Generic User 121514 Posted December 3, 2014 Share Posted December 3, 2014 oh thanks you man Link to comment Share on other sites More sharing options...
m000 Posted December 30, 2014 Share Posted December 30, 2014 Use PDO instead of mysql_* Don't grab everything from tables members and profile_portal when you need only one column. 1 Link to comment Share on other sites More sharing options...
Bogdan. Posted February 25, 2015 Share Posted February 25, 2015 Awesome. Link to comment Share on other sites More sharing options...
Wifi123 Posted February 28, 2015 Share Posted February 28, 2015 Awesome tut, man. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts