Site Access - Demo v1.1

Release Notes

This plugin was built for elgg developers to get them started with customizing the login/registration forms.  And is not ment to be used on your actual site.

 

A simple plugin that extends the login/registration forms used by siteaccess.   You can find the latest siteaccess plugin here.

 

This adds a simple checkbox to both the login and registration forms that has to be checked in order to login or register.  You can use this as a template to add or require your own fields on your site.

 

Added in 1.1.. is a date picker and will require that the user set their Date of Birth before registering with the site.  Upon successful registration it will add the date of birth to the user object.  sets the metadata 'dob' to the date selected for documentation of what this means read the following: Engine/DataModel/Metadata.

 

The reason this was created:

was demontration only!  The idea is everyone will want to add different fields or boxes and will want to customize there own site with these fields.  This demo's how you can create an addon for your own site and require all the fields that you want if any during the login and registration process.  putting this in another addon will make them peristent when the siteaccess addon gets updated.  This demo's how you can add fields to these forms without modifying the siteaccess plugin itself.

 

 

  • Nice - Could this also add gender? 

    I guess now it will be easy to add terms /privacy to it too right?

    Thanks

  • why when i put the date of birth in a register form ,its not add to user profile ?

    "sets the metadata 'dob' to the date selected" what is the meaning?

  • When you add fields to a profile you create metatdata for that field.  For more information read this documentation. This is meant to be a template to demonstrate how to create your own addon and require any fields that you want during the registration process and attach them to the user object.  So you could you require gender sure...  you could even make it a drop down box that requires you to select one or the other field and then add it to the metadata for the user object.   Of course to get this metadata to show up on the user profile is going to require a little more work.  But this demo's what needs to be done for you to add/customize as many fields as you want during the registration process. 

    The reason this was created:

    was demontration only!  The idea is everyone will want to add different fields or boxes and now you can update your site and require these fields and boxes without making modifications to the Site Access plugn and they will persist when I update the siteaccess plugin.

  • Shellcode, thank you for advancements and this demo! Your help is greatly appreciated!!  Keep up the good work!!  Keep advancing this!!  Thank you!!  Спасибо!!

  • I read through the information but I either can find it or am ignorant of how it works (probably the latter...)  :-)

    On the registration page there is a big, juicy section to the right where I could include text on the process.  But I can't figure out how to put it there, and I'm downright scared of anything that would cause me to need to set up columns...  Can you provide clues?  Thanks!

    image
  • That should have read *can't* find it, of course.  So tired....

     

  • Yeah that is done a little different...  There isn't a good way to do that... but I can update the siteaccess plugin to allow you to provide a custom link where you can specify a new link/page that would handle the regiration.  Then you could include the registration form into the new page with the additional content your wanting.  There is a potential other workaround I'll look into and if it works I'll upload a new 1.2 version of this demo.

  • Is there any how-to for showing the information i filled in the registration form in the profile? We are using the Flex Form Plugin

  • @db...

    you can modify the registration page in the siteaccess plugin by simply modifying the bottom of the register.php file after the ?>

    view here http://thefloridacircle.com/community/account/register.php

    just make your page and put your css in the css.php file  very simple

     

    herre is what i did..  in register.php added:

        <!-- custom registration page -->
        <div id="reg_wrap"><!-- 1 div wrap -->
        <div id="reg_inside">
       
        <!-- registration box -->
        <div id="new-register-box">
        <div id="reg_inside2">
       
        <div class="reg_top">
        <div id="reg_inside2">
        <h2><?php echo elgg_echo('Sign up for The Circle'); ?></h2>
        </div>
        </div>
       
        <div style="width:300px; margin-left:0; float:left;">
        <div id="reg_inside2">
        <?php echo elgg_view('input/form', array('action' => "{$vars['url']}action/register", 'body' => $form_body)) ?>
        </div>
        </div>
       
        <div style="width:323px; float:right;">
       
        <!-- registration info -->
        <div id="reg_info">
        <div id="reg_inside2">
        <p>Please fill everything out to register correctly, within a few minutes you will receive an email to confirm your email address. After you confirm you will be able to login and access the site.</p>
        <p>If you are registering to advertise in our directory, you can login on the home page to access  your members area</p>
        <p><b style="color:#F00;">NOTE:</b> When choosing your username, make sure it is what you want. You will not be able to change this name once created! The username will be attached to the url of your community profile. eg. thefloridacircle.com/username.</p&gt;
        </div>
        </div>
       
        </div>
        <!-- eof registration info -->
       
        <div class="clear"></div>
       
        </div>
        </div>
        <!-- eof registration box -->
       
       
        <!-- right side column -->
        <div id="reg_right">
       
        <div id="reg_reasons">
        <div id="reg_inside2">
       
        <div class="reg_top">
        <div id="reg_inside2">
        <h2>Why Signup for The Circle?</h2>
        </div>
        </div>
       
        <ul>
            <li id="inTouch">Stay in touch with friends & family</li>
            <li id="shareMedia">Share your photos albums & videos</li>

            <li id="findOld">Find old classmates & co-workers</li>
            <li id="itsFree">It's FREE!</li>
         </ul>
         <hr />
         <p class="noSpam"><strong>We do not spam.</strong> The Florida Circle understands that user privacy is the key to our success. Please read our <a href="<?php echo $vars['url']; ?>pg/expages/read/Privacy/">privacy policy</a>.</p>
       
        </div>
        </div><!-- eof reasons -->
       
        </div>
        <!-- eof right side column -->
       
        <div class="clear"></div>
       
        </div><!-- eof inside spacing -->
        </div><!-- eof 1 div wrap -->

     

    in css.php in the siteaccess subfolder added:

    /* custom reg css */

    #reg_wrap {
        margin:-10px 0 0 -10px;
        width:978px;
        font-size:15px;
    }
    #reg_inside {
        padding: 10px;
    }
    #reg_inside2 {
        padding: 5px;
    }

    .reg_top {
        background: #39F;
        color:#ffffff;
        margin-bottom:5px;
    }
    #reg_inside2 h2 {
        font-size:15px;
    }

    #new-register-box {
        float:left;
        width:643px;
        background:#fff ;
        font-size: 12px;
        margin:5px 0 5px 0;
        border:1px solid silver;
        -moz-border-radius: 8px;
        -webkit-border-radius: 8px;
    }
    #reg_info {
         border:1px solid silver;
        -moz-border-radius: 8px;
        -webkit-border-radius: 8px;
        background: #fff;
    }   


    #reg_right {
        float:right;
        width:303px;
        
        margin:5px 0 5px 0;

    }
    #reg_reasons {
         border:1px solid silver;
        -moz-border-radius: 8px;
        -webkit-border-radius: 8px;
        background:#fff ;
    }

  • also modified the form code to get rid of the default styles on it but that will give you an idea to get started

  • @Fusion: Looks cool nice work.

  • @shellcode:  thanks...  if it wasnt for your plugin id still be trying to figure out how to edit that page.

  • Hello folks.

     

    I'm trying to add some data to the user like his Identification Card (ID). But, I wanted that this information was persisted together with the name, user, pass and so one, because this information is VERY IMPORTANT (in elgg_users_entity).

    Could you tell me what would be more scalable and organized?

    1. Modify the core function register (VEEERY BAD).
    2. Create or modify a plugin that already does that. I liked site_access demo but it adds metadata in the middle of the data, and I didn't want to do this for this especific data.
    Thanks a lot guys.
    Cheers,
    Mauricio
  • Along with that, did you find any means to add a differente group?

    Maybe, this I could put together with this ID card. I need to highlight the people on this group in the hole site, like VIPs.

    I could add a metadata and check on the plugins I use to render differently. If you have another idea it would be very welcomed.

    Thanks a lot guys.

    Mauricio.

  • Mauricio,

    I had a similar problem.  I wanted to initialize a specific number of "credits" for a user entity upon registration.

    I found the code in this "Site Access Demo" plugin quite helpful.

    I modified an existing plugin I was working on.

    Start.php

    Inside my init function, I added:

    register_elgg_event_handler('create', 'user', 'creds_create_user');

    Then I added this new function:

        function creds_create_user($event, $object_type, $object)
        {
            if (($object) && ($object instanceof ElggUser))
            {
                $creds = 33;
                create_metadata($object->guid, 'creds', $creds,'', 0, ACCESS_PUBLIC);
            }
        }

    I never had any luck just straight modifying the Register.php core action file.  I'm not sure why.  But this method sounds like it's probably a better design anyway.

    Maybe that helps?

  • If anyone is interested, this is how I've added a new registration field to the profile page.  Note that the field I've added is not editable by the users, so I didn't need to show it on the "Edit profile" page.

    In my own plugin, Start.php, I added this line into my init function:

    extend_view('profile/status', 'my_plugin/profile');

    I then created a file /mod/my_plugin/views/default/my_plugin/profile.php, with this:

    <font color=red><b>Creds: </b><?php echo $vars['entity']->creds; ?></font>
    <br /><br />

    Where "creds" is the name of the new user entity metadata field that I previously added during registartion.

  • This gives me a start on extending the registration form which is great but I am struggling at the first hurdle :( I have activated this plugin but none of the paths to the php files work in a browser that I can see. e.g.

    http://mysite.com/mod/siteaccess_demo/views/default/siteaccess_demo/register.php is just blank

    Do I have to cut and paste all the code into the existing working files such as account/register.php to see the demo with the birthday dob ?

    I am probably missing something trivial I guess.

     

     

     

  • doh, nevermind it works. Got confused by having far to many different browsers open trying to test things. Thanks I get the idea with this much more clearly now.

  • New to Elgg... this demo was incredibly helpful but there is one thing I don't understand. When the two new fields get added to the main register page, they show up outside the <form> </form> tags (presumably because they are added to the bottom of the page), so their values don't seem to actually get submitted when the register form is submitted.

    Anyone can tell me what I might be doing wrong?

    Thanks!

  • new to elgg, where can I find a demo site?

Stats

  • Category: Uncategorized
  • License: FreeBSD license
  • Updated: 2014-11-17
  • Downloads: 1692
  • Recommendations: 0

Other Projects

View shellcode's plugins