Author Topic: [Code] Add Profile Pics To Friend Requests Page  (Read 1084 times)

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 505
  • Karma: +43/-2
  • Etano Contributor (Skins & Mods)
    • KH Web Development
[Code] Add Profile Pics To Friend Requests Page
« on: March 23, 2015, 06:00:51 PM »

(Screenshot is custom styled! You will need to apply some styling to make the new addition look good.)


If you want to show profile pics with friend requests then look no further.

Open friendship_requests.php

Code: [Select]


############ FIND THIS SECTION STARTING LINE 21 - 28 #################

$output=array();
$query="SELECT a.`nconn_id`,a.`fk_user_id`,b.`_user` as `user`,c.`network` FROM `{$dbtable_prefix}user_networks` a,`{$dbtable_prefix}user_profiles` b,`{$dbtable_prefix}networks` c WHERE a.`fk_user_id`=b.`fk_user_id` AND a.`fk_net_id`=c.`net_id` AND a.`fk_user_id_other`='".$_SESSION[_LICENSE_KEY_]['user']['user_id']."' AND a.`nconn_status`=0";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
$loop=array();
while ($rsrow=mysql_fetch_assoc($res)) {
$rsrow['network']=sanitize_and_format($rsrow['network'],TYPE_STRING,$__field2format[TEXT_DB2DISPLAY]);
$loop[]=$rsrow;
}


########## REPLACE IT WITH THIS SECTION ###################


$output=array();
$query="SELECT a.`nconn_id`,a.`fk_user_id`,b.`_user` as `user`,b.`_photo` as `photo`,c.`network` FROM `{$dbtable_prefix}user_networks` a,`{$dbtable_prefix}user_profiles` b,`{$dbtable_prefix}networks` c WHERE a.`fk_user_id`=b.`fk_user_id` AND a.`fk_net_id`=c.`net_id` AND a.`fk_user_id_other`='".$_SESSION[_LICENSE_KEY_]['user']['user_id']."' AND a.`nconn_status`=0";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
$loop=array();
while ($rsrow=mysql_fetch_assoc($res)) {
$rsrow['network']=sanitize_and_format($rsrow['network'],TYPE_STRING,$__field2format[TEXT_DB2DISPLAY]);
if (empty($rsrow['photo'])) {
$rsrow['photo']='no_photo.gif';
}
$loop[]=$rsrow;
}


Save it.


Now, open friendship_requests.html (skin file)

And use something like below to show the picture. Remember to place the below section within the <!--loop name="loop"--> tags.

Code: [Select]
<a href="{tplvars.relative_url}profile.php?uid={loop.fk_user_id}&amp;return={output.return2me}"><img class="user_photo thumb0" id="user_photo" src="{tplvars.photourl}/t1/{loop.photo}" alt="{loop.user}" /></a>

And thats it. :)

skipper

  • Active Member
  • ***
  • Posts: 93
  • Karma: +0/-0
    • ThePeepz.com
Re: [Code] Add Profile Pics To Friend Requests Page
« Reply #1 on: July 31, 2016, 05:24:55 PM »
What kind of custom styling will be needed, after you do this change.
Thepeepz.com
Chat-Now.chatovod.com