Shared Registration Mod

Advertise a phpBB hack or request help with an existing one.

Moderator: TerraFrost

Shared Registration Mod

Postby encryption » Fri Nov 05, 2004 4:49 pm

I have been trying to implement this mod but my limited knowledge of php is pushing me behind, can you please update / advise what needs to be fixed as I have noticed a few typos / errors in this mod

I have attaced the mod that I got from phpbbhacks to this message so you will see what I mean, can you please help me with this ?

thanks

-e-
Attachments
Shared Registration.zip
(2.89 KiB) Downloaded 157 times
encryption
Traveler
 
Posts: 14
Joined: Fri Nov 05, 2004 4:46 pm

Postby TerraFrost » Fri Nov 05, 2004 6:49 pm

if i knew anything that needed fixing, before releasing the mod, i wouldn't have released it to phpbbhacks ;)

as such, if you could tell me the typos / errors you've noticed, that'd be very helpful.

also, i do have this mod installed (with whatever typoes / errors are in the one you attached) on this board. all the users who register for this board are simultaniously registered for this board:

http://frostjedi.com/~arioch/

new members don't show up there because of another mod i have installed there called Hide Zero Posters, but they should be able to login, none-the-less (well, assuming that the board doesn't have admin acct activation enabled, or something).
TerraFrost
Legendary Guard
 
Posts: 11604
Joined: Wed Dec 04, 2002 6:37 am

Postby encryption » Fri Nov 05, 2004 10:26 pm

I sense from your message that you are ofended by my message and that was definitely not my intention. The best of us make mistakes and I am not excuse to this rule, heck even I'm human :P

As for the small errors, well you can see what I mean in the attachment I posted.

It seems you updated the mod in a few places and missed a couple of edits. Firstly, the name of the file was changed from simul_config.php to shared_config but that was not fixed in the intro. Additionally, you have this piece of code to be inserted into includes/usercp_register.php

Code: Select all
#
#-----[   AFTER, ADD ]------------------------------------
#
         // Begin Shared Registration
         include("share_config.php");
         $sql = "SELECT * FROM " . USERS_TABLE . " WHERE user_id = $user_id;";
         $keys = $db->sql_fetchrow($db->sql_query($sql));
         for ($num=0;$num<count($boards);$num++)


SNIP------->


if you see, the file is not share_config.php but infact is shared_config.php

Secondly, in includes/usercp_activate.php, the installer asks to perform the following

Code: Select all
#
#-----[   AFTER, ADD ]------------------------------------
#
      // Begin Shared Registration
      include("simul_config.php");
      for ($num=0;$num<count($boards);$num++)
      {


That is actually not simul_config.php but is shared_conig.php (if I am not wrong).

In spite of fixing those errors, it wouldnt let me install a test user telling me that it could not update some table. Sorry I'm not much of a programmer so I couldnt be more specific here :(

if you can help me, let me know and I'll install the mod once again to recreate the error.

-e-
encryption
Traveler
 
Posts: 14
Joined: Fri Nov 05, 2004 4:46 pm

Postby TerraFrost » Sat Nov 06, 2004 12:54 am

i wasn't actually offended by your post - i was just trying to sorta cover all my basis.

ie. there could very well be bugs, but if there were, i haven't yet encountered them myself. an example is my copy users hack - the fact that it didn't work, for a time, on boards whose user_group table had more than 3 columns was a big mistake, but as none of my user_groups had it, it wasn't one i was likely to encounter, or know about.

anyway, heh - i think you might be right - i can't check right now since enterprise will be on in like 2 minutes or so, but i'll check after it :)
TerraFrost
Legendary Guard
 
Posts: 11604
Joined: Wed Dec 04, 2002 6:37 am

Postby TerraFrost » Sat Nov 06, 2004 4:18 am

a version without the typos you mentioned can be found here:

http://www.frostjedi.com/terra/scripts/ ... ed_reg.zip

In spite of fixing those errors, it wouldnt let me install a test user telling me that it could not update some table.


if you could provide me with a temp. ftp accout, such that i might try to install the mod and diagnose / fix the problem, myself, that'd be helpful :)
TerraFrost
Legendary Guard
 
Posts: 11604
Joined: Wed Dec 04, 2002 6:37 am

Postby encryption » Mon Dec 06, 2004 8:13 pm

hey...

sorry for the late response......

I seem to have the script working well on 2 boards but I cant seem to get it to work on 3..... fyi, this is what my shared_config.php looks like right now

Code: Select all
<?
   // for each board you want to simultaneously register users on,
   // copy the following and paste it below the last one.
   // alter the information as appropriate (look in config.php)
   $boards[] = array(
                  'hostname' => 'localhost',
                  'database' => 'mercuryn_ME',
                  'username' => 'mercuryn_XXXX',
                  'password' => 'XXXXX',
                  'prefix'   => 'phpbb_',
               
                  'hostname' => 'localhost',
                  'database' => 'mercuryn_MP',
                  'username' => 'mercuryn_XXXXX',
                  'password' => 'XXXX',
                  'prefix'   => 'phpbb_'
               );
?>


is this correct ??

-e-
encryption
Traveler
 
Posts: 14
Joined: Fri Nov 05, 2004 4:46 pm

Postby encryption » Mon Dec 06, 2004 8:19 pm

just a little more detail, I get this error when I try to execute the script with the above edit to the shared_config.php

Code: Select all
Error geting users post stat

DEBUG MODE

SQL Error : 1054 Unknown column 'g.group_count' in 'field list'

SELECT ug.user_id, g.group_id as g_id, g.group_name , u.user_posts, g.group_count FROM phpbb_groups g, phpbb_users u LEFT JOIN phpbb_user_group ug ON g.group_id=ug.group_id AND ug.user_id=7 WHERE u.user_id=7 AND ug.user_id is NULL AND g.group_count=0 AND g.group_single_user=0 AND g.group_moderator<>7

Line : 760
File : /home/mercuryn/public_html/test_CH/includes/usercp_register.php



<--EDIT-->

This wont have anything to do with the changes implemented in the new version of phpbb would it ? (i.e. 2.0.11)

-e-
encryption
Traveler
 
Posts: 14
Joined: Fri Nov 05, 2004 4:46 pm

Postby TerraFrost » Mon Dec 06, 2004 9:42 pm

shared_config.php should actually look like this with two boards:

