[RC] Profile friends 1.0.2

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Suggested Hosts
User avatar
adcantu
Registered User
Posts: 212
Joined: Wed Apr 21, 2004 12:08 am

Re: [RC] Profile friends 1.0.1

Post by adcantu »

would you be willing to share how you accomplished that hack?

Do you mean you would like a list of people who also have the user as a friend?
platinum_2007
Registered User
Posts: 1101
Joined: Tue Jul 22, 2008 2:47 am
Location: Nova Scotia, Canada

Re: [RC] Profile friends 1.0.1

Post by platinum_2007 »

Anyasha wrote:This is a wonderful MOD! I however added one little tweak because I like to give my users as much control over their profile as possible: I made the display of friends an option in their UCP.

Is there a quick way to make a "friends of" list display in the profiles as well?
You could do it by taking my friends list mod and switching up the query a bit
Anyasha
Registered User
Posts: 704
Joined: Mon Aug 07, 2006 4:02 am
Name: Anyasha

Re: [RC] Profile friends 1.0.1

Post by Anyasha »

adcantu wrote:Do you mean you would like a list of people who also have the user as a friend?
Yes.
platinum_2007 wrote:You could do it by taking my friends list mod and switching up the query a bit
That's what I meant, but I don't know what to change in the SQL query. :)
Kiss me, I'm Polish!
ibelphegor
Registered User
Posts: 453
Joined: Wed Oct 24, 2007 8:37 am

Re: [RC] Profile friends 1.0.1

Post by ibelphegor »

Nice mod but the the counting is wrong (number of friends). you can see even in your site:
http://street-steeze.com/memberlist.php ... rofile&u=2

I don't know how the counting work, but for example if in acp add
Number of friends per page: 10 i can see only 6 and option to next page to see 7
more. and the total is 19.

Edit: I think the problem is That hi count users with no avatar, but not show that users.
Edit2: I add AVATAR to group still in total It's wrong. all the time it's show 1 count more.
flexx
Registered User
Posts: 75
Joined: Thu Aug 30, 2007 8:16 pm

Re: [RC] Profile friends 1.0.1

Post by flexx »

I have problems.....it looks like this:

Image


greetz


edit:

I found outh that I missed some SQL-instruktions.....but I tried to do this:
INSERT INTO phpbb_config (config_name, config_value) VALUES ('number_friends', '50');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('friend_avatar_size', '50');
but then....
SQL-Befehl:

INSERT INTO phpbb_config( config_name, config_value )
VALUES (
'number_friends', '50'
);

MySQL meldet: Dokumentation
#1062 - Duplicate entry 'number_friends' for key 1
platinum_2007
Registered User
Posts: 1101
Joined: Tue Jul 22, 2008 2:47 am
Location: Nova Scotia, Canada

Re: [RC] Profile friends 1.0.1

Post by platinum_2007 »

That means you already did the SQL.

You need to purge your cache and/or refresh your theme to fix the first problem.
flexx
Registered User
Posts: 75
Joined: Thu Aug 30, 2007 8:16 pm

Re: [RC] Profile friends 1.0.1

Post by flexx »

yes, that is it^^ thx ;)
User avatar
keith10456
Registered User
Posts: 2315
Joined: Thu Feb 24, 2005 6:55 pm
Contact:

Re: [RC] Profile friends 1.0.1

Post by keith10456 »

Anyasha wrote:This is a wonderful MOD! I however added one little tweak because I like to give my users as much control over their profile as possible: I made the display of friends an option in their UCP.


How did you do it?
zagor256
Registered User
Posts: 60
Joined: Sun Aug 03, 2008 2:04 pm
Contact:

Re: [RC] Profile friends 1.0.1

Post by zagor256 »

If you don't have default avatar mod instaled friends with no avatar won't show.

so you have to change line in memberlist_view with something like this

<!-- IF fri.USER_COLOR --><span style="color:#{fri.USER_COLOR}"><!-- ELSE --><span style="color:#000"><!-- ENDIF --><b>{fri.USERNAME}</b><br />{fri.FRI_AV}</span><!-- IF fri.FRI_AV_THUMB -->{fri.FRI_AV_THUMB}<!-- ELSE --><img src="{T_THEME_PATH}/images/no_avatar.gif" width="50" height="50" alt="" /><!-- ENDIF --></a><!-- END fri -->

And put image for no avatar in images directory on your theme.
User avatar
phreakwars
Registered User
Posts: 242
Joined: Thu Feb 22, 2007 4:57 am
Location: Polaris Industries

Re: [RC] Profile friends 1.0.1

Post by phreakwars »

I'm getting the following error:

Code: Select all

Table 'eclark_phpb1.PROFILE_VIEWS_TABLE' doesn't exist [1146]

SQL

SELECT * FROM PROFILE_VIEWS_TABLE WHERE profile_user_id = 460 AND viewer_user_id = 2

BACKTRACE

FILE: includes/db/mysql.php
LINE: 174
CALL: dbal->sql_error()

