Page 1 of 1
UserId and Comments module
Posted: Sat Jan 28, 2006 5:33 pm
by mehepp
Hello!
What I would like to know is how to get the logged in user´s name to show up on the Send Comment page instead of the text box where he/she fills in their names. This is because I only want logged in users to send their comments.
Other suggestions are also welcome. Thank You in advance.
Re: UserId and Comments module
Posted: Sun Jan 29, 2006 7:07 pm
by mehepp
Ok...
So now the user name is displayed where I wanted it to show up on the send comment page...
heh... Now, if I only could figure out how to have it shown on the page where you read the comments too, everything would be just fine
Added this
Code: Select all
function DoAction($name, $id, $params, $return_id='')
{
$db = $this->cms->db;
$useridmodule=$this->GetModuleInstance("UserID");
switch ($name)
changed this
Code: Select all
<td>Your name:</td><td><?php echo $this->CreateInputText($id, 'author', $author)?></td>
to this
Code: Select all
<td>Your name:</td><td><?php echo $useridmodule->LoggedInName()?></td>
Right - that´s so far..

Re: UserId and Comments module
Posted: Mon Jan 30, 2006 12:21 am
by calguy1000
it may be handy if you posted a patch to the forge for inclusion back into the main svn or for others to apply easily.
Re: UserId and Comments module
Posted: Mon Jan 30, 2006 5:14 pm
by mehepp
Hi Patricia. Yes, you´re right, it wont be saved in the database the way I´ve done it... I appologize if someone thought that it would. I was hoping that some code gury could give me a hint about this, because I certainly don´t know what I´m doing.
Guess I´ll have to try with some more "hacking" when I get the time for it...

Re: UserId and Comments module
Posted: Mon Jan 30, 2006 7:12 pm
by calguy1000
no, that won't get saved to the database, as an excercise left for the user,
putting the username from the userid module into the input field, and then marking the input field as read only should do the trick.
Re: UserId and Comments module
Posted: Mon Jan 30, 2006 9:02 pm
by mehepp
Yes, I was heading somewhere that way too before... didn´t get it to work though... But I´ll give it another try later. Thanks.