Jump to:

23450 Posts in 18899 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Profile Module?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2169 Views
  • BigChris
    Avatar
    Community Member
    63 Posts

    Profile Module? Link to this post

    Hello,

    I am new to SilverStripe, so some of this may have already been asked/answered.

    I am developing a website utilising SilverStripe for the listing of Comedy Shows. The EventsCalender module seams ideal for the listing of gigs.

    My long term intention is to allow each promoter/venue to login, update/edit/add their details and not interfere with other parts of the site. I am thinking that a user logs in, is presented with a form, showing the details of their venue, pictures, upcoming events, address, opening hours, etc

    What modules there are for profiles/pages of the same repeating layout but different content? i.e. Venue A, Venue B, Venue C

    Or is this something I will have to develop via ModelAdmin?

    Regards
    Chris

  • BigChris
    Avatar
    Community Member
    63 Posts

    Re: Profile Module? Link to this post

    I have had a think on this,

    Can you create users that are restricted to only editing their own pages (and in specific directories)?

    If so can they also be restricted to only being able to create a basic page type and also a calendar event?

    If so this might be a better solution for me.

    Thank you in advance.

    Cheers
    Chris

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Profile Module? Link to this post

    Well there is a simple registration module which has code for registering and managing user profiles. You can download it from http://open.silverstripe.com/changeset/latest/modules/registration/trunk?old_path=/&filename=/modules/registration/trunk&format=zip you would need to extend it to handle users add their own pages as well

  • OnebyOne
    Avatar
    Community Member
    54 Posts

    Re: Profile Module? Link to this post

    the problems with this SS modules is that are not coming ready to use at the best expectation and also some of them have poor documentation (This is my conclusion after building websites with drupal, joomla, typolight, wordpress, ...)

    Here for example, the registration module (i was in the haven when i found it) I'm in hell now
    - no docs about it http://doc.silverstripe.com/doku.php?id=modules:registration
    - i can't see the users in admin or added to a group - probably i have to add this in the script
    - no anti spam at registration

    thx

  • OnebyOne
    Avatar
    Community Member
    54 Posts

    Re: Profile Module? Link to this post

    here is my code, for assign a member to a group, using registration group RegisterPage.php
    Group ID is important - create a group (assign admin roles only if necessary) - than put the ID of the Group into this code

    now is remaining to ad a check box for subscription http://doc.silverstripe.com/doku.php?id=member_groupset#componentset

    <?php

    /**
    * Page containing a registration form.
    * Uses Member::getMemberFormFields() to know what to ask of a user.
    */
    class RegisterPage extends Page {
       static $db = array(
          "ThanksTitle" => "HTMLVarchar",
          "ThanksContent" => "HTMLText",
       );
       
       function getCMSFields($cms) {
          $fields = parent::getCMSFields($cms);
          
          $fields->addFieldsToTab("Root.Content.Thanks", array(
             new TextField("ThanksTitle", "Title"),
             new HTMLEditorField("ThanksContent", "Content"),      
          ));
          
          return $fields;
       }
       
    }

    class RegisterPage_Controller extends Page_Controller {
       /**
        * Return the edit form for the current user
        */
    private $defaultGroupID = 2;

       function Form() {
          // Get the fields from a new member - seems like a good default
          $member = new Member();
          $fields = $member->getMemberFormFields();

          $actions = new FieldSet(
             new FormAction('register', 'Register')
          );

          $form = new Form($this, 'Form', $fields, $actions);

          return $form;
       }

       /**
        * Save the profile details
        */
       function register($data, $form) {
          // Create a new member and save the form into it
          $member = new Member();
          $form->saveInto($member);

          // Write to the databsae
          $member->write();

          // defaultGroupID
    if($group = DataObject::get_one('Group', "ID = $this->defaultGroupID")) {

             $member->Groups()->add($group);
             // Redirect to a page thanking people for registering
             Director::redirect($this->Link() . 'thanks');

          }else{

             // Redirect to a failure page
             Director::redirect('registration-failed/');

        }
    }
       
       function thanks() {
          return array(
             'Title' => $this->ThanksTitle,
             'Content' => $this->ThanksContent,
             'Form' => ' ',
          );
       }
    }

    2169 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.