[ABD] Friend Request Approval MOD

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
kmklr72
Registered User
Posts: 477
Joined: Sat Dec 29, 2007 9:37 pm
Location: St. Louis, USA
Name: Kevin

Re: [DEV] Friend Request Approval MOD

Post by kmklr72 » Mon Feb 01, 2010 6:09 pm

feamor wrote:Maybe it was a code in 3.0.5 and no more exists in 3.0.6.
Most likely that is the case.
feamor wrote:Do you have any idea when you can finish the new version?
I've been rewriting all of my mods, but I honestly have no idea when I might finish this one.

User avatar
woipi90
Registered User
Posts: 908
Joined: Mon Feb 16, 2009 5:32 pm
Location: Austria

Re: [DEV] Friend Request Approval MOD

Post by woipi90 » Sun Feb 14, 2010 10:53 am

any news kmklr?


grz woipi
My mods: Ultimate Board Clubs
Support: only for the UBCS!
-----
function be_friends($uid, $u){return ($u == $user->['user_id']) ? false : true;}
$this->be_friends($uid, $user->['user_id']) ? $allow_pm : echo "You failed again";

User avatar
woipi90
Registered User
Posts: 908
Joined: Mon Feb 16, 2009 5:32 pm
Location: Austria

Re: [DEV] Friend Request Approval MOD

Post by woipi90 » Sun Feb 14, 2010 11:33 am

code daddy wrote:

Code: Select all

<?php
/**
*
* @package ucp
* @version $Id: ucp_zebra.php 8479 2008-03-29 00:22:48Z naderman $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* ucp_zebra
* @package ucp
*/
class ucp_zebra
{
	var $u_action;

