Search

Currently building a contact form that should send an email to an author. I don’t want to save the messages in a section, just forward the form to an email address.

Also, everytime I try to create an event I get the following error:

Fatal error: Call to a member function fetchFields() on a non-object in /Users/Bryan/Sites/blah/symphony/content/content.blueprintsevents.php on line 324

Do events need to be bound to a Section?

Nope. If you create them through the Symphony interface then yes (as you’d expect) but if you’re writing a custom event (which it sounds like you are) then there’s no need to include a getSource function. Take a look at the “Login Info” custom event that comes with the default blog workspace.

http://github.com/symphony/workspace/blob/master/events/event.login.php

Ah ok. Is there any actual documentation on writing custom events? I can probably figure it out from that event but just wondering. I’m a rubyist and haven’t touched php in years :P

Thanks!

Is there any actual documentation on writing custom events?

Nope. By their nature of being “custom” it’s rather difficult to document! But the basic anatomy of an event:

  • the file should be named file.{eventname}.php
  • the class name should therefore be eventEventname
  • extend the Event class
  • the load method is executed every time the page that event is attached to loads
  • if you want it to only execute on POST then add your $_POST checks in here
  • load should return an XMLElement (a Symphony object) which is appended to the page XML when the event executes

that url is no longer valid. are there any other good examples?

fantastic! thank you.

here is an example of a custom event i just recently created. i’ve made modifications to the frontend authentication extension to use until the membership section is finalized. among those modifications is the storage of passwords as md5 hashes instead of plaintext.

with that comes the inability to simply email a user their password, so what i’ve done is create a separate section specifically for password retrievals. the section contains the user’s email (their unique username), a date the request was submitted, and an option field for a hash. since the hash cannot automatically be generated by symphony, nor is there a way to e-mail the targetted user with the default event framework, i’ve added code that will look up the most recently created entry (created by the default event behavior), assign a hash, then email that hash to the user.

i put it up here so that perhaps it will encourage a discussion about the proper way to construct custom events and any sql within them.

pastebin

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details