Buy Now
Sign in

Joomla Registration

treehugger , November 14 2008, 17:54
T
treehugger 11
November 14 2008, 17:54 #17156
Forgive my ignorance but what is the purpose of the Joomla Registration Plugin?
I've just installed Chronoforms V3 on Joomla 1.5.7 in legacy mode. I have set up a form and it is working perfectly (YAY!).
I presumed that using the Joomla Plugin would replace my chosen form with the Joomla Registration...is this not the case?
If it is then what am I missing because I still have the default Joomla registration form in place and if this isn't what it's for then can you let me know it's purpose.
Thanks in advance!
GreyHead 65
November 14 2008, 18:11 #17161
Hi treehugger,

The Joomla Registration Plugin lets you use your own ChronoForms form for user registration. That way you have more control over the form and you can also collect some extra info and seve it in a separate table if you wish.

You have to supress the standard registration yourself - there are some instructions for that in the forums I think.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
T
treehugger 11
November 14 2008, 18:36 #17163
Thanks again Bob!

I was hoping that new accounts would receive an activation email like they would get registering in the Joomla registration - but I see this is not the case.
or am I completely missing something?
GreyHead 65
November 14 2008, 18:46 #17164
Hi treehugger,

As far as I recall you can set up an email as you would with a normal ChronoForms form. Check the tutorial in the Downloads section - that gives more detail.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
T
treehugger 11
November 17 2008, 16:58 #17300
All sorted now thanks to your excellent tutorial!
Thanks!
G
gg4j 114
November 20 2008, 15:13 #17666
Hi again people!

So I read your tutorial (clear as always, guys, let me know that so far you are the best in terms of assistence for Joomla... I get even a better feedback that from official site!!! )

.. oh yeah, tutorial about plugin Joomla registration.
I have still to test it true, but one question: is the plugin extending as well the db table where the data are stored
I mean, is it possible to extend the jos_user db table with other fields by simply adding more input fields in the form ?
GreyHead 65
November 20 2008, 15:33 #17667
Hi gg4j,

No, I'm pretty certain that CF doesn't alter the structure of the Joomla core tables. That would make upgrades too messy.

Instead you can put extra fields on your form, save them in a CF table using the user_id as an index and then join the two together when you need to use them.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
G
gg4j 114
November 21 2008, 12:36 #17755
mmm thanks.
Instead you can put extra fields on your form, save them in a CF table using the user_id as an index and then join the two together when you need to use them.


So I tried the following.
I created a form register", like the tutorial said.
I created a table for that: jos_chronoform_register.

Since the form is linked to the Jregistration plugin, the data are stored anyway in jos_user.

