Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need Member Approval System for 2.2MS2


rohittokhi

Recommended Posts

Hi,

 

I want a system where I can review new signups and approve them before they can login to the store. I have 2.2MS2 installed. The customers may receive a mail saying that their application is under review. And when I approve it from the Admin, they will receive the new signup mail.

 

Any ideas?

 

- Rohit

Link to comment
Share on other sites

Hi,

 

Thanks for the pointer. I downloaded the 'Member Approval 1.1' but it requires to modify the 'create_account_proces.php' file, but I found only 'create_account_success.php' file in 2.2MS2.

 

Do I make the same changes to that file?

 

~Confused~

- Rohit

Edited by rohittokhi
Link to comment
Share on other sites

yes, creat_account.php and creat account process were folded into one file...

Just make the necessary modifications to the create account file.

 

And remember, you will need to add the define code to make the approval email function properly..

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 months later...

Well, I've been trying to implement Member Approval 1.3 in Milestone 2.2, But I found myself extremely confused when i edit login.php. I was supposed tio find

 

} else {

tep_redirect(tep_href_link(FILENAME_DEFAULT));

}

}

}

}

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);

 

But found only

 

} else {

tep_redirect(tep_href_link(FILENAME_DEFAULT));

}

}

}

}

 

Therefore, don't know what to do. It seems it's been written for MS1, If anyone can help me please!!!!

Link to comment
Share on other sites

  • 4 weeks later...

Hi, after a bit of mucking about I managed to install member approval 1.3

note the line numbers may not be the same in your files

 

here's what I did

Customer Approval

Modify the following files

ws/catalog/admin/includes/boxes/customers.php
ws/catalog/admin/includes/languages/english/members.php
ws/catalog/admin/includes/languages/english/customers.php
ws/catalog/includes/languages/english/login.php
ws/catalog/includes/languages/english/create_account.php
ws/catalog/includes/languages/english/create_account_process.php
ws/catalog/admin/includes/languages/english.php
ws/catalog/admin/includes/application_top.php
ws/catalog/admin/members.php
ws/catalog/admin/customers.php
ws/catalog/login.php
ws/catalog/create_account.php
ws/catalog/create_account_process.php
ws/catalog/includes/languages/english.php

/////////////////////////////////////////////////////////////////////////////////////////

Database
--------
You will have to add an extra field to the customers table of the data base

ALTER TABLE `customers` ADD `member_level` INT(5) DEFAULT '0' NOT NULL;

Installation
------------

#### [ OPEN ] ##################################################################

catalog/create_account_process.php 

##################################################################

## Find ################################

   tep_session_register('customer_id');
   tep_session_register('customer_first_name');
   tep_session_register('customer_default_address_id');
   tep_session_register('customer_country_id');
   tep_session_register('customer_zone_id');

// restore cart contents
   $cart->restore_contents();

and delete the whole lot.


## Find this [approx line 317]:  ################################

   } else {
     $email_text = EMAIL_GREET_NONE;
   }

   $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
   tep_mail($name, $email_address, EMAIL_SUBJECT, nl2br($email_text), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

   tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
 }


## Replace with this:  ################################

   } else {
     $email_text = EMAIL_GREET_NONE;
   }

   // customer email notification 
   $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
   tep_mail($name, $email_address, EMAIL_SUBJECT, nl2br($email_text), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

   // admin email notification 

   $admin_email_text .= ADMIN_EMAIL_WELCOME . ADMIN_EMAIL_TEXT . EMAIL_WARNING;

   tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, nl2br($admin_email_text), $name, $email_address, '');

   tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
 }




#### [ OPEN ] ##################################################################

catalog/includes/languages/english/create_account_process.php 

##################################################################                                   
## Add/Replace  ################################


define('ADMIN_EMAIL_WELCOME', 'Application to become a wholesale customer of <b>' . STORE_NAME . '</b>.' . "\n\n");

