PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Doulos
Life Cycles Becoming CPU Cycles


Joined: Jun 06, 2005
Posts: 545

PostPosted: Mon Dec 15, 2008 4:57 pm Reply with quote Back to top

Could not delete group for this user

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2

DELETE FROM nuke_bbgroups WHERE group_id =

Line : 140
File : admin_users.php

I tried the fixgroup script and that did something, but new users still can't be deleted without this error.
View user's profile Send private message
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Mon Dec 15, 2008 7:40 pm Reply with quote Back to top

I don't understand exactly where this error is coming from. What exactly are you tring to do. I know it has something to do with users and groups, but I am not sure how to try and reproduce this.
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Mon Dec 15, 2008 7:45 pm Reply with quote Back to top

Quote:
new users still can't be deleted
- why are new users being added to a group? This is not default behaviour.
View user's profile Send private message Send e-mail Visit poster's website
Doulos
Life Cycles Becoming CPU Cycles


Joined: Jun 06, 2005
Posts: 545

PostPosted: Mon Dec 15, 2008 7:47 pm Reply with quote Back to top

admin>forums>user admin>management>select a user>delete user
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Mon Dec 15, 2008 7:58 pm Reply with quote Back to top

I need to look at this some more but it is 3am here and need sleep.
Looking at the code, I think the DELETE sequence is out of sync.
It deletes the user from the user table and then tries to delete the user from user group table.
I cannot off-hand see how that would work. The sql is user the user_id so once the user is removed, there can never be a match for that id in the group table.
View user's profile Send private message Send e-mail Visit poster's website
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Mon Dec 15, 2008 8:07 pm Reply with quote Back to top

You can always use your_account admin to delete users untill this is resolved.
View user's profile Send private message
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Mon Dec 15, 2008 9:22 pm Reply with quote Back to top

The reason this error is happening is because the code assumes that there is a "single user group" for every user. This is not the case. A "single user group" is only created when a user needs "user specific" permissions and not "group specific" permissions.

This error appears to have been around for a while. I have several flavors of nuke, and they all appear to have this error.

Doulos, you should be using your_account to delete users. The reason is your_account could include integration with other modules, etc. There is a problem with using your_account though and it may actually be better to use the forums. See below for the reason.

Guardian2003, while looking at this I figured I would look to see what your_account did when deleting a user. It barely does anything. It does not delete nsn group info, forum post ect (no use keeping because they do not display without a userid), phpbb group info , phpbb auth_access info, and maybe more. I'm not sure if this was an oversight or was done to keep everything separate. No matter what I think a plug-in type system should be developed to allow "user info" from other modules to be deleted. Maybe have your_account read a directory for files, and if a file exists for a specific module display a check box at the confirmation screen to delete user info for that module.

I already talked to much so here is a fix for the problem at hand. Dance-Stick

Find lines 136-148 of /modules/Forums/admin/admin_users.php:
Code:

         $sql = "DELETE FROM " . GROUPS_TABLE . "
            WHERE group_id = " . $row['group_id'];
         if( !$db->sql_query($sql) )
         {
            message_die(GENERAL_ERROR, 'Could not delete group for this user', '', __LINE__, __FILE__, $sql);
         }

         $sql = "DELETE FROM " . AUTH_ACCESS_TABLE . "
            WHERE group_id = " . $row['group_id'];
         if( !$db->sql_query($sql) )
         {
            message_die(GENERAL_ERROR, 'Could not delete group for this user', '', __LINE__, __FILE__, $sql);
         }


Replace with:
Code:

         if ($row['group_id'] != '') {
            $sql = "DELETE FROM " . GROUPS_TABLE . "
               WHERE group_id = " . $row['group_id'];
            if( !$db->sql_query($sql) )
            {
               message_die(GENERAL_ERROR, 'Could not delete group for this user', '', __LINE__, __FILE__, $sql);
            }

            $sql = "DELETE FROM " . AUTH_ACCESS_TABLE . "
               WHERE group_id = " . $row['group_id'];
            if( !$db->sql_query($sql) )
            {
               message_die(GENERAL_ERROR, 'Could not delete group for this user', '', __LINE__, __FILE__, $sql);
            }
         }
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9133
Location: Arizona

PostPosted: Tue Dec 16, 2008 5:32 am Reply with quote Back to top

Using the forums to manage users has always been a "no-no" (even groups since the early ways of RN). If something worked previously, it was "luck". Seriously, all user maintenance should be done through RNYA and Edit Groups. There can be a few exceptions, such as assigning Administrators in the Forums, but that is the only exception that I can think of.
View user's profile Send private message Visit poster's website
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9133
Location: Arizona

PostPosted: Tue Dec 16, 2008 5:35 am Reply with quote Back to top

BTW, just read Palbin's note in more detail. I just want to add that I think most would agree that there is still work to be done in the user management area and, yes, it has been Raven's desire to continue to move in the direction of removing the tight integration with phpbb2. I am sure that a better "plug-in" type interface between traditional *nuke and the forums, whatever they end up being in the end-state, would be received positively.
View user's profile Send private message Visit poster's website
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Dec 16, 2008 6:46 am Reply with quote Back to top

Actually other than removing the "_users_field_values" table information I think the forums do a much better good in deleting as user, in relation to all things user related.
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9133
Location: Arizona

PostPosted: Tue Dec 16, 2008 6:59 am Reply with quote Back to top

Well, I respectfully must disagree, at least from the original YA module prior to 2.3.0 as we fixed all the deletion bugs and the forums are not NSN Groups aware. Now, it is possible that we missed some things with RNYA. Don't know for sure, because I have not looked.
View user's profile Send private message Visit poster's website
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Tue Dec 16, 2008 7:12 am Reply with quote Back to top

