Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » A couple of forum questions

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1501 Views
  • thrax
    Avatar
    Community Member
    32 Posts

    A couple of forum questions Link to this post

    1) How can I create custom forum rankings? I would have thought in security > forum members however my account is not in there (as I'm admin) and on the Administrators list I can only select from exising rankings, not create new ones.

    2) I made my admin account with a username (not email), then made a test user with my email... I've now deleted the test user from the forum members security page, however when I go to put my email address into my own actual profile it tell me there is already a user with that email address.... how do I purge deleted accounts from the db all-together?

    3) How do I set the required fields for forum registration?

    4) Not about forums... but is it a "feature" of silverstripe that I need to ctrl F5 every time I update a page to see the changes? If so... can I stop it? lol

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: A couple of forum questions Link to this post

    1) One of the current issues with the forum is basically everything is hard coded and it makes it a mess to upgrade as to do anything other then the default requires to hack up the code. Eg for forum roles - how you currently add them is in the ForumRole.php file about like 158. You can just add roles to that array.

    2) As far as I know as soon as you delete a member the email should be removed. I don't think it does any crazy versioning, caching of members details etc. If you want to check you'll have to use PHPmyadmin to log into your database. Select your database and click the 'members' table. Do you see a record of your email? If so then it looks like deleting the member didnt work.

    3) This is another place were its all hard coded - you have to edit about line 115 in ForumMemberProfile.php - theres a bit where it goes new RequiredFields(...... just add the name of the field there)

    4) If you use firefox try out a web developers plugin called FireBug. It has a little disable tab and you can select Disable Cache which should disable some of the caching. Usually you don't have to do CTRL+F5 a lot. Just select Disable Cache in firebug (you can probably disable cache other ways too) and then just add ?flush=1 to the page you are working on.

    Hope that helps!

  • thrax
    Avatar
    Community Member
    32 Posts

    Re: A couple of forum questions Link to this post

    thanks for the tips willr, I'll give them a shot later on when I'm working on the page again.

    as for the cache issue, I'm more worried about when users visit the site that they won't see new content! As the site's not live yet I don't know if there is a prominent issue or not, but it's somthing I've noticed on my machine a lot (even just having to f5 in general, however I don't need to on any other site).

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: A couple of forum questions Link to this post

    Well another thing you can do is set the SS cache time using HTTP::set_cache_age(0); // time in seconds. Add that to your mysite/_config.php file .

  • thrax
    Avatar
    Community Member
    32 Posts

    Re: A couple of forum questions Link to this post

    cool, might give that a shot, ill see how i go!

    One more thing... I want to add a "terms and conditions" area to the forum registration page with a tickbox that must be ticked (agree'd to) before the register button will work.. any idea's?

    I know this is more of my own problem and falls in development really, but figured I'd ask anyway

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: A couple of forum questions Link to this post

    well basically what you need to do is add a CheckboxField - http://doc.silverstripe.com/doku.php?id=checkboxfield to the member profile and make it a required field. So Im basing line numbers off my version but they should be similar.

    First there needs to be a field on the members account (you can do this another way but its easier if you have a DB field which matchs your form)

    So open up ForumRole.php in the forum/code/ folder and add a Boolean (yes or no) field to the db = array bit

    'db' => array(
                'ForumRank' => 'Varchar',
                'Occupation' => 'Varchar',
                'Country' => 'Varchar',
                'Nickname' => 'Varchar',
                'FirstNamePublic' => 'Boolean',
                'SurnamePublic' => 'Boolean',
                'OccupationPublic' => 'Boolean',
                'CountryPublic' => 'Boolean',
                'EmailPublic' => 'Boolean',
                'LastViewed' => 'SSDatetime',
    'AgreedTerms' => 'Boolean'
             ),

    So then open up ForumMemberProfile.php in the forum/code/ folder and you need to add a checkbox field which points to that database field in the RegistrationForm() method (about line 103). You can also add the RequiredField

    On about 110 you have something like $fields = singleton... you need to add the checkbox field after that so you have

    $fields = singleton('Member')->getForumFields(true, $use_openid);
    $fields->push(new CheckboxField("AgreedTerms", "Do you agree?"));
          $form = new Form($this, 'RegistrationForm', $fields,
             new FieldSet(new FormAction("doregister", "Register")),
             ($use_openid)
                ? new RequiredFields("Nickname", "Email","AgreedTerms")
                : new RequiredFields("Nickname", "Email", "Password",
                                               "ConfirmPassword", "AgreedTerms")
          );
    ..

    Remember to db/build and you should be sweet!

  • thrax
    Avatar
    Community Member
    32 Posts

    Re: A couple of forum questions Link to this post

    Ok, done all of that and as usual have issues... lol (I've done /db/build?flush=1 btw)

    - Got rid of the account from PHPmyadmin (Y), but the question is still there how come it didn't delete previously... nevermind though

    - Got the checkbox showing and working as required field, but firstname and surname don't seem to work (as required fields, like the don't realise they're required). Also, now when I register a new user and hit "register" the page just reloads... it doesn't register them and there are no errors, it just reloads over and over. Below is how ForumMemberProfile.php looks after the changes. I didn't actually use the code on the checkboxfield doco, wasn't sure if I needed to, it seems to work without it.

    $fields = singleton('Member')->getForumFields(true, $use_openid);
          $fields->push(new CheckboxField("AgreedTerms", "Agree to Terms and Conditions"));
          $form = new Form($this, 'RegistrationForm', $fields,
             new FieldSet(new FormAction("doregister", "Register")),
             ($use_openid)
                ? new RequiredFields("Nickname", "Email", "FirstNamePublic", "SurnamePublic", "AgreedTerms")
                : new RequiredFields("Nickname", "Email", "Password",
                                               "ConfirmPassword", "FirstNamePublic", "SurnamePublic", "AgreedTerms")
          );

    - Also.. how do I show a text box (holding all the terms and conditions) on the rego page?

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: A couple of forum questions Link to this post

    dont have a clue why it wouldnt delete a member. It should remove the whole entry.

    As for the required fields - make the names of the fields the actual field names - FirstNamePublic and SurnamePublic should be FirstName and Surname.

    Adding another text box (with the terms and conditions is pretty simple) You can make this as fancy as you like (eg make the terms editable from the cms but I'll keep it in the code for now)

    ...
    $fields->push(new CheckboxField("AgreedTerms", "Agree to Terms and Conditions"));
    $text = "This is the terms and conditions for the site";
    $fields->push(new LiteralField("TermsConditions", $text));

    1501 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.