So: how to extend the form wiht more data? is it possible, with the same query, to send part of the data to one table (text_0 ... text_4 to jos_user and the rest (let's say meta of the user, fields meta_1...meta4) to a jos_chronoform_register?



Second question.
Which command for a query in sql should I use, to make a check if the user is currently registered, before the user can access to another form in a registered access section?
Which command to send some data from field in jos_user to a jos_chronoform_table, after the user click submit, and the system verified the user is subscribed?

Thanks... a lot!
admin 32
November 21 2008, 20:39 #17785
Hi gg4j,

first question, select the jos_chronoforms_register table in the DB connection tab and enable the connection.

2nd one, use this code at any form to check if a user is logged in:

<?php
$user = JFactory::getUser();
if($user->id){
//do something or nothing, is logged in
}else{
echo "you are not logged in";//show login message
return;//don't display the form
}
?>

Regards
Max
G
gg4j 114
November 22 2008, 16:48 #17836
Oh yes, indeed, I was looking for that I found the same, thanks.

But perhaps I report a bug:
I want to use the functions for the class Juser (sorry if the words maybe are not correct)
(Forum users, have a nice look at: http://www.jlleblanc.com/joomla/Tutorials/JUser_tutorial_for_Joomla!_1%115/)

Since I wanted to insert the data concerning the user in my cf_table, I was trying to modify the autogenerated code... but when I save it, there are no savings at all!...

Your CF is really nice, because I saw that actually it does half of the job.

Here's the autogenerated code:

<?php
    if($paramsvalues->dbconnection == "Yes"){
      $user = JFactory::getUser();      
      $row =& JTable::getInstance("chronoforms_photocontest2", "Table");
      srand((double)microtime()*10000);
      $inum  =  "I" . substr(base64_encode(md5(rand())), 0, 16);
      JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
      JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
      JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
      JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
      $post = JRequest::get( "post" , JREQUEST_ALLOWRAW );      
      if (!$row->bind( $post )) {
        JError::raiseWarning(100, $row->getError());
      }        
      if (!$row->store()) {
        JError::raiseWarning(100, $row->getError());
      }
      global $row_jos_chronoforms_photocontest2;
      $row_jos_chronoforms_photocontest2 = $row;
    }
    ?>
    




I want to add:


JRequest::setVar( "cf_user_name", JRequest::getVar( "cf_user_name", $user->name, "post", "string", "" ));



but I cannot save it...
admin 32
November 22 2008, 22:58 #17844
Hi, add this to the onsubmit before email if you have emails running or to the onsubmit after email!

Regards,
Max
G
gg4j 114
November 23 2008, 19:16 #17877
add this to the onsubmit before email if you have emails running or to the onsubmit after email!

Yes I did like that, it works, but so what's the difference with the autogenerated code?
And is not possible to change it?
For example, I cannot delete it, that makes a bit strange for me: I have a code after submitting that is practically the same with the autogenerated one... which is not possible to delete..
admin 32
November 23 2008, 22:53 #17885
You can't delete this auto generated code, either disable the DB connection to disable this code or enable it to run the code, but no need to delete it!

Regards
Max
G
gg4j 114
December 11 2008, 14:53 #19160
Hi guys,

so everything is working fine now, just I guess the last issue.

I followed the tutorial, and I am at this point:


A finishing touch - Directing users away from the regular registration page
Once you have created the new registration page and have tested it to ensure it is working properly*, you need to ensure that users don't end up at
the old (regular) registration page. To do this, one file needs to be altered (ensure you've made a backup copy of this file first).
The file can be found at: components\com_user\views\register\tmpl\default.php
You need to alter the code at the very beginning of the file, so that....
<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
Is changed to....
<?php // no direct access
defined('_JEXEC') or die('Restricted access');
$mainframe->redirect('chronoforms_url');
?>
For example, if you want to move the users away from "http://www.yourdomain.com/index.php?option=com_user&task=register to
http://www.yourdomain.com/register.html, the code would be....
<?php // no direct access
defined('_JEXEC') or die('Restricted access');
$mainframe->redirect('register.html');
?>
Building


So locally everything is ok and working fine:
I just replace:
register.html
with:
index.php?option=com_chronocontact&chronoformname=Register

Instead, on the web site on air the redirect does not work.
Not that I have SEO enabled.

I even have tried to insert the whole link:
http://mysite/index.php?option=com_chronocontact&chronoformname=Register

So I was thinking to take the problem from another point:
use the plugin for displaying the form within an article.
But the article with the registration form will not available from any menu, so I don't know how the URL will be rewrited..
http://mysite/?/register

Any help?

It would be the final part!!
G
gg4j 114
December 11 2008, 14:55 #19162
P.s. please note that the page:
http://mysite/index.php?option=com_chronocontact&chronoformname=Register

is display correctly the registration form, even with SEF enabled.
admin 32
December 12 2008, 01:32 #19234
Hi, to what it redirects then when you apply this hack ?
G
gg4j 114
December 12 2008, 08:27 #19248
When clicking on: "Create an account", it redirects to this page:
http://mysite/component/user/?task=register#content
admin 32
December 12 2008, 12:22 #19294
please copy and paste here the whole 15 lines or so from this file you edited inside code tags!

Regards
Max
G
gg4j 114
December 15 2008, 11:56 #19424
THANKS Max.

Here the code in my file: components\com_user\views\register\tmpl\default.php for allowing redirect in registration form to a "register" form made in CF:

<?php // no direct access
defined('_JEXEC') or die('Restricted access');
$mainframe->redirect('index.php?option=com_chronocontact&chronoformname=Register');
?>
<script type="text/javascript">
<!--
  Window.onDomReady(function(){
    document.formvalidator.setHandler('passverify', function (value) { return ($('password').value == value); }  );
  });
// -->
</script>

<?php
  if(isset($this->message)){
    $this->display('message');
  }
?>

<form action="<?php echo JRoute::_( 'index.php?option=com_user' ); ?>" method="post" id="josForm" name="josForm" class="form-validate">

<?php if ( $this->params->def( 'show_page_title', 1 ) ) : ?>
<div class="componentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>"><?php echo $this->escape($this->params->get('page_title')); ?></div>
<?php endif; ?>

<table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane">
<tr>
  <td width="30%" height="40">
    <label id="namemsg" for="name">
      <?php echo JText::_( 'Name' ); ?>:
    </label>
  </td>
  <td>
    <input type="text" name="name" id="name" size="40" value="<?php echo $this->user->get( 'name' );?>" class="inputbox required" maxlength="50" /> *
  </td>
</tr>
<tr>
  <td height="40">
    <label id="usernamemsg" for="username">
      <?php echo JText::_( 'Username' ); ?>:
    </label>
  </td>
  <td>
    <input type="text" id="username" name="username" size="40" value="<?php echo $this->user->get( 'username' );?>" class="inputbox required validate-username" maxlength="25" /> *
  </td>
</tr>
<tr>
  <td height="40">
    <label id="emailmsg" for="email">
      <?php echo JText::_( 'Email' ); ?>:
    </label>
  </td>
  <td>
    <input type="text" id="email" name="email" size="40" value="<?php echo $this->user->get( 'email' );?>" class="inputbox required validate-email" maxlength="100" /> *
  </td>
</tr>
<tr>
  <td height="40">
    <label id="pwmsg" for="password">
      <?php echo JText::_( 'Password' ); ?>:
    </label>
  </td>
  <td>
    <input class="inputbox required validate-password" type="password" id="password" name="password" size="40" value="" /> *
  </td>
</tr>
<tr>
  <td height="40">
    <label id="pw2msg" for="password2">
      <?php echo JText::_( 'Verify Password' ); ?>:
    </label>
  </td>
  <td>
    <input class="inputbox required validate-passverify" type="password" id="password2" name="password2" size="40" value="" /> *
  </td>
</tr>
<tr>
  <td colspan="2" height="40">
    <?php echo JText::_( 'REGISTER_REQUIRED' ); ?>
  </td>
</tr>
</table>
  <button class="button validate" type="submit"><?php echo JText::_('Register'); ?></button>
  <input type="hidden" name="task" value="register_save" />
  <input type="hidden" name="id" value="0" />
  <input type="hidden" name="gid" value="0" />
  <?php echo JHTML::_( 'form.token' ); ?>
</form>
As said, the redirect is not working...
SEF enabled, I don't know if it matters.
GreyHead 65
December 15 2008, 12:02 #19425
Hi gg4j,

Try adding 'global $mainframe;' before your re-direct line.

ob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much