Allow only registered users to view

XBumble 22 Nov, 2008
HI there,

Apologies if this has been asked already - I did a search but couldn't find anything.

I'm testing Chronoforms with Joomla 1.0. I have successfully managed to put up a working form, but I cannot see a way to make the page available only to registered users. I can't obviously use the normal Joomla way.

Can anyone please help me?

Many thanks
GreyHead 22 Nov, 2008
Hi XBubmle,

Try this thread. It's here loads of times but not so often recently for Joomla 1.0

Bob
XBumble 23 Nov, 2008
Hi Bob,

Thanks for the reply, but that thread is about

Joomla 1.0 How do I include username and/or email in form

What I require is to make the page only viewable to registered users.

If you could help I would be awfully grateful.
Max_admin 23 Nov, 2008
Hi, use this code:

global $my;
if(!$my->id){
echo "you are not allowed to see this form";
return;
}
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
XBumble 23 Nov, 2008
HI there,

Thanks for the reply.

Where exactly do I use this code?

Many thanks
Max_admin 23 Nov, 2008
at the top of your form code in the HTML code box!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
XBumble 24 Nov, 2008
HI there,

This doesn't work for me I'm afraid. I put it at the top of the form code but when I visit the page I get:

global $my; if(!$my->id){ echo "you are not allowed to see this form"; return; }

showing above the form.

Here is the form code:

global $my;
if(!$my->id){
echo "you are not allowed to see this form";
return;
}
<p class="contentheading">Subscribe to Helicopter Monthly</p>
<p>Please fill out the form below if you would like to subscribe to Helicopter Monthly and we will contact you with further details.</p>
<p>
<label for="sub_name">Name:</label>
<br/>
<input name="sub_name" id="sub_name" type="text" />
</p>
<p>
<label for="sub_address">Address:</label>
<br/>
<textarea name="sub_address" id="sub_address" type="text" /> </textarea>
</p>
<p>
<label for="postcode">Postcode:</label>
<br/>
<input name="sub_pcode" id="sub_pcode" type="text" />
</p>
<p>
<label for="sub_country">Country:</label>
<br/>
<input name="sub_country" id="sub_country" type="text" />
</p>
<p>
<label for="sub_email">Email:</label>
<br/>
<input name="sub_email" id="sub_email" type="text" />
</p>
<p>
<label for="sub_job">Profession:</label>
<br/>
<input name="sub_job" id="sub_job" type="text" />
</p>
<p>
<label for="sub_id">Membership ID</label>
<br/>
<input name="sub_id" id="sub_id" type="text" />
</p>
<p>
<input type="radio" name="subscription_type" value="print"> Printed Version
<br>
<input type="radio" name="subscription_type" value="digital"> Digital Version
</p>
<p>
<input type="submit" value="Submit">
</p>


Probably me being stupid but would really appreciate the help.

I tried doing the 'thank you for submitting the form' thing as well and got the same problem where is just printed those words on the form before it had been submitted.
GreyHead 24 Nov, 2008
Hi Xbumble,

We're not doing too well for you here - apologies.

The code shippet needs to be inside <?php . . . ?> tags
<?php
global $my;
if ( !$my->id ) {
  echo "you are not allowed to see this form";
  return;
}
?>
<p class="contentheading">Subscribe to Helicopter Monthly</p>

Bob

Note to other readers - this is Joomal 1.0.x code and will not work with native Joomla 1.5.x
XBumble 24 Nov, 2008
Hi Bob,

I really appreciate your help, and apologies for taking up your time.

This has indeed now worked, and I am very grateful.

Mike
This topic is locked and no more replies can be posted.