Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

Profile Module?


Reply


5 Posts   2310 Views

Avatar
BigChris

Community Member, 63 Posts

24 August 2009 at 4:33am

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

Avatar
BigChris

Community Member, 63 Posts

24 August 2009 at 5:53am

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

Avatar
Willr

Forum Moderator, 5513 Posts

24 August 2009 at 9:21am

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

Avatar
OnebyOne

Community Member, 54 Posts

8 September 2009 at 6:59pm

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

Avatar
OnebyOne

Community Member, 54 Posts

8 September 2009 at 7:13pm

Edited: 08/09/2009 8:03pm

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' => ' ',
      );
   }
}