Default friends & foes ??

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Suggested Hosts
Locked
User avatar
wingnut144
Registered User
Posts: 595
Joined: Thu Jan 20, 2005 4:52 pm
Location: Boise, ID
Contact:

Default friends & foes ??

Post by wingnut144 »

Is there a way to have new registered users be assigned a default person as a 'friend' when their registration info is being added to the database??

I'd like every member to be assigned myself (or someone else I know) as a friend by default.

Possible?? :)
User avatar
wingnut144
Registered User
Posts: 595
Joined: Thu Jan 20, 2005 4:52 pm
Location: Boise, ID
Contact:

Re: Default friends & foes ??

Post by wingnut144 »

Anyone ??
wentwooddownhill
Registered User
Posts: 327
Joined: Sat Feb 17, 2007 9:15 pm
Contact:

Re: Default friends & foes ??

Post by wentwooddownhill »

Id also be interested in this
visit our mountainbike comunity on http://www.wentwooddownhill.co.uk
User avatar
wingnut144
Registered User
Posts: 595
Joined: Thu Jan 20, 2005 4:52 pm
Location: Boise, ID
Contact:

Re: Default friends & foes ??

Post by wingnut144 »

Yea, would be nice to see if its possible....
User avatar
dellsystem
Former Team Member
Posts: 3879
Joined: Sat Apr 09, 2005 8:54 pm
Location: Montreal
Name: Wendy
Contact:

Re: Default friends & foes ??

Post by dellsystem »

Moved to MOD Requests, closed your other topic in Discussion as well - no need to open a duplicate topic :)
Former moderator and website team member | My MODs, and more (GitHub)
m0nk3h
Registered User
Posts: 63
Joined: Tue Nov 02, 2004 7:54 pm

Re: Default friends & foes ??

Post by m0nk3h »

includes\constants.php

Find:

Code: Select all

define('ZEBRA_TABLE',				$table_prefix . 'zebra');
After (2 being the default friend ID):

Code: Select all

define('DEFAULT_FRIEND',			2);
save & close constants.php

includes\functions_user.php

Find:

Code: Select all

// Insert Custom Profile Fields
	if ($cp_data !== false && sizeof($cp_data))
	{
		$cp_data['user_id'] = (int) $user_id;

		if (!class_exists('custom_profile'))
		{
			include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
		}

		$sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' .
			$db->sql_build_array('INSERT', custom_profile::build_insert_sql_array($cp_data));
		$db->sql_query($sql);
	}
After:

Code: Select all

	$sql = 'INSERT INTO ' . ZEBRA_TABLE . ' ' . $db->sql_build_array('INSERT', array(
			'user_id'	=>(int) $user_id,
			'zebra_id' 	=> (int) DEFAULT_FRIEND,
			'friend'	=> 1,
			'foe'		=> 0)
		);
		$db->sql_query($sql);
The search function is a very good tool. Use it before asking your questions.
User avatar
wingnut144
Registered User
Posts: 595
Joined: Thu Jan 20, 2005 4:52 pm
Location: Boise, ID
Contact:

Re: Default friends & foes ??

Post by wingnut144 »

That seems to work perfectly, thanks!! :)
User avatar
PowWowPalace
Registered User
Posts: 58
Joined: Thu Jul 09, 2009 3:28 pm
Contact:

Re: Default friends & foes ??

Post by PowWowPalace »

This works great. Can someone modify it so that when a new user becomes a member they appear on the Admin's (2) friend list also. Right now this only adds the Admin (2) to the new member's friend list.

Thanks
User avatar
LexusAutosports
Registered User
Posts: 24
Joined: Fri Apr 16, 2010 7:51 pm
Contact:

Re: Default friends & foes ??

Post by LexusAutosports »

PowWowPalace wrote:This works great. Can someone modify it so that when a new user becomes a member they appear on the Admin's (2) friend list also. Right now this only adds the Admin (2) to the new member's friend list.

Thanks
I just did this mod in phpBB 3.0.7-PL1 and it works fine. Has anyone figured out how to put the newly registered user to the forum's admin friend's list after registering. So everytime a new member joins, they are automatically added to the admin's friend list.

Thanks
Lexus Autosports - Show Off Your Lexus
http://www.lexusautosports.com
Anyasha
Registered User
Posts: 704
Joined: Mon Aug 07, 2006 4:02 am
Name: Anyasha

Re: Default friends & foes ??

Post by Anyasha »

I believe you'd just switch it around like this

Code: Select all

   $sql = 'INSERT INTO ' . ZEBRA_TABLE . ' ' . $db->sql_build_array('INSERT', array(
         'user_id'   => (int) DEFAULT_FRIEND,
         'zebra_id'    => (int) $user_id,
         'friend'   => 1,
         'foe'      => 0)
      );
      $db->sql_query($sql);
Kiss me, I'm Polish!
Locked

Return to “[3.0.x] MOD Requests”