define('EMAIL_TEXT', 'Your application to become a wholesale customer is currently being evaluated.  We will notify you within 48 hours as to when you can access our wholesale products list.  <br><br>You will also be able to take part in the <b>various services</b> we have to offer you. Some of these services include:' . "\n" . '<li><b>Permanent Cart</b> - Any products added to your online cart remain there until you remove them, or check them out.' . "\n" . '<li><b>Address Book</b> - We can now deliver your products to another address other than yours! This is perfect to drop ship direct to your customer.' . "\n" . '<li><b>Order History</b> - View your history of purchases that you have made with us.' . "\n"\n");

define('ADMIN_EMAIL_TEXT', 'A new customer wishes to apply for a wholesale account on (your website).  Information regarding this application can be found by logging on to your online administration panel.' . "\n\n");


#### [ OPEN ] ##################################################################

catlog/login.php 

##################################################################

<?php
/*
 $Id: login.php,v 1.80 2003/06/05 23:28:24 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
 if ($session_started == false) {
   tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
 }


 $error = false;
 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
   $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
   $password = tep_db_prepare_input($HTTP_POST_VARS['password']);

// Check if email exists
   //$check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
     $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id, member_level  from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");    

if (!tep_db_num_rows($check_customer_query)) {
     $HTTP_GET_VARS['login'] = 'fail';
$error=true;
   } else {
$check_customer = tep_db_fetch_array($check_customer_query);

// Check that password is good
     if (!tep_validate_password($password, $check_customer['customers_password'])) {
        $HTTP_GET_VARS['login'] = 'fail';
$error=true;
} else {
if ($check_customer['member_level'] == 0 ) {
         $HTTP_GET_VARS['login'] = 'invalid';
$error=true;	

       } else {
       if (SESSION_RECREATE == 'True') {
         tep_session_recreate();
       }

       $check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");
       $check_country = tep_db_fetch_array($check_country_query);

       $customer_id = $check_customer['customers_id'];
       $customer_default_address_id = $check_customer['customers_default_address_id'];
       $customer_first_name = $check_customer['customers_firstname'];
       $customer_country_id = $check_country['entry_country_id'];
       $customer_zone_id = $check_country['entry_zone_id'];
       tep_session_register('customer_id');
       tep_session_register('customer_default_address_id');
       tep_session_register('customer_first_name');
       tep_session_register('customer_country_id');
       tep_session_register('customer_zone_id');

       tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$customer_id . "'");

// restore cart contents
       $cart->restore_contents();

       if (sizeof($navigation->snapshot) > 0) {
         $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
         $navigation->clear_snapshot();
         tep_redirect($origin_href);
        } else {
         tep_redirect(tep_href_link(FILENAME_DEFAULT));
         }
       }
     }
   }
 }
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);

 if ($error == true) {
$messageStack->add('login', TEXT_VALID_ERROR);
 }

#### [ OPEN ] ##################################################################

catalog/includes/languages/english/login.php 

##################################################################                                   
## Add/Replace  ################################

define('TEXT_VALID_ERROR', '<font color="#ff0000"><b>ERROR:</b></font> This account has not been approved yet, please contact the site Administrator.');

define('TEXT_NEW_CUSTOMER_INTRODUCTION', 'By creating an account at ' . STORE_NAME . ' you will be able to make your purchases faster, be up to date on the status of your order, and keep track of the orders you have previously made.  Please note that new accounts must first be approved to gain access to (add your website here).');


#### [ OPEN ] ##################################################################

admin/application_top.php

##################################################################

## Add ################################

 define('FILENAME_MEMBERS', 'members.php');



#### [ OPEN ] ##################################################################

admin/includes/boxes/customers.php 

##################################################################

## After this: ################################

'<a href="' . tep_href_link(FILENAME_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CUSTOMERS_CUSTOMERS . '</a><br>' .
                                  

## Insert this: ################################

'<a href="' . tep_href_link(FILENAME_MEMBERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CUSTOMERS_APPROVAL . '</a><br>' .

#####then add the following at the end just above   ?>#############################


define('EMAIL_CONTACT', 'For help with any of our online services, please email us at: ' . STORE_OWNER_EMAIL_ADDRESS);

define('EMAIL_TEXT_CONFIRM', 'Your application to become a wholesale customer of (add your website here) has been approved and you may now access the wholesale products list.<br>You can also take part in the <b>various services</b> we have to offer you. Some of these services include:' . "\n" . '<li><b>Permanent Cart</b> - Any products added to your online cart remain there until you remove them, or check them out.' . "\n" . '<li><b>Address Book</b> - We can now deliver your products to another address other than yours! This is perfect to drop ship direct to your customer.' . "\n" . '<li><b>Order History</b> - View your history of purchases that you have made with us.' . "\n"\n");

define('EMAIL_WARNING', '<b>Note:</b> This email address was used to request access to our wholesale website. If you did not signup to be a customer, please send an email to ' . STORE_OWNER_EMAIL_ADDRESS . "\n\n");

define('EMAIL_TEXT_SUBJECT', 'Account Approved');

define('EMAIL_SEPARATOR', '----------------------------------------------');


Add or take out the "\n" 's to suit your taste in spacing

 

hth James

Link to comment
Share on other sites

  • 2 weeks later...

I'm trying to use this for a members only download site but the translation to ms2.2 doesn't work properly for me:

 

In login.php (MS2.2) I'm supposed to be looking for:

 

// Check that password is good

 

if (!tep_validate_password($password, $check_customer['customers_password'])) {

        $HTTP_GET_VARS['login'] = 'fail';

      } else {

 

But all I can find is:

  if (!tep_validate_password($password, $check_customer['customers_password'])) {

        $error = true;

      } else {

        if (SESSION_RECREATE == 'True') {

          tep_session_recreate();

        }

 

So where do I?

## insert this: ################################

 

 

        if ($check_customer['member_level'] == 0 ) {

          $HTTP_GET_VARS['login'] = 'invalid';

        } else {

 

And after this section I run into the same problem so:

## Find this [approx line 56]:  ################################

 

        } else {

          tep_redirect(tep_href_link(FILENAME_DEFAULT));

        }

      }

    }

  }

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);

 

But this is what's there:

} else {

          tep_redirect(tep_href_link(FILENAME_DEFAULT));

        }

      }

    }

  }

 

  if ($error == true) {

    $messageStack->add('login', TEXT_LOGIN_ERROR);

  }

 

So exactly what do I replace with:

## Replace with this:  ################################

 

        } else {

          tep_redirect(tep_href_link(FILENAME_DEFAULT));

          }

        }

      }

    }

  }

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);

Link to comment
Share on other sites

Okay, I've got this working beautifully at the admin end but at the front end it's like it doesn't even exist. No error messages etc- it just ignores the need for approval and grants access anyway.

Link to comment
Share on other sites

  • 1 year later...
Okay, I've got this working beautifully at the admin end but at the front end it's like it doesn't even exist. No error messages etc- it just ignores the need for approval and grants access anyway.

 

I'm very interested in getting this cont. to work.

 

I have the same problem as above, but my approval-thing works though. The bad thing is, that no error message appears, when i use an email address, allready existing in the database. The script just moves on at tells me that my account is waiting for approval.

 

... And it is not!

 

Hope someone can make an updated version of this contribution, since it is the only way to control a wholesale site.

 

Regards

Nikolaj

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...