Playing devils advocate, the forums do a good job with removing the user from forum related data but that's because it is native phpBB code and that is what it was designed to do.
If you are using the forums to delete a user, it does not take into account things like NSN Groups the user might belong to, News, Weblinks, Reviews, Survey responses, or comments the user has made.
A plug-in type architecture would be great but I think it could be simplified by just changing the user name (I think this is what the forums do) or even appending something to the original user name, rather than trying to remove all data associated with a specific user and then force the users account into an inactive state.
View user's profile Send private message Send e-mail Visit poster's website
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Dec 16, 2008 7:44 am Reply with quote Back to top

Ok well maybe I am missing something in your_account in relation to nsn groups etc. But all I see are these three tables being modified in the removeuserconf.php
_users
_users_field_values
_users_temp_field_values

This is the reason I think the forums would be better for actually deleting a user. Now obviously if you what to deactivate a user you would do that instead. I am talking about deleting everything single thing relate to that user. When removing a user in the forums without deleting his post ect it through everything out of whack where his/her posts are involved. IE if the deleted user's post is the first post on a new page without any other post it will show as two pages when there isn't etc.

Guardian2003 wrote:
A plug-in type architecture would be great but I think it could be simplified by just changing the user name (I think this is what the forums do) or even appending something to the original user name, rather than trying to remove all data associated with a specific user and then force the users account into an inactive state.
That is called deactivation not deletion Smile Also just an FYI the forums delete posts and everything upon deletion.

So basically all I am trying to say is it would be nice to have opinion in your_account when deleting a user to be asked if you want to deleting info from other modules (maybe have them all check by default). For example Forums, GCalendar, NSN Groups, any module with comments, and i am sure there are other modules that are not included in the default package that could benefit from this.
View user's profile Send private message
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Dec 16, 2008 7:47 am Reply with quote Back to top

Just wanted to say that I do believe that all user management should be done from RNYA, but that does make it currently better IMO unless as I stated above I am missing something. Which I could be Very Happy
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Tue Dec 16, 2008 8:53 am Reply with quote Back to top

No your aren't missing anything Wink It looks like we did.
I will create a Mantis issue for this if there isn't one already.
View user's profile Send private message Send e-mail Visit poster's website
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Tue Dec 16, 2008 12:22 pm Reply with quote Back to top

Well the fix I posted above will fix the problem that the original poster had so lets move this conversation over to the thread in the staff forums
View user's profile Send private message
Doulos
Life Cycles Becoming CPU Cycles


Joined: Jun 06, 2005
Posts: 545

PostPosted: Tue Dec 16, 2008 12:25 pm Reply with quote Back to top

The only reason I was using Forums admin to delete users is because there is no "delete" option in RNYA.

I guess I could just deactivate them instead.
View user's profile Send private message
jakec
Site Admin


Joined: Feb 06, 2006
Posts: 3038
Location: United Kingdom

PostPosted: Tue Dec 16, 2008 12:34 pm Reply with quote Back to top

Once you have deactivated the user you then have the option to remove the user.
View user's profile Send private message
Doulos
Life Cycles Becoming CPU Cycles


Joined: Jun 06, 2005
Posts: 545

PostPosted: Tue Dec 16, 2008 1:01 pm Reply with quote Back to top

RTM Duh. Thanks.
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

PostPosted: Sun Dec 28, 2008 10:54 pm Reply with quote Back to top

Only registered users can see links on this board!
Get registered or login to the forums!
a fix for this using the RN 2.2 approach for deleting / updating other data before deleting a user.

Doulos, guardian, jakec, montego and Palbin (and others), please test this so I can add to SVN prior to the next update.
View user's profile Send private message
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Sun Dec 28, 2008 11:32 pm Reply with quote Back to top

I didn't actually try anything yet just looked at the code as I am currently setting up a clean RN site.

I have a problem with the below code which basically is exactly what the comments say.

Code:

// This deletes only the first group where the user is the moderator?  Why delete the group, instead of making another moderator?
   $result2 = $db->sql_query('SELECT group_id FROM ' . $user_prefix . '_bbgroups WHERE group_moderator = \''.$rem_uid.'\'');
   $row2 = $db->sql_fetchrow($result2);
   $del_group_id = intval($row2['group_id']);
   if (intval($del_group_id) > 0) {
      $db->sql_query('DELETE FROM ' . $user_prefix . '_bbgroups WHERE group_id=\''.$del_group_id.'\'');
      $db->sql_query('DELETE FROM ' . $user_prefix . '_bbauth_access WHERE group_id=\''.$del_group_id.'\'');
   }


Its late and I am having a hard tiem thinking so I will post something more specific tomorrow.
View user's profile Send private message
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Sun Dec 28, 2008 11:35 pm Reply with quote Back to top

On a side note you have $user_prefix for every table Shocked
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

PostPosted: Sun Dec 28, 2008 11:41 pm Reply with quote Back to top

Yeah, I copied that straight from the previous version of YA.
View user's profile Send private message
Palbin
Site Admin


Joined: Mar 30, 2006
Posts: 2456
Location: Pittsburgh, Pennsylvania

PostPosted: Sun Dec 28, 2008 11:54 pm Reply with quote Back to top

Instead of trying to explain the forum groups I will just rewrite that section of code and post back.

I'll just post a link to both files. I'll fix the prefixes and stuff too.
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

PostPosted: Mon Dec 29, 2008 6:53 am Reply with quote Back to top

There was definitely code in earlier versions of RN to automatically add a user to a forum group of 1. I'm sure this is related to that - just not sure why this approach was used to delete that group when deleting the user.
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum