Support Forums | Demo Gallery [1.x] [2.x] | Downloads | News | Site Map ]
Nuked Gallery
  Create a FREE account or Login   As a guest, you don't have access to our FULL navigation system.
 Forum FAQForum FAQ   StatisticsStatistics   SearchSearch   UsergroupsUsergroups   FavoritesFavorites  

[RELEASE] Creating new album upon user registration
Goto page 1, 2, 3, 4, 5, 6  Next
 
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Integration » Gallery 1 Integration View previous topicPrinter friendly versionView next topic
Author Message
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6276
Location: Washington Township, NJ, USA

PostPosted: Mon Apr 19, 2004 5:57 pm    Post subject: [RELEASE] Creating new album upon user registration Reply with quote

Automatically Create User Album Upon Registration

This MOD allows you to give your users the option to automatically create a new top-level album for themselves in your Gallery. To see it in action, visit http://phpnuke.nukedgallery.net/ and set up an account. This should make that user the owner so that they can set the permissions. If not, please post here and I will post a fix.

Before you start, the standard disclaimer applies:
Back up all files before applying this modification. Back up your database before modification. If you don't, your computer may melt Wink

  1. Add a new field to your users_temp table with the following properties:
    Code: › Field name: empty_album
    Type: varchar(255)
    Null: No

  2. Add a new field to your users table with the following properties:
    Code: › Field Name: user_album
    Type: tiny_int(1)
    Null: No
    Default: 0

  3. Open modules/Your_Account/index.php and make the following changes:
    PHP: › <?php #
    # FIND
    #
         
    $user_viewemail "0";

    #
    # AFTER, ADD
    #
        
    if($_POST['useralbum']){
        
    $albumString "Yes";
        }
        else {
        
    $albumString "No";
        }

    #
    # FIND
    #
            
    ."<tr><td><b>"._EMAIL.":</b> $user_email</td></tr></table><br><br>"

    #
    # REPLACE WITH
    #
            
    ."<tr><td><b>"._EMAIL.":</b> $user_email</td></tr>"
            
    ."<tr><td><b>Empty album:</b> $albumString</td></tr></table><br><br>"

    #
    # FIND
    #
         
    echo "<form action=\"modules.php?name=$module_name\" method=\"post\">"

    #
    # AFTER, ADD
    #
            
    ."<input type=\"hidden\" name=\"emptyAlbum\" value=\"$albumString\">"

    #
    # FIND
    #
    function finishNewUser($username$user_email$user_password$random_num$gfx_check) {

    #
    # REPLACE WITH
    #
    function finishNewUser($username$user_email$user_password$random_num$gfx_check,$emptyAlbum) {

    #
    # FIND
    #
        
    $result $db->sql_query("INSERT INTO ".$user_prefix."_users_temp (user_id, username, user_email, user_password, user_regdate, check_num, time) VALUES (NULL, '$username', '$user_email', '$new_password', '$user_regdate', '$check_num', '$time')");

    #
    # REPLACE WITH
    #
        
    $result $db->sql_query("INSERT INTO ".$user_prefix."_users_temp (user_id, username, user_email, user_password, user_regdate, check_num, time, empty_album) VALUES (NULL, '$username', '$user_email', '$new_password', '$user_regdate', '$check_num', '$time', '$emptyAlbum')");

    #
    # FIND
    #
            
    echo ""._YOUAREREGISTERED.""
                
    ."<br><br>"

    #
    # REPLACE WITH
    #
            
    echo ""._YOUAREREGISTERED."";
            if(
    $emptyAlbum == "Yes") {
            echo 
    "<br><br>Your new album will be created once your account has been activated.";
            }
            echo 
    "<br><br>"

    #
    # FIND
    #
           
    $db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_avatar_type,  user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', 3, '$row[user_regdate]', '$language')"); 

    #
    # AFTER, ADD
    #
        
    if($row['empty_album'] == "Yes") {
            
    $emptyAlbum 1;
        }
        else {
            
    $emptyAlbum 0;
        }

    #
    # FIND
    #
             
    echo "<center><b>$row[username]:</b> "._ACTMSG."</center>";

    #
    # AFTER, ADD
    #
                
    if($emptyAlbum) {
                    
    $newuser $row['username'];
                    global 
    $gallery$GALLERY_EMBEDDED_INSIDE$GALLERY_EMBEDDED_INSIDE_TYPE$Version_Num;
                    
    $GALLERY_EMBEDDED_INSIDE 'nuke';    
                    
    $GALLERY_EMBEDDED_INSIDE_TYPE 'phpnuke';
                    require_once(
    "/YOUR_GALLERY_PATH_HERE/init.php");
                    
    createNewAlbum('',$newuser$newuser."'s Album");
                    
    $user $gallery->userDB->getUserByUsername($newuser);
                    
    $gallery->album = new Album();
                    
    $gallery->album->load($newuser);
                    
    $gallery->album->setOwner($user->getUid());
                    
    $gallery->album->save();  
            }

    #
    # FIND
    #
            
    if (extension_loaded("gd") AND ($gfx_chk == OR $gfx_chk == OR $gfx_chk == OR $gfx_chk == 7)) {
             echo 
    "<tr><td>"._SECURITYCODE.":</td><td><img src='modules.php?name=$module_name&op=gfx&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'></td></tr>\n"
                 
    ."<tr><td>"._TYPESECCODE.":</td><td><input type=\"text\" NAME=\"gfx_check\" SIZE=\"7\" MAXLENGTH=\"6\"></td></tr>\n"
                 
    ."<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">\n";
         }

    #
    # AFTER, ADD
    #
        
    echo "<tr><td>Check here to create a blank photo album: </td><td><input type=\"checkbox\" name=\"useralbum\"></td></tr>\n";

    #
    # FIND
    #
        
    finishNewUser($username$user_email$user_password$random_num$gfx_check);

    #
    # REPLACE WITH
    #
        
    finishNewUser($username$user_email$user_password$random_num$gfx_check,$emptyAlbum); ?>

  4. Save and close all files.


Edit: Cosmetic edit to highlight database tables which need modification.

Edit 2: There appears to be a problem with setting album ownership. Until I can get this resolved (not sure if it's a 1.4.3 error or not), you should manually set ownership of albums to the user.

Edit 3: Clarified location of one code block.

Edit 4: Adding missing '' around sql variable.

Edit 5: Fixed album permissions error. Now, there is apparantly a problem with GoogleTapped sites. If you can fix this, let me know (there are a ton of different GT implementations floating around).

_________________


Last edited by dari on Tue Jun 29, 2004 5:06 pm; edited 7 times in total
Back to top
Online View user's profile Send private message Visit poster's website
AdBot
   Post subject: [RELEASE] Creating new album upon user registration  

Back to top
mcgiddin

Beginner
Beginner


Joined: Apr 14, 2004
Posts: 4
Location: Michigan

PostPosted: Mon Apr 19, 2004 10:17 pm    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

What version of phpnuke is this for? The following find does not match with version 7.10:

#
# FIND
#

$db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_avatar_type, user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', 3, '$row[user_regdate]', '$language')");

This is the line in my index.php that is the closes match:

$db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', '$row[user_regdate]', '$language')");


Please advise.

mcgiddin


Last edited by mcgiddin on Mon Apr 19, 2004 10:45 pm; edited 1 time in total
Back to top
Offline View user's profile Send private message AIM Address Yahoo Messenger
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6276
Location: Washington Township, NJ, USA

PostPosted: Mon Apr 19, 2004 10:19 pm    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

give that a try..i don't have 7.1 (i used 7.0). if it works, i'll add your note to the MOD.
_________________
Back to top
Online View user's profile Send private message Visit poster's website
mcgiddin

Beginner
Beginner


Joined: Apr 14, 2004
Posts: 4
Location: Michigan

PostPosted: Mon Apr 19, 2004 10:44 pm    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

I'll take a look at it. I have to learn the structure and what's going on with the code before I go tweeking it to much at this point. I'll keep track of my changes and post them when I'm done.

mcgiddin
Back to top
Offline View user's profile Send private message AIM Address Yahoo Messenger
mcgiddin

Beginner
Beginner


Joined: Apr 14, 2004
Posts: 4
Location: Michigan

PostPosted: Mon Apr 19, 2004 10:48 pm    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

I just found that I can't edit my posts. Well everything appears to be working properly, but the text doesn't change. : (

P.S. Sorry about this off topic post.

mcgiddin
Back to top
Offline View user's profile Send private message AIM Address Yahoo Messenger
colincliff

Beginner
Beginner


Joined: Apr 22, 2004
Posts: 1

PostPosted: Thu Apr 22, 2004 4:00 am    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

Thanks for this fix - it should be great when i get it working!!

sorry to ask a simple question but when i try to make the new fields via php myadmin i am required to enter a number in the 'lengths/values' box.

any ideas to what i do here?

thanks
Back to top
Offline View user's profile Send private message
ophidite

Beginner
Beginner


Joined: Mar 31, 2004
Posts: 15

PostPosted: Thu Apr 22, 2004 6:09 am    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

when i try to view my account i got this :

Parse error: parse error in /Library/WebServer/Documents/SQL/PHP-Nuke-7/html/modules/Your_Account/index.php on line 37

http://www.stenope.ophidite.com/modules ... ur_Account

PHP 4.3.2 PHPNUKE 7.0
Apache 1.3.28
OS 10.3.3
Back to top
Offline View user's profile Send private message Visit poster's website
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6276
Location: Washington Township, NJ, USA

PostPosted: Thu Apr 22, 2004 10:07 am    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

colincliff wrote: › Thanks for this fix - it should be great when i get it working!!

sorry to ask a simple question but when i try to make the new fields via php myadmin i am required to enter a number in the 'lengths/values' box.

any ideas to what i do here?

thanks


just specify the fields that i have specified in the first posting. the rest can be left to their default.
_________________
Back to top
Online View user's profile Send private message Visit poster's website
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6276
Location: Washington Township, NJ, USA

PostPosted: Thu Apr 22, 2004 10:09 am    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

ophidite wrote: › when i try to view my account i got this :

Parse error: parse error in /Library/WebServer/Documents/SQL/PHP-Nuke-7/html/modules/Your_Account/index.php on line 37

http://www.stenope.ophidite.com/modules ... ur_Account

PHP 4.3.2 PHPNUKE 7.0
Apache 1.3.28
OS 10.3.3


what's on your line 37?
make sure that when you're copying/pasting the code from here that if it looks like it's been wrapped to multiple lines, you edit it to be only on one line (so that php parses it correctly).
_________________
Back to top
Online View user's profile Send private message Visit poster's website
ophidite

Beginner
Beginner


Joined: Mar 31, 2004
Posts: 15

PostPosted: Fri Apr 23, 2004 4:06 am    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

here is the line 37 in Your_account/index.php


if ($db->sql_numrows($db->sql_query("SELECT user_email FROM ".$user_prefix."_users_temp WHERE user_email='$user_email'")) > 0) $stop = "<center>"._EMAILREGISTERED."</center><br>";

the code is written in one line . I checked all the code and it seems correct
Back to top
Offline View user's profile Send private message Visit poster's website
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6276
Location: Washington Township, NJ, USA

PostPosted: Fri Apr 23, 2004 9:34 am    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

i don't touch that line....go through your modifications and make sure that you copied/pasted everything properly, and that long lines didn't wrap, etc....
_________________
Back to top
Online View user's profile Send private message Visit poster's website
Helios

Beginner
Beginner


Joined: Sep 16, 2003
Posts: 1

PostPosted: Fri Apr 23, 2004 9:01 pm    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

Dari,

I had some problems getting the mod to work. I kept on getting _ERROR for new user registrations. I finally saw that the line to replace

$result = $db->sql_query("INSERT INTO ".$user_prefix."_users_temp (user_id, username, user_email, user_password, user_regdate, check_num, time, empty_album) VALUES (NULL, '$username', '$user_email', '$new_password',
$user_regdate, '$check_num', '$time', '$emptyAlbum')");

actually needed ' ' around $user_regdate

Here is the line that I used. Just added the ' '

$result = $db->sql_query("INSERT INTO ".$user_prefix."_users_temp (user_id, username, user_email, user_password, user_regdate, check_num, time, empty_album) VALUES (NULL, '$username', '$user_email', '$new_password',
'$user_regdate', '$check_num', '$time', '$emptyAlbum')");

I am using PHP-Nuke 7.1, Gallery v1.4.3-RC3, MySQL 4.0.18, Windows 2003 Server, Apache 1.3.29, PHP 4.3.5

-Helios
Back to top
Offline View user's profile Send private message
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6276
Location: Washington Township, NJ, USA

PostPosted: Sat Apr 24, 2004 10:08 am    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

thanks...i stuck that in the original post Smile
_________________
Back to top
Online View user's profile Send private message Visit poster's website
seanhogan

Beginner
Beginner


Joined: May 17, 2004
Posts: 6

PostPosted: Mon May 17, 2004 2:59 am    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

When I make the changes, the signup goes smooth, but then when the user clicks the link in the email to activate their account, they see this error on the page....

Warning: Invalid argument supplied for foreach() in /home/XXXXXXX/public_html/modules/gallery/session.php on line 64

Fatal error: Call to a member function on a non-object in /home/XXXXXXX/public_html/modules/Your_Account/index.php on line 208


Any idea why?


I'm using PHPNuke 7.2 and Gallery 1.4.3-pl1
Back to top
Offline View user's profile Send private message
seanhogan

Beginner
Beginner


Joined: May 17, 2004
Posts: 6

PostPosted: Mon May 17, 2004 3:09 am    Post subject: Re: [RELEASE] Creating new album upon user registration Reply with quote

Is there an easy way to make the new user's album in an existing album -- like Member's Albums -- as a subalbum? It seems like the top level of the gallery could get very cluttered very quickly with new member's albums.
Back to top
Offline View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Integration » Gallery 1 Integration View previous topicPrinter friendly versionView next topic
Goto page 1, 2, 3, 4, 5, 6  Next

 
Jump to:  
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
All times are GMT - 5 Hours

Powered by phpBB © phpBB Group



Sponsors: Web HostingDedicated ServersDomain NamesDomain Name RegistrationDedicated Web HostingSearch Engine OptimisationSEOWeb Design New YorkSEO Web DesignWeb hosting AustraliaSEO

6th year online! 2003-2008
Legal • Use of this site consitutes agreement to the Acceptable Use Policy
Hosted by Implosion WorksSourceForge.net Logo • Theme by TonicMedia