	function main($id, $mode)
	{
		global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;

		$submit	= (isset($_POST['submit']) || isset($_GET['add']) || isset($_GET['remove'])) ? true : false;
		$s_hidden_fields = '';

		$l_mode = strtoupper($mode);
		
		
				// Begin FRAM MOD
		$user->add_lang('mods/fram_mod');

		$message = request_var('message', '');
		// End FRAM MOD
		
		

		if ($submit)
		{
			$data = $error = array();
			$updated = false;

			$var_ary = array(
				'usernames'	=> array(0),
				'add'		=> '',
			);

			foreach ($var_ary as $var => $default)
			{
				$data[$var] = request_var($var, $default, true);
			}

			if (!empty($data['add']) || sizeof($data['usernames']))
			{
				if (confirm_box(true))
				{
					if ($data['add'])
					{
						$data['add'] = array_map('trim', array_map('utf8_clean_string', explode("\n", $data['add'])));

						// Do these name/s exist on a list already? If so, ignore ... we could be
						// 'nice' and automatically handle names added to one list present on
						// the other (by removing the existing one) ... but I have a feeling this
						// may lead to complaints
						$sql = 'SELECT z.*, u.username, u.username_clean
							FROM ' . ZEBRA_TABLE . ' z, ' . USERS_TABLE . ' u
							WHERE z.user_id = ' . $user->data['user_id'] . '
								AND u.user_id = z.zebra_id';
						$result = $db->sql_query($sql);

						$friends = $foes = array();
						while ($row = $db->sql_fetchrow($result))
						{
							if ($row['friend'])
							{
								$friends[] = utf8_clean_string($row['username']);
							}
							else
							{
								$foes[] = utf8_clean_string($row['username']);
							}
							
							
							
							
							
							
							
														// Begin FRAM MOD
							if ($row['block'])
							{
								$blocked_users[] = utf8_clean_string($row['username']);
							}

							$requested_users[] = utf8_clean_string($row['username']);
							// End FRAM MOD
							
							
							
							
							
							
						}
						$db->sql_freeresult($result);
						
						
						// Begin FRAM MOD
						// remove blocked users from the username array
						if ($row['block'])
						{
							$n = sizeof($data['add']);
							$data['add'] = array_diff($data['add'], $blocked_users);

							if (sizeof($data['add']) < $n && $mode == 'friends')
							{
								$error[] = $user->lang['NOT_ADDED_BLOCKED'];
							}
						}

						// remove requested users from the username array
						if ($row['req_friends'])
						{
							$n = sizeof($data['add']);
							$data['add'] = array_diff($data['add'], $requested_users);

							if (sizeof($data['add']) < $n && $mode == 'friends')
							{
								$error[] = $user->lang['NOT_ADDED_REQUESTED'];
							}
						}
						// End FRAM MOD
						
						

						// remove friends from the username array
						$n = sizeof($data['add']);
						$data['add'] = array_diff($data['add'], $friends);

						if (sizeof($data['add']) < $n && $mode == 'foes')
						{
							$error[] = $user->lang['NOT_ADDED_FOES_FRIENDS'];
						}

						// remove foes from the username array
						$n = sizeof($data['add']);
						$data['add'] = array_diff($data['add'], $foes);

						if (sizeof($data['add']) < $n && $mode == 'friends')
						{
							$error[] = $user->lang['NOT_ADDED_FRIENDS_FOES'];
						}

						// remove the user himself from the username array
						$n = sizeof($data['add']);
						$data['add'] = array_diff($data['add'], array(utf8_clean_string($user->data['username'])));

						if (sizeof($data['add']) < $n)
						{
							$error[] = $user->lang['NOT_ADDED_' . $l_mode . '_SELF'];
						}

						unset($friends, $foes, $n);

						if (sizeof($data['add']))
						{
							$sql = 'SELECT user_id, user_type
								FROM ' . USERS_TABLE . '
								WHERE ' . $db->sql_in_set('username_clean', $data['add']) . '
									AND user_type <> ' . USER_INACTIVE;
							$result = $db->sql_query($sql);

							$user_id_ary = array();
							while ($row = $db->sql_fetchrow($result))
							{
								if ($row['user_id'] != ANONYMOUS && $row['user_type'] != USER_IGNORE)
								{
									$user_id_ary[] = $row['user_id'];
								}
								else
								{
									$error[] = $user->lang['NOT_ADDED_' . $l_mode . '_ANONYMOUS'];
								}
							}
							$db->sql_freeresult($result);

							if (sizeof($user_id_ary))
							{
								// Remove users from foe list if they are admins or moderators
								if ($mode == 'foes')
								{
									$perms = array();
									foreach ($auth->acl_get_list($user_id_ary, array('a_', 'm_')) as $forum_id => $forum_ary)
									{
										foreach ($forum_ary as $auth_option => $user_ary)
										{
											$perms = array_merge($perms, $user_ary);
										}
									}

									$perms = array_unique($perms);

									if (sizeof($perms))
									{
										$error[] = $user->lang['NOT_ADDED_FOES_MOD_ADMIN'];
									}

									// This may not be right ... it may yield true when perms equate to deny
									$user_id_ary = array_diff($user_id_ary, $perms);
									unset($perms);
								}
								unset($user_id_ary);
							}
							else if (!sizeof($error))
							{
								$error[] = $user->lang['USER_NOT_FOUND_OR_INACTIVE'];
							}
						}
					}
					else if (sizeof($data['usernames']))
					{
						// Force integer values
						$data['usernames'] = array_map('intval', $data['usernames']);

						$sql = 'DELETE FROM ' . ZEBRA_TABLE . '
							WHERE user_id = ' . $user->data['user_id'] . '
								AND ' . $db->sql_in_set('zebra_id', $data['usernames']);
						$db->sql_query($sql);
						
						
						
						
						
						
						
						
												// Begin FRAM MOD
						$sql = 'DELETE FROM ' . ZEBRA_TABLE . '
							WHERE ' . $db->sql_in_set('user_id', $data['usernames']) . '
								AND zebra_id = ' . $user->data['user_id'];
						$db->sql_query($sql);
						// End FRAM MOD
						
						
						
						

						$updated = true;
					}

					if ($updated)
					{
						meta_refresh(3, $this->u_action);
						$message = $user->lang[$l_mode . '_UPDATED'] . '<br />' . implode('<br />', $error) . ((sizeof($error)) ? '<br />' : '') . '<br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
						trigger_error($message);
					}
					else
					{
						$template->assign_var('ERROR', implode('<br />', $error));
					}
				}
				else
				{
					confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
						'mode'		=> $mode,
						'submit'	=> true,
						'usernames'	=> $data['usernames'],						'add'		=> $data['add'],
						'message'	=> $message))
					);
				}
			}
		}

		$sql_and = ($mode == 'friends') ? 'z.friend = 1' : 'z.foe = 1';
		$sql = 'SELECT z.*, u.username, u.username_clean
			FROM ' . ZEBRA_TABLE . ' z, ' . USERS_TABLE . ' u
			WHERE z.user_id = ' . $user->data['user_id'] . "
				AND $sql_and
				AND u.user_id = z.zebra_id
			ORDER BY u.username_clean ASC";
		$result = $db->sql_query($sql);

		$s_username_options = '';
		while ($row = $db->sql_fetchrow($result))
		{
			$s_username_options .= '<option value="' . $row['zebra_id'] . '">' . $row['username'] . '</option>';
		}
		$db->sql_freeresult($result);

		$template->assign_vars(array(
			'L_TITLE'			=> $user->lang['UCP_ZEBRA_' . $l_mode],

			'U_FIND_USERNAME'	=> append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=add'),

			'S_USERNAME_OPTIONS'	=> $s_username_options,
			'S_HIDDEN_FIELDS'		=> $s_hidden_fields,
			'S_UCP_ACTION'			=> $this->u_action)
		);

		$this->tpl_name = 'ucp_zebra_' . $mode;
		$this->page_title = 'UCP_ZEBRA_' . $l_mode;
	}
}

