Page 1 of 1

Member Approval Add On

Posted: Sun Oct 10, 2021 7:31 pm
by Omar_one
Hello
I have update an addon called price-display-members-only to work on 1.0.8.6 and it's working well,
so I would like to add field to customers table (customer_approval) so when I approval customer the prices will display just, the customers who's not approved by me he will not see the prices ..
so there any idea how to do that

there is an add-on for member approval add on for responsive and I think it has not uploaded to old add-on site .. it has just shared on github.com

Re: Member Approval Add On

Posted: Mon Oct 11, 2021 7:26 am
by Kofod95
I might have misunderstood something, so sorry if my answer is not what you are asking.
In order to have a customer-aproval thing, I would think adding a new customer-data-module would be the way to go, and just make it show only in admin?
If that is the way to do it, I would probably also add a admin-dashboard-module to show new unaproved customers, to make sure not to miss any.

//Daniel

Re: Member Approval Add On

Posted: Mon Oct 11, 2021 6:43 pm
by Omar_one
Thank you @Kofod95
Sorry I didn't explain it good.
the Member Approval will show only in admin and the admin who's will approve it .
what I had done I update called Display Price for Login Members Only, so I would like to add some function to this module or having some hook that after the customers has approved the prices will display..
I can PM you the files or I can share it here..

I was thinking of disabling the Account Navbar module and who's want to be customer will contact us ... but this it's not good

Re: Member Approval Add On

Posted: Tue Oct 12, 2021 8:10 am
by Kofod95
I see - so now your prices show for those who are logged in only, and you would want to further restrict that to aproved customers only, right?

I would think that restriction could be added to the module hiding the price for guests - I guess you have a column in the customers_table telling whether they are aproved or not? Adding an if () that checks for that value before it shows/hides the price should then be possible. If not, I will gladly take a look at the file hiding the price for guests, and see if I can make something work :)

//Daniel

Re: Member Approval Add On

Posted: Sat Oct 16, 2021 7:03 pm
by Omar_one
Kofod95 wrote: Tue Oct 12, 2021 8:10 am I see - so now your prices show for those who are logged in only, and you would want to further restrict that to aproved customers only, right?
Yes, just for approved customers.
Kofod95 wrote: Tue Oct 12, 2021 8:10 am Adding an if () that checks for that value before it shows/hides the price should then be possible. If not, I will gladly take a look at the file hiding the price for guests, and see if I can make something work :)
I will try to add an if () and see if it's helping if not I will come back to you :) :)
Thank you for your help

Re: Member Approval Add On

Posted: Sat Oct 16, 2021 8:19 pm
by ecartz
If you have a customer data module for your approval, you could modify cm_login_form.php by changing

Code: Select all

      $customer_query = $GLOBALS['db']->query($customer_data->build_read(['id', 'password'], 'customers', ['email_address' => $email_address]) . ' LIMIT 1');
      $customer_details = $customer_query->fetch_assoc();
      if (!$customer_details) {
        return false;
      }
to

Code: Select all

      $customer_query = $GLOBALS['db']->query($customer_data->build_read(['id', 'password', 'approval'], 'customers', ['email_address' => $email_address]) . ' LIMIT 1');
      $customer_details = $customer_query->fetch_assoc();
      if (!$customer_details || !$customer_data->get('approval', $customer_details)) {
        return false;
      }
That would block login until approval.

Re: Member Approval Add On

Posted: Mon Oct 18, 2021 11:27 am
by Omar_one
ecartz wrote: Sat Oct 16, 2021 8:19 pm If you have a customer data module for your approval, you could modify cm_login_form.php by changing

Code: Select all

      $customer_query = $GLOBALS['db']->query($customer_data->build_read(['id', 'password'], 'customers', ['email_address' => $email_address]) . ' LIMIT 1');
      $customer_details = $customer_query->fetch_assoc();
      if (!$customer_details) {
        return false;
      }
to

Code: Select all

      $customer_query = $GLOBALS['db']->query($customer_data->build_read(['id', 'password', 'approval'], 'customers', ['email_address' => $email_address]) . ' LIMIT 1');
      $customer_details = $customer_query->fetch_assoc();
      if (!$customer_details || !$customer_data->get('approval', $customer_details)) {
        return false;
      }
That would block login until approval.
Thank you @ecartz working well..