FILE: includes/functions_profileviews.php
LINE: 33
CALL: dbal_mysql->sql_query()

FILE: memberlist.php
LINE: 443
CALL: count_visit()
First of all

Code: Select all

Table 'eclark_phpb1.PROFILE_VIEWS_TABLE' doesn't exist
Duh, I use a different prefix, (phpb3)
Image

I corrected the SQL entry before I installed it, but for some reason, it still trys to call from the table phpb1
.
.
MODS by me: Default Topic Icon
platinum_2007
Registered User
Posts: 1101
Joined: Tue Jul 22, 2008 2:47 am
Location: Nova Scotia, Canada

Re: [RC] Profile friends 1.0.1

Post by platinum_2007 »

This should not have anything to do about my mod but rather a profile views mod you have installed?


But it looks like you are missing a edit in includes/constants.php
User avatar
phreakwars
Registered User
Posts: 242
Joined: Thu Feb 22, 2007 4:57 am
Location: Polaris Industries

Re: [RC] Profile friends 1.0.1

Post by phreakwars »

That's the strange part, the board was fine until I installed this MOD, used AUTOMOD. It installed just fine (according to AUTOMOD), but for some reason it is now conflicting with another MOD....Hmmm...

Guess I'm gonna have to go back and manually check out the edits.
.
.
MODS by me: Default Topic Icon
User avatar
phreakwars
Registered User
Posts: 242
Joined: Thu Feb 22, 2007 4:57 am
Location: Polaris Industries

Re: [RC] Profile friends 1.0.1

Post by phreakwars »

Nope, tried again and again, not sure what the exact problem is, but I know the instruction line that is giving me problems is this one:


Find:

Code: Select all

$group_options .= '<option value="' . $row['group_id'] . '"' . (($row['group_id'] == $member['group_id']) ? ' selected="selected"' : '') . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
		}
		$db->sql_freeresult($result);
Add After:

Code: Select all

// friend list mod by ian-taylor.ca
$user_id = request_var('u', 0);
$start   = request_var('start', 0);
$limit = request_var('limit', intval($config['number_friends']));
$sql = 'SELECT u.user_avatar, u.username, u.user_colour, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, z.user_id, z.zebra_id, z.friend FROM phpbb_users u, phpbb_zebra z WHERE u.user_id=z.zebra_id AND z.friend = 1 AND z.user_id = '.$user_id;
$result = $db->sql_query_limit($sql, $limit, $start);
			
while($row_av = $db->sql_fetchrow( $result )) {
$avatar_fri = get_user_avatar($row_av['user_avatar'], $row_av['user_avatar_type'], $row_av['user_avatar_width'], $row_av['user_avatar_height']);
$fri_id = $row_av['zebra_id'];
$av_size_size = $config['friend_avatar_size'];

$template->assign_block_vars('fri',array(

		'FRI_ID'	=> $row_av['zebra_id'],
		'FRI_AV'	=> $avatar_fri,
		'USERNAME'	=> $row_av['username'],	
		'USER_COLOR' => $row_av['user_colour'],
		'AV_LINK'	=> append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=$fri_id"),		
		'FRI_AV_THUMB'	=>   ($row_av['user_avatar']) ? get_user_avatar($row_av['user_avatar'], $row_av['user_avatar_type'], ($row_av['user_avatar_width'] > $row_av['user_avatar_height']) ? $av_size_size : ($av_size_size / $row_av['user_avatar_height']) * $row_av['user_avatar_width'], ($row_av['user_avatar_height'] > $row_av['user_avatar_width']) ? $av_size_size : ($av_size_size / $row_av['user_avatar_width']) * $row_av['user_avatar_height']) : '',
));
}
// count some stuff up for the pagination
$profile = request_var('u', 0);
$sql = 'SELECT COUNT(zebra_id) AS number_friends FROM '. ZEBRA_TABLE ." WHERE user_id=$profile AND friend = 1";
$result = $db->sql_query($sql);
$pagination_friend = append_sid($phpbb_root_path . 'memberlist.' . $phpEx ,'mode=viewprofile&u='.$user_id);

$total_friends = $db->sql_fetchfield('number_friends');
$db->sql_freeresult($result);

$template->assign_vars(array(
    'FRINATION'        => generate_pagination($pagination_friend, $total_friends, $limit, $start),
    'PAGE_NUMBER_F'       => on_page($total_friends, $limit, $start),
    'TOTAL_FRIENDS'       => ($total_friends == 1) ? $user->lang['LIST_FRIEND'] : sprintf($user->lang['LIST_FRIENDS'], $total_friends),

));

// end friend list mod by ian-taylor.ca
.
.
MODS by me: Default Topic Icon
User avatar
phreakwars
Registered User
Posts: 242
Joined: Thu Feb 22, 2007 4:57 am
Location: Polaris Industries

Re: [RC] Profile friends 1.0.1

Post by phreakwars »

If it helps, a sample of the completed lines in memberlist.php:

Code: Select all

