TinyPortal

Development => Block Codes => Topic started by: wilsy on November 29, 2007, 08:27:41 AM

Title: Latest Profile Photos
Post by: wilsy on November 29, 2007, 08:27:41 AM
Hi all,

I am using the Ultimate Profile mod from here: -

http://www.simplemachines.org/community/index.php?topic=183574.0

...and wish to display the last five profile photos per member in a front page block.

The code below doesn't format correctly in a front page block. It lists every profile photo and formats them underneath each other rather than in a row across.

It also needs to only list the latest profile photo by member, so if a member uploads 5 new photos at once they dont all show in the block. It will show the latest photo that the last five members have uploaded .....does that make sense?

$pic_number = 5;

global $db_prefix, $modSettings, $scripturl;

$sql = db_query ('SELECT p.ID_PICTURE, p.ID_MEMBER, p.title, p.time, p.filename, m.realName
FROM ' . $db_prefix . 'profile_pictures AS p, ' . $db_prefix . 'members AS m
WHERE p.ID_MEMBER = m.ID_MEMBER
ORDER BY p.time DESC', __FILE__, __LINE__);

$data = array();
while ($row = mysql_fetch_assoc ($sql)) {
$data[] = array (
'title' => $row['title'],
'thumb' => $modSettings['profile_pictures_url'] . '/' . $row['ID_MEMBER'] . '_' . $row['time'] . '_thumb.' . substr (strrchr ($row['filename'], '.'), 1),
'url' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . ';sa=pictures;view=' . $row['ID_PICTURE'],
'time' => timeformat ($row['time']),
'user' => $row['realName'],
'profile' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
);
}

// now, print the data :)

foreach ($data as $picture) {
echo '<a href="', $picture['url'] ,'"><img src="' . $picture['thumb'] . '" alt="" /><br />' . $picture['title'], '</a>';
}


This is being discusses over at SMF but I thought that as there was something to work with, and there are some superb block experts over here (naming no names - there are far too many!), it might get resolved a little faster at TP ;)

Regards,

Wilsy.
Title: Re: Latest Profile Photos
Post by: wilsy on December 01, 2007, 07:21:28 PM
Hi,

I've managed to sort the formatting so its all nice and neat. I still cant get it to show only five images though, it shows them all!

This is what I have: -

$pic_number = 5;

global $db_prefix, $modSettings, $scripturl;

$sql = db_query ('SELECT p.ID_PICTURE, p.ID_MEMBER, p.title, p.time, p.filename, m.realName
FROM ' . $db_prefix . 'profile_pictures AS p, ' . $db_prefix . 'members AS m
WHERE p.ID_MEMBER = m.ID_MEMBER
ORDER BY p.time DESC', __FILE__, __LINE__);

$data = array();
while ($row = mysql_fetch_assoc ($sql)) {
$data[] = array (
'title' => $row['title'],
'thumb' => $modSettings['profile_pictures_url'] . '/' . $row['ID_MEMBER'] . '_' . $row['time'] . '_thumb.' . substr (strrchr ($row['filename'], '.'), 1),
'url' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . ';sa=pictures;view=' . $row['ID_PICTURE'],
'time' => timeformat ($row['time']),
'user' => $row['realName'],
'profile' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
);
}


echo '
<table ALIGN="center">
<tr>';
foreach ($data as $picture)
{
echo '
<td><center>
<a href="', $picture['url'] ,'"><img src="' . $picture['thumb'] . '" alt="" /></a>
</center></td>';
}
echo '
</tr>
</table>';


Regards,

Wilsy.
Title: Re: Latest Profile Photos
Post by: wilsy on December 01, 2007, 10:39:15 PM
Resolved!

global $db_prefix, $modSettings, $scripturl;
echo '
<a href="', $scripturl ,'?action=profile;u=', $context['user']['id'] ,';sa=pictures;add">Add Profile Photo</a> |  <a href="', $scripturl ,'?action=profile;u=', $context['user']['id'] ,';sa=pictures">My Profile Photos</a>
';
$sql = db_query ('SELECT p.ID_PICTURE, p.ID_MEMBER, p.title, p.time, p.filename, m.realName
FROM ' . $db_prefix . 'profile_pictures AS p, ' . $db_prefix . 'members AS m
WHERE p.ID_MEMBER = m.ID_MEMBER
ORDER BY p.time DESC
LIMIT 5', __FILE__, __LINE__);


$data = array();
while ($row = mysql_fetch_assoc ($sql)) {
$data[] = array (
'title' => $row['title'],
'thumb' => $modSettings['profile_pictures_url'] . '/' . $row['ID_MEMBER'] . '_' . $row['time'] . '_thumb.' . substr (strrchr ($row['filename'], '.'), 1),
'url' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . ';sa=pictures;view=' . $row['ID_PICTURE'],
'time' => timeformat ($row['time']),
'user' => $row['realName'],
'profile' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
);
}


echo '
<table ALIGN="center">
<tr>';
foreach ($data as $picture)
{
echo '
<td><center>
<a href="', $picture['url'] ,'"><img src="' . $picture['thumb'] . '" alt="" /></a>
</center></td>';
}
echo '
</tr>
</table>';
Title: Re: Latest Profile Photos
Post by: Zetan on December 01, 2007, 10:40:17 PM
Nice one wilsy  :coolsmiley:
Title: Re: Latest Profile Photos
Post by: Smoky on December 01, 2007, 10:49:23 PM
very nice!!!  :D  will have to try it out.. thank you..  ;)
Title: Re: Latest Profile Photos
Post by: Lord Anubis on December 02, 2007, 12:47:05 AM
Nice one Wilsy...That is a sweet mod as well :)
Title: Re: Latest Profile Photos
Post by: wilsy on December 02, 2007, 09:58:19 AM
Now the last piece of this implementation needs a TP member search block with the following: -