[code[ <?
// for each board you want to simultaneously register users on,
// copy the following and paste it below the last one.
// alter the information as appropriate (look in config.php)
$boards[] = array(
'hostname' => 'localhost',
'database' => 'mercuryn_ME',
'username' => 'mercuryn_XXXX',
'password' => 'XXXXX',
'prefix' => 'phpbb_'
);
$boards[] = array(
'hostname' => 'localhost',
'database' => 'mercuryn_MP',
'username' => 'mercuryn_XXXXX',
'password' => 'XXXX',
'prefix' => 'phpbb_'
);
?>[/code]

whether or not that'll fix the error you mention... i dunno. the sql query resulting in the error isn't from my mod. if you still get the error after updating shared_config.php, could you post line 760-770 (ie. ten lines before and after the line causing the error)?

finally, i doubt the new version of phpBB is causing the problem...
TerraFrost
Legendary Guard
 
Posts: 11604
Joined: Wed Dec 04, 2002 6:37 am

Postby encryption » Mon Dec 06, 2004 9:58 pm

thanks for that, even with that fix, I get the exact same error.... here is lines 751 - 781 of usercp_register.php

Code: Select all
$sql = "SELECT ug.user_id, g.group_id as g_id, g.group_name , u.user_posts, g.group_count FROM " . GROUPS_TABLE . " g, ".USERS_TABLE." u
      LEFT JOIN ". USER_GROUP_TABLE." ug ON g.group_id=ug.group_id AND ug.user_id=$user_id
      WHERE u.user_id=$user_id
         AND ug.user_id is NULL
         AND g.group_count=0
         AND g.group_single_user=0
         AND g.group_moderator<>$user_id";
if ( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Error geting users post stat', '', __LINE__, __FILE__, $sql);
}
while ($group_data = $db->sql_fetchrow($result))
{
   //user join a autogroup
   $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
      VALUES (".$group_data['g_id'].", $user_id, 0)";
   if ( !($db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Error inserting user group, group count', '', __LINE__, __FILE__, $sql);
   }
}         

         include($phpbb_root_path . 'includes/emailer.'.$phpEx);
         $emailer = new emailer($board_config['smtp_delivery']);

         $emailer->from($board_config['board_email']);
         $emailer->replyto($board_config['board_email']);

         $emailer->use_template($email_template, stripslashes($user_lang));
         $emailer->email_address($email);
         $emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename']));



-e-
encryption
Traveler
 
Posts: 14
Joined: Fri Nov 05, 2004 4:46 pm

Postby TerraFrost » Tue Dec 07, 2004 5:52 am

i'll see what i can come up with sometime this week (i have finals this week, which is why i can't help you, immediatly). thanks for posting the code :)
TerraFrost
Legendary Guard
 
Posts: 11604
Joined: Wed Dec 04, 2002 6:37 am

Postby encryption » Tue Dec 07, 2004 12:23 pm

hey no worries.... and thank you for taking the time out to help.... cheers :)

-e-
encryption
Traveler
 
Posts: 14
Joined: Fri Nov 05, 2004 4:46 pm

Postby TerraFrost » Mon Dec 13, 2004 6:06 am

well... looking at the issue, i don't think it's a problem with my mod at all. however, that said, i think the problem can be fixed by deleting the following line from the above code:

AND g.group_count=0

group_count isn't a row normally associated with the phpbb_groups table, so it looks like you might not have run the sql for some other mod (the AutoGroup mod, perhapes?)...
TerraFrost
Legendary Guard
 
Posts: 11604
Joined: Wed Dec 04, 2002 6:37 am

Postby encryption » Mon Dec 13, 2004 2:07 pm

sweet, thanks I'll take a look at the mod and see what happens, however strange thing is that the auto groups mod is only installed on one site and not the other two. So I have installed the script on the site that does have the auto-groups mod installed but it only gives an error on one of the sites that does not have this mod installed

-e-
encryption
Traveler
 
Posts: 14
Joined: Fri Nov 05, 2004 4:46 pm

Postby encryption » Mon Dec 13, 2004 2:08 pm

also if I do remove that line AND g.group_count=0, will it affect the autogroups mod on the site that DOES have it working ?

-e-
encryption
Traveler
 
Posts: 14
Joined: Fri Nov 05, 2004 4:46 pm

Postby TerraFrost » Thu Dec 16, 2004 9:59 am

sorry for the delayed response...

anyway, are the above lines of code from the board that has this mod installed or the one that doesn't? 'cause they're not even from my mod, actually. is it possible you sorta partially installed the auto group hack on one board but didn't run the associated sql queries? another possibility is that you're using the usercp_register.php file from the board with the autogroup hack installed, or something...

regarding your second question... are the above quoted lines from usercp_register.php from the board without the autogroup hack installed (which you said was the only one generating an error) or are they from the board with them? if the above lines of code / errors are from the board that has the problem - the board without the mod installed - than removing them shouldn't prevent the auto group hack from working because it shouldn't be working, anyway, heh. if the opposite is true, then removing that line will indeed prevent the auto group mod from working.
TerraFrost
Legendary Guard
 
Posts: 11604
Joined: Wed Dec 04, 2002 6:37 am

Next

Return to phpBB Hacks and MODs

Who is online

Users browsing this forum: MSN [Bot] and 0 guests