// Do the SQL thang
		$sql = 'SELECT g.group_id, g.group_name, g.group_type
			FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug
			WHERE ug.user_id = $user_id
				AND g.group_id = ug.group_id" . ((!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? ' AND g.group_type <> ' . GROUP_HIDDEN : '') . '
				AND ug.user_pending = 0
			ORDER BY g.group_type, g.group_name';
		$result = $db->sql_query($sql);

		$group_options = '';
		while ($row = $db->sql_fetchrow($result))
		{
			$group_options .= '<option value="' . $row['group_id'] . '"' . (($row['group_id'] == $member['group_id']) ? ' selected="selected"' : '') . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
		}
		$db->sql_freeresult($result);
		// friend list mod by ian-taylor.ca
$user_id = request_var('u', 0);
$start   = request_var('start', 0);
$limit = request_var('limit', intval($config['number_friends']));
$sql = 'SELECT u.user_avatar, u.username, u.user_colour, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, z.user_id, z.zebra_id, z.friend FROM phpbb_users u, phpbb_zebra z WHERE u.user_id=z.zebra_id AND z.friend = 1 AND z.user_id = '.$user_id;
$result = $db->sql_query_limit($sql, $limit, $start);
			
while($row_av = $db->sql_fetchrow( $result )) {
$avatar_fri = get_user_avatar($row_av['user_avatar'], $row_av['user_avatar_type'], $row_av['user_avatar_width'], $row_av['user_avatar_height']);
$fri_id = $row_av['zebra_id'];
$av_size_size = $config['friend_avatar_size'];

$template->assign_block_vars('fri',array(

		'FRI_ID'	=> $row_av['zebra_id'],
		'FRI_AV'	=> $avatar_fri,
		'USERNAME'	=> $row_av['username'],	
		'USER_COLOR' => $row_av['user_colour'],
		'AV_LINK'	=> append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=$fri_id"),		
		'FRI_AV_THUMB'	=>   ($row_av['user_avatar']) ? get_user_avatar($row_av['user_avatar'], $row_av['user_avatar_type'], ($row_av['user_avatar_width'] > $row_av['user_avatar_height']) ? $av_size_size : ($av_size_size / $row_av['user_avatar_height']) * $row_av['user_avatar_width'], ($row_av['user_avatar_height'] > $row_av['user_avatar_width']) ? $av_size_size : ($av_size_size / $row_av['user_avatar_width']) * $row_av['user_avatar_height']) : '',
));
}
// count some stuff up for the pagination
$profile = request_var('u', 0);
$sql = 'SELECT COUNT(zebra_id) AS number_friends FROM '. ZEBRA_TABLE ." WHERE user_id=$profile AND friend = 1";
$result = $db->sql_query($sql);
$pagination_friend = append_sid($phpbb_root_path . 'memberlist.' . $phpEx ,'mode=viewprofile&u='.$user_id);

$total_friends = $db->sql_fetchfield('number_friends');
$db->sql_freeresult($result);

$template->assign_vars(array(
    'FRINATION'        => generate_pagination($pagination_friend, $total_friends, $limit, $start),
    'PAGE_NUMBER_F'       => on_page($total_friends, $limit, $start),
    'TOTAL_FRIENDS'       => ($total_friends == 1) ? $user->lang['LIST_FRIEND'] : sprintf($user->lang['LIST_FRIENDS'], $total_friends),

));

// end friend list mod by ian-taylor.ca		
		// What colour is the zebra
		$sql = 'SELECT friend, foe
			FROM ' . ZEBRA_TABLE . "
			WHERE zebra_id = $user_id
				AND user_id = {$user->data['user_id']}";

		$result = $db->sql_query($sql);
		$row = $db->sql_fetchrow($result);
		$foe = ($row['foe']) ? true : false;
		$friend = ($row['friend']) ? true : false;
		$db->sql_freeresult($result);

		if ($config['load_onlinetrack'])
		{
			$sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline
				FROM ' . SESSIONS_TABLE . "
				WHERE session_user_id = $user_id";
			$result = $db->sql_query($sql);
			$row = $db->sql_fetchrow($result);
			$db->sql_freeresult($result);

			$member['session_time'] = (isset($row['session_time'])) ? $row['session_time'] : 0;
			$member['session_viewonline'] = (isset($row['session_viewonline'])) ? $row['session_viewonline'] :	0;
			unset($row);
		}

		if ($config['load_user_activity'])
		{
			display_user_activity($member);
		}

		// Do the relevant calculations
.
.
MODS by me: Default Topic Icon
platinum_2007
Registered User
Posts: 1101
Joined: Tue Jul 22, 2008 2:47 am
Location: Nova Scotia, Canada

Re: [RC] Profile friends 1.0.1

Post by platinum_2007 »

Remove the block of code you added from my mod in your memberlist.php and tell me if you still get the error. But like i said profile_views_table is not a table that i made with this mod rather there is another mod you must have installed.
Locked

Return to “[3.0.x] MODs in Development”