Lyle, I'm replacing the "Add

Posts: 42
Joined: 05/23/2008

Lyle,

I'm replacing the "Add to cart" button on my product page with text for anonymous users using:

<?php
function buy_memberships_nodeapi(&$node, $op, $arg3, $arg4){
  global
$user;
  if (
$user->uid == 0 && $op = 'view') {
   
$node->content['add_to_cart']['#value'] = t('You must <a href="login">log in</a> or <a href="user/register">create an account</a> to purchase family memberships.');
  }
}
?>

Works OK, except the text 'You must log in...' appears on many, but not all pages. Can't seem to limit it to just the product page.

Hide price unless Logged in? By: Miso (21 replies) Wed, 09/26/2007 - 20:41