PDA

View Full Version : Problems hacking contact.php and contact.html.php


ssssk2175
28.05.2004, 22:45
I am trying to hack the contact us component to automatically fill out some of the fields ( I have it linked only for registered users). I am using something like:
$database->setQuery( "SELECT * FROM #__users WHERE id = '$my->id'" );
and I 've done this same type of thing in custom modules and components before, but when I do it inside the contact.html.php or contact.php it seems as if $my->id isn't known. Does anyone know what is preventing me from doing this and how I might work around it? I am actually trying to make the contact form change dynamically according to who is accessing it and what type of contact they are trying to make. My assumption is that since the intention of the contact component would normally be for public accessibility, that there is some layer of insulation going on here, but I'm not sure what it is or how to work around it. Any help would be greatly appreciated.

njcallen
29.05.2004, 15:58
Add above your query:



global $my;



;)

ssssk2175
29.05.2004, 17:04
Thanks, that makes sense, but when I add it I still get:

Fatal error: Call to a member function on a non-object in /var/www/html/newsite/xxxxx/components/com_contact/contact.html.php on line 23

line 23 is is:

$database->setQuery( "SELECT * FROM #__users WHERE id = '$my->id'" ); :confused:

ssssk2175
29.05.2004, 22:07
added

global $database;

and all is good now, thanks much!

njcallen
30.05.2004, 16:25
i'm glad it works ;)