Gender: male/female

Profile Photos: yes/no

...this is way beyond me, can anyone help?

Regards,

Wilsy.
Title: Re: SOLVED: Latest Profile Photos
Post by: Dragooon on December 02, 2007, 10:30:08 AM
So You want member's Gender and weather he/she have any profile photos or Not in that block?
Title: Re: SOLVED: Latest Profile Photos
Post by: wilsy on December 02, 2007, 10:35:32 AM
Hi Dragooon,

That would be fantastic, is it possible?

Regards,

Wilsy.
Title: Re: SOLVED: Latest Profile Photos
Post by: Dragooon on December 02, 2007, 10:43:42 AM
It is easy,
For the Profile Photos Part Use
global $db_prefix, $ID_MEMBER, $settings;
$request = db_query("SELECT ID_PICTURE, ID_MEMBER
FROM {$db_prefix}profile_pictures
WHERE ID_MEMBER = $ID_MEMBER
ORDER BY ID_PICTURE DESC
LIMIT 1",__FILE__, __LINE__);
if(mysql_num_rows($request) > 0)
   echo 'Profile Photos : Yes';
else
   echo 'Profile Photos : No';
mysql_free_result($request);

Now for Gender you can use

$request = db_query("SELECT ID_MEMBER, gender
FROM {$db_prefix}members
WHERE ID_MEMBER = $ID_MEMBER
LIMIT 1",__FILE__,__LINE__);
$row = mysql_fetch_assoc($request);
if($row['gender'] == 1)
{
// The gender is male
echo 'Gender : <img src="',$settings['images_url'],'/Female.gif" />';
}
elseif($row['gender'] == 2)
{
// The gender is male
echo 'Gender : <img src="',$settings['images_url'],'/Male.gif" />';
}

I just wrote this while typing the reply so expect errors :P
Title: Re: SOLVED: Latest Profile Photos
Post by: wilsy on December 02, 2007, 11:05:52 AM
Hi Dragooon,

Many thanks for the very quick response, it's really appreciated!

What I was looking for is a block that looks like: -

Male (checkbox)
Female (checkbox)
Profile Photos (checkbox)

Search Button

Regards,

Wilsy.
Title: Re: SOLVED: Latest Profile Photos
Post by: Dragooon on December 02, 2007, 11:08:58 AM
You can edit the echo commands and replace them with a checkbox image And about the search Button, Look at the TP Search code in Search Box.
Title: Re: SOLVED: Latest Profile Photos
Post by: wilsy on December 02, 2007, 11:41:31 AM
Thanks Dragoon,

It might be a little bit beyond me but I'll take a look ;)

Regards,

Wilsy.
Title: Re: SOLVED: Latest Profile Photos
Post by: wilsy on December 07, 2007, 05:16:06 PM
Hi Dragooon,

Well, after about a week I've finally given up on this. Would you be kind enough to help me out? ;)

I would be eternally grateful.

Regards,

Wilsy.
Title: Re: SOLVED: Latest Profile Photos
Post by: wilsy on December 22, 2007, 09:02:37 AM
Quote from: wilsy on December 02, 2007, 11:05:52 AM
Hi Dragooon,

Many thanks for the very quick response, it's really appreciated!

What I was looking for is a block that looks like: -

Male (checkbox)
Female (checkbox)
Profile Photos (checkbox)

Search Button

Regards,

Wilsy.

Quote from: Dragooon on December 02, 2007, 10:43:42 AM
It is easy,
For the Profile Photos Part Use
global $db_prefix, $ID_MEMBER, $settings;
$request = db_query("SELECT ID_PICTURE, ID_MEMBER
FROM {$db_prefix}profile_pictures
WHERE ID_MEMBER = $ID_MEMBER
ORDER BY ID_PICTURE DESC
LIMIT 1",__FILE__, __LINE__);
if(mysql_num_rows($request) > 0)
   echo 'Profile Photos : Yes';
else
   echo 'Profile Photos : No';
mysql_free_result($request);

Now for Gender you can use

$request = db_query("SELECT ID_MEMBER, gender
FROM {$db_prefix}members
WHERE ID_MEMBER = $ID_MEMBER
LIMIT 1",__FILE__,__LINE__);
$row = mysql_fetch_assoc($request);
if($row['gender'] == 1)
{
// The gender is male
echo 'Gender : <img src="',$settings['images_url'],'/Female.gif" />';
}
elseif($row['gender'] == 2)
{
// The gender is male
echo 'Gender : <img src="',$settings['images_url'],'/Male.gif" />';
}

I just wrote this while typing the reply so expect errors :P


Hi all,

I've still been trying to get the search block to work but with no joy. I guess it's just beyond what I'm capable of.

Can anybody help and provide the full code for this block? It would be just the best Christmas present ever :)

Regards,

Wilsy.
Title: Re: Latest Profile Photos
Post by: PfalzNacht on December 30, 2007, 11:39:33 PM
Hi!

How can i make it to show not the latest 5 pictures, but 5 random pictures?
Title: Re: Latest Profile Photos
Post by: wilsy on December 31, 2007, 12:22:12 AM
Hi,

Try this: -

global $db_prefix, $modSettings, $scripturl;

$sql = db_query ('SELECT p.ID_PICTURE, p.ID_MEMBER, p.title, p.time, p.filename, m.realName
FROM ' . $db_prefix . 'profile_pictures AS p, ' . $db_prefix . 'members AS m
WHERE p.ID_MEMBER = m.ID_MEMBER
ORDER BY RAND()
LIMIT 5', __FILE__, __LINE__);


$data = array();
while ($row = mysql_fetch_assoc ($sql)) {
$data[] = array (
'title' => $row['title'],
'thumb' => $modSettings['profile_pictures_url'] . '/' . $row['ID_MEMBER'] . '_' . $row['time'] . '_thumb.' . substr (strrchr ($row['filename'], '.'), 1),
'url' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . ';sa=pictures;view=' . $row['ID_PICTURE'],
'time' => timeformat ($row['time']),
'user' => $row['realName'],
'profile' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
);
}


echo '
<table cellspacing="0" cellpadding="10" border="0" ALIGN="center" width="100%">
<tr>';
foreach ($data as $picture)
{
echo '
<td><center>
<a href="', $picture['url'] ,'"><img src="' . $picture['thumb'] . '" alt="" /></a>
</center></td>';
}
echo '
</tr>
</table>';


Regards,

Wilsy
Title: Re: Latest Profile Photos
Post by: PfalzNacht on December 31, 2007, 12:38:42 AM
Thank you!

It works!  :up:
Title: Re: Latest Profile Photos
Post by: wilsy on January 03, 2008, 02:38:06 PM
Quote from: wilsy on December 22, 2007, 09:02:37 AM
Quote from: wilsy on December 02, 2007, 11:05:52 AM
Hi Dragooon,

Many thanks for the very quick response, it's really appreciated!

What I was looking for is a block that looks like: -

Male (checkbox)
Female (checkbox)
Profile Photos (checkbox)

Search Button

Regards,

Wilsy.

Quote from: Dragooon on December 02, 2007, 10:43:42 AM
It is easy,
For the Profile Photos Part Use
global $db_prefix, $ID_MEMBER, $settings;
$request = db_query("SELECT ID_PICTURE, ID_MEMBER
FROM {$db_prefix}profile_pictures
WHERE ID_MEMBER = $ID_MEMBER
ORDER BY ID_PICTURE DESC
LIMIT 1",__FILE__, __LINE__);
if(mysql_num_rows($request) > 0)
   echo 'Profile Photos : Yes';
else
   echo 'Profile Photos : No';
mysql_free_result($request);

Now for Gender you can use

$request = db_query("SELECT ID_MEMBER, gender
FROM {$db_prefix}members
WHERE ID_MEMBER = $ID_MEMBER
LIMIT 1",__FILE__,__LINE__);
$row = mysql_fetch_assoc($request);
if($row['gender'] == 1)
{
// The gender is male
echo 'Gender : <img src="',$settings['images_url'],'/Female.gif" />';
}
elseif($row['gender'] == 2)
{
// The gender is male
echo 'Gender : <img src="',$settings['images_url'],'/Male.gif" />';
}

I just wrote this while typing the reply so expect errors :P


Hi all,

I've still been trying to get the search block to work but with no joy. I guess it's just beyond what I'm capable of.

Can anybody help and provide the full code for this block? It would be just the best Christmas present ever :)

Regards,

Wilsy.

Hi all,

I hope you don't mind me giving this one a very gentle nudge. It may be that some people are back after the festive holidays and may be able to help.

Regards,

Wilsy.
Title: Re: Latest Profile Photos
Post by: Embrace on January 03, 2008, 06:56:24 PM
Can you make this so it shows just the most recently uploaded forum for the member who is viewing it...?
Title: Re: Latest Profile Photos
Post by: wilsy on January 06, 2008, 11:07:57 AM
Quote from: Embrace on January 03, 2008, 06:56:24 PM
Can you make this so it shows just the most recently uploaded forum for the member who is viewing it...?

Hi Embrace,

Sorry, I didnt quite understand that?

Regards,

Wilsy.
Title: Re: Latest Profile Photos
Post by: Embrace on January 06, 2008, 06:19:37 PM
Oh sorry, I meant

when a member is logged in, on the front page block it will show that members latest profile picture.
Title: Re: Latest Profile Photos
Post by: wilsy on January 19, 2008, 12:24:45 PM
Hi Embrace,

It's outside of my skills, it takes me days and weeks to do simple things with PHP that I'm certain takes others minutes :(

Regards,

Wilsy.
Title: Re: Latest Profile Photos
Post by: wilsy on January 21, 2008, 07:22:28 PM
Hi all,

Could someone please try to develop an article to show the following in relation to the ultimate profile photos: -

X random males with profile pictures

X random females with profile pictures

X latest males with profile pictures

X latest females with profile pictures

It would be nice if we could specify the number of images to show and the number of columns to display them in.

Any help would be appreciated. The code I have at the moment for latest profile images is below: -

Quoteglobal $db_prefix, $modSettings, $scripturl;

$sql = db_query ('SELECT p.ID_PICTURE, p.ID_MEMBER, p.title, p.time, p.filename, m.realName
   FROM ' . $db_prefix . 'profile_pictures AS p, ' . $db_prefix . 'members AS m
   WHERE p.ID_MEMBER = m.ID_MEMBER
   ORDER BY p.time DESC
   LIMIT 7', __FILE__, __LINE__);

   
$data = array();
while ($row = mysql_fetch_assoc ($sql)) {
   $data[] = array (
      'title' => $row['title'],
      'thumb' => $modSettings['profile_pictures_url'] . '/' . $row['ID_MEMBER'] . '_' . $row['time'] . '_thumb.' . substr (strrchr ($row['filename'], '.'), 1),
      'url' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . ';sa=pictures;view=' . $row['ID_PICTURE'],
      'time' => timeformat ($row['time']),
      'user' => $row['realName'],
      'profile' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
   );
}


echo '
<DIV ALIGN="CENTER">
<table width="90%">
   <tr>';
foreach ($data as $picture)
{
   echo '
      <td><center>
         <a href="', $picture['url'] ,'"><img src="' . $picture['thumb'] . '" alt="" width="65" height="65" /></a>
      </center></td>';
}
echo '
   </tr>
</table></div>';

I have a superb idea re presenting this on my site if it's possible.

Regards,

Wilsy.
Title: Re: Latest Profile Photos
Post by: wilsy on January 23, 2008, 09:22:21 AM
Dragooon very kindly contributed this earlier which may help?

Quote from: Dragooon on December 02, 2007, 10:43:42 AM
For the Profile Photos Part Use
global $db_prefix, $ID_MEMBER, $settings;
$request = db_query("SELECT ID_PICTURE, ID_MEMBER
FROM {$db_prefix}profile_pictures
WHERE ID_MEMBER = $ID_MEMBER
ORDER BY ID_PICTURE DESC
LIMIT 1",__FILE__, __LINE__);
if(mysql_num_rows($request) > 0)
   echo 'Profile Photos : Yes';
else
   echo 'Profile Photos : No';
mysql_free_result($request);

Now for Gender you can use

$request = db_query("SELECT ID_MEMBER, gender
FROM {$db_prefix}members
WHERE ID_MEMBER = $ID_MEMBER
LIMIT 1",__FILE__,__LINE__);
$row = mysql_fetch_assoc($request);
if($row['gender'] == 1)
{
// The gender is male
echo 'Gender : <img src="',$settings['images_url'],'/Female.gif" />';
}
elseif($row['gender'] == 2)
{
// The gender is male
echo 'Gender : <img src="',$settings['images_url'],'/Male.gif" />';
}

I just wrote this while typing the reply so expect errors :P

Title: Re: Latest Profile Photos
Post by: wilsy on January 25, 2008, 09:15:54 PM
Hi all,

I seem to be very slowly getting there.

I now have this which will show: x random profile photos: -

global $db_prefix, $modSettings, $scripturl;

$sql = db_query ('SELECT p.ID_PICTURE, p.ID_MEMBER, p.title, p.time, p.filename, m.realName
FROM ' . $db_prefix . 'profile_pictures AS p, ' . $db_prefix . 'members AS m
WHERE p.ID_MEMBER = m.ID_MEMBER
ORDER BY RAND()
LIMIT 99', __FILE__, __LINE__);


$data = array();
while ($row = mysql_fetch_assoc ($sql)) {
$data[] = array (
'title' => $row['title'],
'thumb' => $modSettings['profile_pictures_url'] . '/' . $row['ID_MEMBER'] . '_' . $row['time'] . '_thumb.' . substr (strrchr ($row['filename'], '.'), 1),
'url' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . ';sa=pictures;view=' . $row['ID_PICTURE'],
'time' => timeformat ($row['time']),
'user' => $row['realName'],
'profile' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
);
}


echo '
<DIV ALIGN="CENTER">
<table width="90%">
<tr>';
foreach ($data as $picture)
{
echo '
<a href="', $picture['url'] ,'"><img src="' . $picture['thumb'] . '" alt="" width="65" height="65" /></a>
';

}
echo '
</tr>
</table></div>';


..and this which shows: x last profile photos: -

global $db_prefix, $modSettings, $scripturl;

$sql = db_query ('SELECT p.ID_PICTURE, p.ID_MEMBER, p.title, p.time, p.filename, m.realName
FROM ' . $db_prefix . 'profile_pictures AS p, ' . $db_prefix . 'members AS m
WHERE p.ID_MEMBER = m.ID_MEMBER
ORDER BY p.time DESC
LIMIT 99', __FILE__, __LINE__);


$data = array();
while ($row = mysql_fetch_assoc ($sql)) {
$data[] = array (
'title' => $row['title'],
'thumb' => $modSettings['profile_pictures_url'] . '/' . $row['ID_MEMBER'] . '_' . $row['time'] . '_thumb.' . substr (strrchr ($row['filename'], '.'), 1),
'url' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . ';sa=pictures;view=' . $row['ID_PICTURE'],
'time' => timeformat ($row['time']),
'user' => $row['realName'],
'profile' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
);
}


echo '
<DIV ALIGN="CENTER">
<table width="90%">
<tr>';
foreach ($data as $picture)
{
echo '
<a href="', $picture['url'] ,'"><img src="' . $picture['thumb'] . '" alt="" width="65" height="65" /></a>
';

}
echo '
</tr>
</table></div>';


Now I need to get the first one to display: -

x random male profile photos

x random female profile photos

...and the second one to display: -

x last male profile photos

x last female profile photos

So close yet possibly so far away!  O0

DEMOS:

Random:

http://rewindlancs.com/forum/index.php?page=57

Latest:

http://rewindlancs.com/forum/index.php?page=56

Regards,

Wilsy.
Title: Re: Latest Profile Photos
Post by: wilsy on January 26, 2008, 12:15:57 AM
Hi all,

JovanT sorted this - demo on the right block (top) at www.rewindlancs.com

Regards,

Wilsy.
Title: Re: Latest Profile Photos
Post by: Reality12 on January 26, 2008, 01:49:36 AM
wilsy. i've been wanting to see how this turned out for some time.

looks really nice.

where's the block code for it?
Title: Re: Latest Profile Photos
Post by: wilsy on January 26, 2008, 09:26:05 AM
Hi Alex,

Just answered this in your post at SMF  ;)

Regards,

Rick.
Title: Re: Latest Profile Photos
Post by: G6Cad on January 26, 2008, 09:36:23 AM
Wilsy, please post it here to, if you ask support for something on this site and we give it, it's not more then fair that you share the code for it here to.
Title: Re: Latest Profile Photos
Post by: wilsy on January 26, 2008, 01:20:44 PM
Hi G6,

You know I would never disagree with you, I just didn't think there was much interest in this one thats all and I'd already answered Alex (literally!) over at SMF.

Heres the code:

global $db_prefix, $modSettings, $scripturl;

// Settings
$member_gender = 'female'; // male or female
$num_pictures = 99; // x of thumbnails to display
$order_by = 'latest'; // random or latest


$gender = ($member_gender == 'male') ? '1' : '2';
$order = ($order_by == 'random') ? 'RAND()' : 'p.time DESC';

$sql = db_query ('SELECT p.ID_PICTURE, p.ID_MEMBER, p.title, p.time, p.filename, m.realName
FROM ' . $db_prefix . 'profile_pictures AS p, ' . $db_prefix . 'members AS m
WHERE
p.ID_MEMBER = m.ID_MEMBER AND
m.gender = ' . $gender . '
ORDER BY ' . $order . '
LIMIT ' . $num_pictures, __FILE__, __LINE__);


$data = array();
while ($row = mysql_fetch_assoc ($sql)) {
$data[] = array (
'title' => $row['title'],
'thumb' => $modSettings['profile_pictures_url'] . '/' . $row['ID_MEMBER'] . '_' . $row['time'] . '_thumb.' . substr (strrchr ($row['filename'], '.'), 1),
'url' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . ';sa=pictures;view=' . $row['ID_PICTURE'],
'time' => timeformat ($row['time']),
'user' => $row['realName'],
'profile' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
);
}

echo '
<DIV ALIGN="CENTER">
<table width="90%">
<tr>';
foreach ($data as $picture)
{
echo '
<a href="', $picture['url'] ,'"><img src="' . $picture['thumb'] . '" alt="" width="65" height="65" /></a>
';

}
echo '
</tr>
</table></div>';


Regards,

Wilsy.
Title: Re: Latest Profile Photos
Post by: Zetan on January 26, 2008, 01:26:24 PM
I must say, the site looks great.  :up:

Persistent maybe.. but the additions you have incorporated make for an excellent social site.
Title: Re: Latest Profile Photos
Post by: wilsy on January 26, 2008, 04:29:55 PM
Hi ZTN,

Yes, persistent sums it up pretty well ;)

It's frustrating when you want to achieve so much yet simply dont have the skills to carry out the tasks :(

Regards,

Wilsy.
Title: Re: Latest Profile Photos
Post by: Zetan on January 26, 2008, 04:39:54 PM
That maybe so, but what have you learnt in the process?
Have you been professionally trained in website design? code?
I doubt it.

Taken 2+ years out to study it?
I doubt it.

Are you likely to? Probably not.


Thats pretty much what it takes.


I never became an electrcian by waking up one day knowing how to.. I studied hard for several years and began by thinking I knew what I was talking about.. when in reality, I didn't know donkey about it.


;)
Title: Re: Latest Profile Photos
Post by: Reality12 on January 26, 2008, 07:38:30 PM
you know, i ran over to SMF as soon as you said you responded there! :laugh:

found that response and got to working on it immediately!

i do have to say it works awesome!

...and your site looks f'in great!  ;D
Title: Re: Latest Profile Photos
Post by: eline on February 16, 2008, 12:48:44 PM
Hi wilsy
I just take a look on Yours website, its looks/have feaures like I would like to have on my web. All is clear just I dont know how did You solve Promo Girl Profile on right block?

any tips ?

regards
Title: Re: Latest Profile Photos
Post by: wilsy on February 16, 2008, 12:55:28 PM
Its a bit off topic and I know we will be shouted at here but please bear in mind that its my helpful nature that always gets me in trouble  :)

This is what I have for the promo girls block (php box)

$banners = array (
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=641"><img src="http://rewindlancs.com/forum/images/promos/isla_promo1.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=641"><img src="http://rewindlancs.com/forum/images/promos/isla_promo2.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=50"><img src="http://rewindlancs.com/forum/images/promos/sami_promo1.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=50"><img src="http://rewindlancs.com/forum/images/promos/sami_promo2.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=50"><img src="http://rewindlancs.com/forum/images/promos/sami_promo3.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=50"><img src="http://rewindlancs.com/forum/images/promos/sami_promo4.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=50"><img src="http://rewindlancs.com/forum/images/promos/sami_promo5.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=50"><img src="http://rewindlancs.com/forum/images/promos/sami_promo6.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=50"><img src="http://rewindlancs.com/forum/images/promos/sami_promo7.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=50"><img src="http://rewindlancs.com/forum/images/promos/sami_promo9.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=50"><img src="http://rewindlancs.com/forum/images/promos/sami_promo10.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=50"><img src="http://rewindlancs.com/forum/images/promos/sami_promo11.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=50"><img src="http://rewindlancs.com/forum/images/promos/sami_promo12.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=604"><img src="http://rewindlancs.com/forum/images/promos/katie_promo1.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=604"><img src="http://rewindlancs.com/forum/images/promos/katie_promo2.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=604"><img src="http://rewindlancs.com/forum/images/promos/katie_promo3.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=604"><img src="http://rewindlancs.com/forum/images/promos/katie_promo4.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=394"><img src="http://rewindlancs.com/forum/images/promos/emzi_promo1.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=394"><img src="http://rewindlancs.com/forum/images/promos/emzi_promo2.jpg"></a>',
'<div align="center"><a href="http://rewindlancs.com/forum/index.php?action=profile;u=394"><img src="http://rewindlancs.com/forum/images/promos/emzi_promo3.jpg"></a>',


);

shuffle($banners);

echo $banners[0];


You will need to upload your own images and make sure they link to the correct profiles. You will also need to find some great looking girls who are members of your site to agree to you using their photos.

Regards,

Wilsy.
Title: Re: Latest Profile Photos
Post by: eline on February 16, 2008, 05:37:26 PM
hehehe
I expected completly something else ;)
like a new option it ultimate profile - to do a PROMO on profile ;)
Tx a lot Wilsy - I will try Catch You via Your website to talk more.
Title: Re: Latest Profile Photos
Post by: forummaker on May 27, 2008, 02:45:22 AM
Question for you, I'm sure its an easy do for you. Instead of the pics showing in a row, how do I have them display in a column? And I only want the 5 most recent to display. Thanks in advance.

RemedyDog Forums (http://remedydog.com)
Where dogs would go if they could talk
Title: Re: Latest Profile Photos
Post by: Angelotus on June 13, 2008, 02:34:00 PM
Hi, which code do I have to use to show the album of the logged in user on the frontpage?
(Similar to the idea of the favorites: http://www.tinyportal.net/index.php?topic=23687.0 )
Title: Re: Latest Profile Photos
Post by: Angelotus on June 16, 2008, 09:22:59 AM
Is this thread still active or do I have to go somewhere else with my question?
Title: Re: Latest Profile Photos
Post by: IchBin on June 16, 2008, 02:59:55 PM
If your question is about this code, then you can ask. If its a different question, you need to start a topic in the appropriate board.
Title: Re: Latest Profile Photos
Post by: Angelotus on June 16, 2008, 03:49:02 PM
It is a question about this code.
I see it has moved to the previous page, so I will ask again :)

How can I add a block that shows the last 5 uploaded pics from the logged in user. So if ´Steve´ logges in he sees his 5 latest uploaded profile pics.

I hope someone can help me out with this, thanks in advance!
Title: Re: Latest Profile Photos
Post by: Dragooon on June 16, 2008, 04:52:14 PM
Try
global $db_prefix, $modSettings, $scripturl, $ID_MEMBER;

// Settings
$member_gender = 'female'; // male or female
$num_pictures = 99; // x of thumbnails to display
$order_by = 'latest'; // random or latest


$gender = ($member_gender == 'male') ? '1' : '2';
$order = ($order_by == 'random') ? 'RAND()' : 'p.time DESC';

$sql = db_query ('SELECT p.ID_PICTURE, p.ID_MEMBER, p.title, p.time, p.filename, m.realName
FROM ' . $db_prefix . 'profile_pictures AS p, ' . $db_prefix . 'members AS m
WHERE
p.ID_MEMBER = m.ID_MEMBER AND
m.gender = ' . $gender . '
               AND m.ID_MEMBER = '.$ID_MEMBER.'
ORDER BY ' . $order . '
LIMIT ' . $num_pictures, __FILE__, __LINE__);


$data = array();
while ($row = mysql_fetch_assoc ($sql)) {
$data[] = array (
'title' => $row['title'],
'thumb' => $modSettings['profile_pictures_url'] . '/' . $row['ID_MEMBER'] . '_' . $row['time'] . '_thumb.' . substr (strrchr ($row['filename'], '.'), 1),
'url' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . ';sa=pictures;view=' . $row['ID_PICTURE'],
'time' => timeformat ($row['time']),
'user' => $row['realName'],
'profile' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
);
}

echo '
<DIV ALIGN="CENTER">
<table width="90%">
<tr>';
foreach ($data as $picture)
{
echo '
<a href="', $picture['url'] ,'"><img src="' . $picture['thumb'] . '" alt="" width="65" height="65" /></a>
';

}
echo '
</tr>
</table></div>';
Title: Re: Latest Profile Photos
Post by: Angelotus on June 17, 2008, 07:52:07 AM
Dragoon Thanks! I did a little bit of tweaking to the code so it is gender independable:

global $db_prefix, $modSettings, $scripturl, $ID_MEMBER;

// Settings
$order_by = 'latest'; // random or latest


$gender = ($member_gender == 'male') ? '1' : '2';
$order = ($order_by == 'random') ? 'RAND()' : 'p.time DESC';

$sql = db_query ('SELECT p.ID_PICTURE, p.ID_MEMBER, p.title, p.time, p.filename, m.realName
FROM ' . $db_prefix . 'profile_pictures AS p, ' . $db_prefix . 'members AS m
WHERE
p.ID_MEMBER = m.ID_MEMBER
               AND m.ID_MEMBER = '.$ID_MEMBER.'
ORDER BY ' . $order . '
LIMIT 5',__FILE__, __LINE__);


$data = array();
while ($row = mysql_fetch_assoc ($sql)) {
$data[] = array (
'title' => $row['title'],
'thumb' => $modSettings['profile_pictures_url'] . '/' . $row['ID_MEMBER'] . '_' . $row['time'] . '_thumb.' . substr (strrchr ($row['filename'], '.'), 1),
'url' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . ';sa=pictures;view=' . $row['ID_PICTURE'],
'time' => timeformat ($row['time']),
'user' => $row['realName'],
'profile' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
);
}

echo '

<table class="collapse">
<tr>';
foreach ($data as $picture)
{
echo '
<td><a href="', $picture['url'] ,'"><img src="http://kv.nessekrekers.nl' . $picture['thumb'] . '" alt="" class="transOFF" onmouseover="this.className=\'transON\'" onmouseout="this.className=\'transOFF\'" /></a></td>
';

}
echo '
</tr>
</table>';


Thanks for helping!
Title: Re: Latest Profile Photos
Post by: Angelotus on June 17, 2008, 10:31:47 AM
Hi, is there a way to add a code to count the total amount of profile pictures in the logged in users album?
So I mean something like this:

[pict 1] [pict 2] [pict 3] [pict 4] [pict 5]
You have a total amount of x pics in your album.

Title: Re: Latest Profile Photos
Post by: timothy082003 on June 19, 2008, 08:01:53 AM
Could this code be modified to only show pictures from profiles that allow non-buddies to see their pictures??
Title: Re: Latest Profile Photos
Post by: Angelotus on July 05, 2008, 11:31:18 PM
Quote from: Angelotus on June 17, 2008, 10:31:47 AM
Hi, is there a way to add a code to count the total amount of profile pictures in the logged in users album?
So I mean something like this:

[pict 1] [pict 2] [pict 3] [pict 4] [pict 5]
You have a total amount of x pics in your album.



Worth a bump. Is this possible?