?>    // Begin FRAM MOD
								if (sizeof($user_id_ary))
								{
									$sql_mode = ($mode == 'friends') ? 'friend' : 'foe';

									if ($mode == 'friends')
									{
										$sql_ary = array();
										foreach ($user_id_ary as $zebra_id)
										{
											$sql_ary[] = array(
												'user_id'		=> (int) $user->data['user_id'],
												'zebra_id'		=> (int) $zebra_id,
												'message'		=> $message,
												'req_friends'		=> 1,
											);
										}

										$db->sql_multi_insert(ZEBRA_TABLE, $sql_ary);

										$sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . $zebra_id;
										$result = $db->sql_query($sql);
										$row = $db->sql_fetchrow($result);
										$db->sql_freeresult($result);

										$requests = $row['requests'] + 1;

										$sql = 'UPDATE ' . USERS_TABLE . ' SET requests = ' . $requests . ' WHERE user_id = ' . $zebra_id;
										$db->sql_query($sql);

										$updated = true;

										unset($user_id_ary);
										meta_refresh(3, $this->u_action);
										trigger_error($user->lang['FRAM_REQUESTED']);
									}
									else
									{
										$sql_ary = array();
										foreach ($user_id_ary as $zebra_id)
										{
											$sql_ary[] = array(
												'user_id'		=> (int) $user->data['user_id'],
												'zebra_id'		=> (int) $zebra_id,
												'foe'			=> 1
											);
										}

										$db->sql_multi_insert(ZEBRA_TABLE, $sql_ary);

										$updated = true;
									}
								}
								// End FRAM MOD
just took a look at the code and saw that you inserted the code part after ?> and not before?!


grz woipi
My mods: Ultimate Board Clubs
Support: only for the UBCS!
-----
function be_friends($uid, $u){return ($u == $user->['user_id']) ? false : true;}
$this->be_friends($uid, $user->['user_id']) ? $allow_pm : echo "You failed again";

User avatar
sleevedbiker
Registered User
Posts: 789
Joined: Mon Oct 12, 2009 4:33 pm

Re: [DEV] Friend Request Approval MOD

Post by sleevedbiker » Tue Feb 16, 2010 8:22 pm

Not a big problem, i can remove the code, when you release the new code.
Do you know when today you are gonna release teh new code?
You ride with an outlaw, You die with an outlaw

kmklr72
Registered User
Posts: 477
Joined: Sat Dec 29, 2007 9:37 pm
Location: St. Louis, USA
Name: Kevin

Re: [DEV] Friend Request Approval MOD

Post by kmklr72 » Tue Feb 16, 2010 10:16 pm

I don't know just yet. I've decided to just rewrite the UCP zebra page (friends and foes pages). While this isn't hard, it is time consuming so I haven't been able to do much work on it. I will continue on it soon though ;) .

anthies
Registered User
Posts: 162
Joined: Sun May 17, 2009 10:40 am
Location: Finland, Klaukkala
Name: Janne
Contact:

Re: [DEV] Friend Request Approval MOD

Post by anthies » Wed Feb 17, 2010 5:01 am

Hi,

Does this work on a phpBB 3.0.6 board?

Peter77sx
Registered User
Posts: 3253
Joined: Wed Nov 09, 2005 2:51 pm

Re: [DEV] Friend Request Approval MOD

Post by Peter77sx » Thu Mar 04, 2010 12:23 pm

How's it going? :)

kmklr72
Registered User
Posts: 477
Joined: Sat Dec 29, 2007 9:37 pm
Location: St. Louis, USA
Name: Kevin

Re: [DEV] Friend Request Approval MOD

Post by kmklr72 » Thu Mar 04, 2010 9:18 pm

I haven't made much progress because real life has been getting in the way :lol: . I am still interested in working on this mod, but I have no idea when I will be able to get some good solid code out. I have been working on it a bit though, so don't think there isn't any development at all.

Jhonne
Registered User
Posts: 21
Joined: Sat Feb 27, 2010 7:36 pm

