Login     Sign up
adding members as friend in browse
Jcow Master (@falcone)
Join date: Sep 2nd 2010
Community posts: 917
View Profile
Send Message

file to modify: includes/libs/browse.module.php

function index

change
[code]
section_content('<ul class="small_avatars">');
[/code]
into
[code]
section_content('<ul class="gallery">');
[/code]

then look for line
[code]
while ($member = sql_fetch_array($res)) {
[/code]
replace code

[code]
while ($member = sql_fetch_array($res)) {
$isfriend = 0;
if (($client['id']) && ($client['id'] != $member['id'])) {
$isfriend = sql_counts(sql_query("SELECT * FROM ".tb()."friends WHERE uid={$member['id']} and fid={$client['id']}"));
}
$i++;
if ($i < $num_per_page) {
$age = $gender = $local = '';
if ($member['gender'] != 2) {
$gender = gender($member['gender']);
}
if (!$member['hide_age']) {
$age = ', '.get_age($member['birthyear']);
}
section_content('<li><span>'.url('u/'.$member['username'],$member['username']).'</span><br />
'.avatar($member).'<br />'
.$gender
.$age);
if ((!$isfriend) && ($client['id'] != $member['id']) ) {
section_content('<br />'.url('friends/add/'.$member['id'],t('add as friend')));
}
section_content ('</li>');
}
}
[/code]

165 months ago
emjhie Bahrink (@emjhie)
Join date: Sep 27th 2010
Community posts: 91
View Profile
Send Message

The most awaited code is already here .. but blank browse page after use code..

165 months ago
arizon efendi (@arizon)
Join date: Aug 26th 2010
Community posts: 145
View Profile
Send Message

Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION in /home/temanku/public_html/social/includes/libs/browse.module.php on line 217

???? fix please

165 months ago
arizon efendi (@arizon)
Join date: Aug 26th 2010
Community posts: 145
View Profile
Send Message

original code===>

[code]
while ($member = sql_fetch_array($res)) {
$i++;
if ($i < $num_per_page) {
$age = $gender = $local = '';
if ($member['gender'] != 2) {
$gender = gender($member['gender']);
}
if (!$member['hide_age']) {
$age = ', '.get_age($member['birthyear']);
}
section_content('<li><span>'.url('u/'.$member['username'],$member['username']).'</span><br />
'.avatar($member).'<br />'
.$gender
.$age.'</li>');
}
}

[/code]

replace with ====>

[code]
while ($member = sql_fetch_array($res)) {
$isfriend = 0;
if (($client['id']) && ($client['id'] != $member['id'])) {
$isfriend = sql_counts(sql_query("SELECT * FROM ".tb()."friends WHERE uid={$member['id']} and fid={$client['id']}"));
}
$i++;
if ($i < $num_per_page) {
$age = $gender = $local = '';
if ($member['gender'] != 2) {
$gender = gender($member['gender']);
}
if (!$member['hide_age']) {
$age = ', '.get_age($member['birthyear']);
}
section_content('<li><span>'.url('u/'.$member['username'],$member['username']).'</span><br />
'.avatar($member).'<br />'
.$gender
.$age);
if ((!$isfriend) && ($client['id'] != $member['id']) ) {
section_content('<br />'.url('friends/add/'.$member['id'],t('add as friend')));
}
section_content ('</li>');
}
}

[/code]

its work at my network.. thanks "god php" falcone.

if you want to see more people. not just 12, please edit
my/config.php

[code]

$num_per_page = 12;

[/code]

change 12 to whatever you want . example 50

[code]

$num_per_page = 50;

[/code]

165 months ago
werewolves69 (@werewolves69)
Join date: Oct 27th 2010
Community posts: 14
View Profile
Send Message

Perfect Thank you arizon

164 months ago
arizon efendi (@arizon)
Join date: Aug 26th 2010
Community posts: 145
View Profile
Send Message

you are welcome

164 months ago
sinici (@sinici)
Join date: Nov 26th 2010
Community posts: 24
View Profile
Send Message

thumbs up....:-D

164 months ago
kingmagi (@king10magi)
Join date: Sep 6th 2010
Community posts: 97
View Profile
Send Message

yeah coolz its work!! Thank You Very Much!

164 months ago
Eliz zeta (@eliz)
Join date: Nov 29th 2010
Community posts: 153
View Profile
Send Message

one of the best features to activate a social network.
not tested yet in mine but i will do it right now.
Falcone : Yur the best

164 months ago
sinici (@sinici)
Join date: Nov 26th 2010
Community posts: 24
View Profile
Send Message

[quote=eliz]one of the best features to activate a social network.
not tested yet in mine but i will do it right now.
Falcone : Yur the best[/quote]

yeaaa...I do not believe if human Falcone..:-D
@falcone...just kiding master:-D

164 months ago
Eliz zeta (@eliz)
Join date: Nov 29th 2010
Community posts: 153
View Profile
Send Message

and if not too much, how to add a new line, if user is friend, so follow , i tiried this if (($isfriend) but i dont know wich url is the correct replacing friends/add.

if (($isfriend) && ($client['id'] != $member['id']) ) {
section_content('<br />'.url('friends/add/'.$member['id'],t('follow')));
}

164 months ago
Tim (@timothy)
Join date: Mar 17th 2011
Community posts: 31
View Profile
Send Message

Please can someone direct me on how to locate this file
'includes/libs/browse.module.php'

Tks

160 months ago
1 2 Next