- You are here:
- Main › Forum › Bug Tracker
[#3 cBB Follower] SQL Error, phpBB 3.0.11 and notifications
2 posts
• Page 1 of 1
- IvanPF
- Administrator
- Posts: 2010
- Joined: Fri Jun 17, 2011 12:15 am
- Location: España (Spain)
Mon Sep 10, 2012 10:38 pm • via Web
MOD: cBB Follower 1.0.0 [Beta]
Error: On posting or reply, an SQL error occurs similar to this:
Solution:
1. Open /follower/includes/functions_follower.php
2. Find:
3. Replace with:
4. Find:
5. Replace with:
6. Find:
7. Replace with:
8. Find:
9. Add After:
10. Find:
11. Replace with:
12. Open /follower/follower.php
13. Find:
14. Replace with:
Error: On posting or reply, an SQL error occurs similar to this:
Error General
SQL ERROR [ mysql4 ]
Unknown column 'Array' in 'where clause' [1054]
SQL
SELECT u.user_id, u.user_email, u.username, u.user_lang, u.user_notify_options FROM (phpbb_follower_track ft) LEFT JOIN phpbb_users u ON (u.user_id = ft.user_id) WHERE ft.follow_id = 2 AND u.user_id NOT IN (Array) AND u.user_type IN (0, 3)
Solution:
1. Open /follower/includes/functions_follower.php
2. Find:
- Code: Select all
if(!$sql_ignore_users)
{
// Get banned User ID's
$sql = 'SELECT ban_userid
FROM ' . BANLIST_TABLE . '
WHERE ban_userid <> 0
AND ban_exclude <> 1';
$result = $db->sql_query($sql);
$sql_ignore_users = ANONYMOUS . ', ' . $user->data['user_id'];
while ($row = $db->sql_fetchrow($result))
{
$sql_ignore_users .= ', ' . (int) $row['ban_userid'];
}
$db->sql_freeresult($result);
}
3. Replace with:
- Code: Select all
if(empty($sql_ignore_users))
{
$sql_ignore_users = array();
if(version_compare(PHPBB_VERSION, '3.0.10', '>'))
{
if (!function_exists('phpbb_get_banned_user_ids'))
{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
}
$sql_ignore_users = phpbb_get_banned_user_ids();
}
else
{
// Get banned User ID's
$sql = 'SELECT ban_userid
FROM ' . BANLIST_TABLE . '
WHERE ban_userid <> 0
AND ban_exclude <> 1';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$user_id = (int) $row['ban_userid'];
$sql_ignore_users[$user_id] = $user_id;
}
$db->sql_freeresult($result);
}
$sql_ignore_users[ANONYMOUS] = ANONYMOUS;
$sql_ignore_users[$user->data['user_id']] = $user->data['user_id'];
}
4. Find:
- Code: Select all
$sql_ary['WHERE'] .= " AND u.user_id NOT IN ($sql_ignore_users)
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
5. Replace with:
- Code: Select all
$sql_ary['WHERE'] .= ' AND ' . $db->sql_in_set('u.user_id', $sql_ignore_users, true) . '
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')';
6. Find:
- Code: Select all
$notify_rows[$row['user_id']] = array(
'user_id' => $row['user_id'],
7. Replace with:
- Code: Select all
$user_id = (int)$row['user_id'];
$notify_rows[$user_id] = array(
'user_id' => $user_id,
8. Find:
- Code: Select all
else if($follower->notify($mode, 'email', $row['notify_options']))
{
$email_users[] = $row;
}
9. Add After:
- Code: Select all
// Dont send mention notification if previous notification was sended
if(in_array($mode, array('posts', 'topics', 'replies')))
{
$sql_ignore_users[$user_id] = $user_id;
}
10. Find:
- Code: Select all
// Send mention notification
if(in_array($mode, array('posts', 'topics', 'replies')))
{
// Dont send mention notification if previous notification was sended
if(!empty($notify_rows))
{
$sql_ignore_users .= implode(', ', array_keys($notify_rows));
}
follower_notification('mentions', $follower->mention_ids, false, $sql_ignore_users);
}
11. Replace with:
- Code: Select all
// Send mention notification
if(in_array($mode, array('posts', 'topics', 'replies')))
{
follower_notification('mentions', $follower->mention_ids, false, $sql_ignore_users);
}
12. Open /follower/follower.php
13. Find:
- Code: Select all
function notification($mode, $item_ids, $data = false, $sql_ignore_users = '')
{
global $phpbb_root_path, $phpEx;
if(!function_exists('follower_notification'))
{
include($phpbb_root_path . 'follower/includes/functions_follower.' . $phpEx);
}
return follower_notification($mode, $item_ids, $data, $sql_ignore_users);
}
14. Replace with:
- Code: Select all
function notification($mode, $item_ids, $data = false, $sql_ignore_users = false)
{
global $phpbb_root_path, $phpEx;
if(!function_exists('follower_notification'))
{
include($phpbb_root_path . 'follower/includes/functions_follower.' . $phpEx);
}
/* Compatibility with old phpbb versions */if($sql_ignore_users !== false && !is_array($sql_ignore_users))
{
$ignore_users = explode(', ', $sql_ignore_users);
$sql_ignore_users = array();
foreach($ignore_users as $user_id)
{
$user_id = (int)$user_id;
$sql_ignore_users[$user_id] = $user_id;
}
}
return follower_notification($mode, $item_ids, $data, $sql_ignore_users);
}
-
- mladiucitelj
- Posts: 153
- Joined: Sun Sep 02, 2012 11:40 pm
- Location: Slovenia, Europe
Sun Oct 28, 2012 11:17 am • via Web
Working and need it if you run phpbb 3.0.11.
Thanks for the fix.
Thanks for the fix.
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests
- External Links
- phpBB Official
- phpBB Official (Spanish)
- Raul Arroyo Monzo
- PasionReef
- About CaniDev
- Terms of use
- Privacy Policy
- About Us
- Contact
- © 2011-2024 CaniDev