Re: [DEV] Friend Request Approval MOD

Post by Jhonne » Sun Mar 07, 2010 8:26 am

Hello, Im using phpbb 3.0.7 and I tried to instal this mod and I have a problem. After a request sent it doesnt show any options to either accept or reject the request for the person who got it.

Code: Select all

		                        // Force integer values
						$data['usernames'] = array_map('intval', $data['usernames']);

						$sql = 'DELETE FROM ' . ZEBRA_TABLE . '
							WHERE user_id = ' . $user->data['user_id'] . '
								AND ' . $db->sql_in_set('zebra_id', $data['usernames']);
						$db->sql_query($sql);
I couldnt find this code in my includes/ucp/ucp_zebra.php file. Anyone know what I can do to fix this problem?

Peter77sx
Registered User
Posts: 3253
Joined: Wed Nov 09, 2005 2:51 pm

Re: [DEV] Friend Request Approval MOD

Post by Peter77sx » Wed Mar 17, 2010 3:11 am

Jhonne, the edit to look for is

Code: Select all

// Remove users
					if (!empty($data['usernames']))
					{
						$sql = 'DELETE FROM ' . ZEBRA_TABLE . '
							WHERE user_id = ' . $user->data['user_id'] . '
								AND ' . $db->sql_in_set('zebra_id', $data['usernames']);
						$db->sql_query($sql);
Was changed in 3.0.6
kmklr72 wrote:I haven't made much progress because real life has been getting in the way :lol: . I am still interested in working on this mod, but I have no idea when I will be able to get some good solid code out. I have been working on it a bit though, so don't think there isn't any development at all.
Alright, thanks for the update. Glad your still working on this even if it's a bit at a time. :)


BTW, it would be nice to see a pending request kinda deal. I guess that would be my newest request.

cubansephiroth
Registered User
Posts: 2
Joined: Sun Dec 27, 2009 11:29 pm

Re: [DEV] Friend Request Approval MOD

Post by cubansephiroth » Mon Mar 29, 2010 5:06 pm

I installed very well in my 3.0.7-PL1 the only thing is i cant remove a friend once it's in my friend list. The link remove friend give me an empty page. ????????

User avatar
darkonia
Registered User
Posts: 1901
Joined: Tue May 13, 2008 1:10 pm
Location: Munich, Germany
Contact:

Re: [DEV] Friend Request Approval MOD

Post by darkonia » Mon Mar 29, 2010 6:03 pm

its an old problem, same as befriend some users, when the user was one-times on the irgnore-list.

but the dev of this mod dont make this awseome feature clear of bugs....

:?
MMOG-Heaven - Das Gaming Portal
Community bedeutet Gleichgesinnte finden - MMOG-Heaven ist Deine Community! Von Spielern für Spieler bietet Dir dieses Portal genau das, was ein Spieler braucht. Bleibe ständig informiert, finde die neuesten MMORPGs, oder suche die frischesten News aus der Welt des Online Gamings - dieses und vieles mehr erwartet Dich auf MMOG-Heaven.

InterJoomla
Registered User
Posts: 3
Joined: Sun May 24, 2009 9:50 pm

Re: [DEV] Friend Request Approval MOD

Post by InterJoomla » Tue Mar 30, 2010 9:28 pm

I updated the mod, but needs to be tested

also spanish translation added

:arrow: Friend Request Approval MOD v.0.0.2.zip

superj707
Registered User
Posts: 1136
Joined: Thu Feb 26, 2009 12:20 am

Re: [DEV] Friend Request Approval MOD

Post by superj707 » Tue Mar 30, 2010 9:32 pm

InterJoomla wrote:I updated the mod, but needs to be tested

also spanish translation added

:arrow: Friend Request Approval MOD v.0.0.2.zip
can you list the updates? new features or just fixes?

InterJoomla
Registered User
Posts: 3
Joined: Sun May 24, 2009 9:50 pm

Re: [DEV] Friend Request Approval MOD

Post by InterJoomla » Wed Mar 31, 2010 3:22 pm

superj707 wrote:
InterJoomla wrote:I updated the mod, but needs to be tested

also spanish translation added

:arrow: Friend Request Approval MOD v.0.0.2.zip
can you list the updates? new features or just fixes?
  • * I update the xml install file to 1.2.5, checked all modifications from 3.0.7-PL1
  • * Changed the overall_header friends request approval status (for some reason that don't work in my forum installed with automod)
  • * memberlist profile style (now is prosilver default styling)
  • * fixes in php files
  • * added spanish translation (see contrib)

Locked

Return to “[3.0.x] Abandoned MODs”