[3.2.0]group_user_del function question

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Chabniest
Registered User
Posts: 9
Joined: Sun Apr 30, 2017 10:01 pm

[3.2.0]group_user_del function question

Post by Chabniest »

Hi @ all,

I have a little problem with this mentioned function.

Once in a week our members are checked if they are still in the correct group.

If they are not in the correct group they were removed from the individuell group and the default group must set to "registered users".

And there is the problem.

I receive the following error when I start the script:

PHP Fatal error: Call to a member function sql_in_set() on null in...../includes/functions_user.php on line 2814

The variable "$forum_group_name" ist the name of the individuell group where the member must remove from.

My code looks like so:

Code: Select all

group_user_del($forum_groupid, $forum_userid, $forum_username, $forum_group_name, true);
I ask also in the german support forum (phpbb.de) but it seems that nobody can help me in this case.

Has anybody an idea what I make wrong?

Thanks

Chabniest
User avatar
AmigoJack
Registered User
Posts: 6127
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: [3.2.0]group_user_del function question

Post by AmigoJack »

Chabniest wrote: Wed Sep 13, 2017 2:12 pmthe script
That's the cause.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
Chabniest
Registered User
Posts: 9
Joined: Sun Apr 30, 2017 10:01 pm

Re: [3.2.0]group_user_del function question

Post by Chabniest »

AmigoJack wrote: Thu Sep 14, 2017 9:28 am
Chabniest wrote: Wed Sep 13, 2017 2:12 pmthe script
That's the cause.
4860 posts and now this post which helps nothing. No words.

Has anybody else an idea?

Thx
User avatar
RMcGirr83
Former Team Member
Posts: 22072
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [3.2.0]group_user_del function question

Post by RMcGirr83 »

His point was it is the script that you made that is causing the issue. You should probably post the entire script instead of snippets of it.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: [3.2.0]group_user_del function question

Post by Ger »

The error indicates that $db is not an object. That could be the case if you just bluntly include the functions_user.php without anything else.

However, as indicated by AmigoJack, we can't help you much more without you sharing more code.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
canonknipser
Registered User
Posts: 2096
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs

Re: [3.2.0]group_user_del function question

Post by canonknipser »

Chabniest wrote: Wed Sep 13, 2017 2:12 pm I ask also in the german support forum (phpbb.de)
I can't find any related topic or post of yours over there. But, as said, we need the code to help you. Just some out-of-sequence fragments are not enough
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB
Chabniest
Registered User
Posts: 9
Joined: Sun Apr 30, 2017 10:01 pm

Re: [3.2.0]group_user_del function question

Post by Chabniest »

Hi guys,

here is the code of the script:

Code: Select all

include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

$foren_user_id=mysqli_query($con,"SELECT user_id, group_id, username  FROM `phpbb_users` WHERE user_id >= 48") or die(mysql_error());
while ($foren_user=mysqli_fetch_array($foren_user_id,MYSQLI_ASSOC))
{
 $forum_userid = $foren_user['user_id'];
 $forum_groupid = $foren_user['group_id'];
 $forum_username = $foren_user['username'];
 
 group_user_del($forum_groupid, $forum_userid, $forum_username, true, true);
}
And here is the Link to the original functions_user.php

There is still a "If" statement that specify when the user will removed from group.

The Users are in two groups. In the "registered Users" and an individuell group. The individuell group is set as default group. the member must remove from individuell group and the "registered users" group must be set as default.

Thx

Chabniest
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: [3.2.0]group_user_del function question

Post by Ger »

You miss quite some stuff. You simply cannot add only the includes/functions_user.php and expect things to work. You also need the DB object setup, the config, etc.
Usually you start an external script like:

Code: Select all

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
Chabniest
Registered User
Posts: 9
Joined: Sun Apr 30, 2017 10:01 pm

Re: [3.2.0]group_user_del function question

Post by Chabniest »

Ger wrote: Fri Sep 15, 2017 11:43 am You miss quite some stuff. You simply cannot add only the includes/functions_user.php and expect things to work. You also need the DB object setup, the config, etc.
Usually you start an external script like:

Code: Select all

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
That code is allready inside. The specific error will never appear when this code were not inside.

Thx

Chab
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: [3.2.0]group_user_del function question

Post by Ger »

Than, by all means, share your complete code instead of arbitrary snippets.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
canonknipser
Registered User
Posts: 2096
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs

Re: [3.2.0]group_user_del function question

Post by canonknipser »

Chabniest wrote: Fri Sep 15, 2017 1:05 pm That code is allready inside.
But it doesn't show up in your code posted here:
Chabniest wrote: Fri Sep 15, 2017 11:37 am here is the code of the script
So, that is again only "half of the truth".

It's hard to help if you put only parts of code.

Some additional questions:
Why don't you use phpBB's database engine, but your own code without any error handling? mysqli_query(
mysqli_fetch_array

And if you look at the definitions of the parameters, you need to pass some of them as arrays, not as scalar values as you do:
function group_user_del($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $log_action = true) (suffix _ary gives hint for an array)

Edit: and you don't give the group name, but only a true, that's the reason for your sql_in_set error. False means "no group name given"
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB
User avatar
AmigoJack
Registered User
Posts: 6127
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: [3.2.0]group_user_del function question

Post by AmigoJack »

Chabniest wrote: Fri Sep 15, 2017 7:25 am4860 posts and now this post which helps nothing
14 days later and you still haven't attached your full script.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28

Return to “phpBB Custom Coding”