Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

display links based on level


josh48202

Recommended Posts

Hi everyone im trying to get links and other certain information to be displayed based on their group level. i added a row to the database called group_id every member is either a 1 or a 2. i also added these other bits of code as followed...

 

in catelog/login.php i added group_id to $check_customer_query

 

$check_customer_query = tep_db_query("select customers_id, group_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");

 

i also added these as well to login.php

 

$group_id = $check_customer['group_id'];

 

tep_session_register('group_id');

 

everything from there works just fine. i added this code just for practice to get it working in the catelog/includes/column_right.php

 

if (tep_session_is_registered('group_id')) require(DIR_WS_BOXES . 'loginbox.php');

 

Now this works and shows up if the member is registered and logged in. Now my question is....

 

How do i get this loginbox.php to only show up if the group_id is equal to 2?

Link to comment
Share on other sites

Hi everyone im trying to get links and other certain information to be displayed based on their group level. i added a row to the database called group_id every member is either a 1 or a 2. i also added these other bits of code as followed...

 

in catelog/login.php i added group_id to $check_customer_query

 

$check_customer_query = tep_db_query("select customers_id, group_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");

 

i also added these as well to login.php

 

$group_id = $check_customer['group_id'];

 

tep_session_register('group_id');

 

everything from there works just fine. i added this code just for practice to get it working in the catelog/includes/column_right.php

 

if (tep_session_is_registered('group_id')) 

 

Now this works and shows up if the member is registered and logged in. Now my question is....

 

How do i get this loginbox.php to only show up if the group_id is equal to 2?

Something like this:

 

<?php
 if ( ( tep_session_is_registered('group_id') ) && ( (int)$group_id == 2 ) )
   require(DIR_WS_BOXES . 'loginbox.php');
?>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

thanks for trying but that didnt work =[

I tried the code on site I manage and it works for me.

:huh:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

alright i dont like that i cant edit my previous post so i dont have to double post but o well.

 

i changed the code up in login.php

 

$check_group_id_query = tep_db_query("select group_id from " . TABLE_CUSTOMERS . " where customers_id != '" . (int)$customer_id . "'");
       $check_group_id = tep_db_fetch_array($check_group_id_query);
       $group_id = $check_group_id['group_id'];
       tep_session_register('group_id');

 

this works even when i echo $group_id but if i was to change the group_id value to anything else it wont change enless i empty cache and remove cookies.

any ideas?

Link to comment
Share on other sites

alright i dont like that i cant edit my previous post so i dont have to double post but o well.

 

i changed the code up in login.php

 

$check_group_id_query = tep_db_query("select group_id from " . TABLE_CUSTOMERS . " where customers_id != '" . (int)$customer_id . "'");
       $check_group_id = tep_db_fetch_array($check_group_id_query);
       $group_id = $check_group_id['group_id'];
       tep_session_register('group_id');

 

this works even when i echo $group_id but if i was to change the group_id value to anything else it wont change enless i empty cache and remove cookies.

any ideas?

Sounds like your session is getting lost.

 

All I know is the code I posted works, provided the session isn't lost.

 

In my test I set the value for $group_id on one page, and when I went to another and echo'ed it, it was exactly as I set it on the first page.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

i just installed a fresh copy of oscommerce v2.2 with the same modifications as i said in the first post and the same modifications you said work and when i echo $group_id the same thing happens. i have to clear cookies for the number to change???????!!!!?!?!?!?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...