Hi everyone,
I am still new to the forums and MODx, and this will be my first released addon, so I would appreciate any help and advice. I am working on a social networking website that will have a message and profile system similar to MySpace, Facebook, and Twitter. I couldn’t find anything like this that existed, and I saw other forum posts of people looking for something similar. I got something going that works great in MODx Revolution, so I want to release it as an addon.
I don’t really know the process for getting the code up to snuff and released. Am I in the right place? What process should I follow to get the code released in a manner that other people can improve it if they want to? Since I use a lot of existing snippets, should I just release the new plugin and snippets and create a tutorial for piecing everything together? Or should I use PackMan to pack everything together as dependencies?
Here’s the basic structure of the site:
The friendly URL profile pages: (e.g. site.com/john, site.com/becky, site.com/john/messages, etc...)
- Uses the existing Login and Peoples packages to register users, create lists of users, and handle all of the profile info.
- Created a friendly URL plugin (loosely based on the Archive FURL plugin) that activates on page not found. www.sitename.com/username is the main user page, although any custom field can be used instead of the username. The plugin looks up the user and redirects to the resource ID specified in the system settings. www.sitename.com/username/action-name allows an unlimited number of actions, such as john/messages, john/profile, etc.... . All of the actions can be specified in a single comma-separated system setting. For instance: 123:messages,124:profile means that resource 123 is used when the URL username/messages is entered. The plugin also passes the action name if there is one, userid, and username to the resource as GET parameters.
- On the actual user pages, I use the existing getUrlParam addon to get the username (or whatever is used to fetch the friendly URL) and action name and use these to generate breadcrumbs, canonical, and other links, since [tt][[*id]][/tt] doesn’t work. It would also be a piece of cake to make a snippet that generates the link instead.
- I also use getUrlParam to get the userid as passed by the plugin. Coupled with the profile snippet from the Login addon (or the userinfo output filter), this fetches any information I need about the user.
The message wall: (uses MODx’s default message system).
MODx comes with a message table that already includes from, to, subject, message, date, and private. I just reused the existing system, with "public" messages showing up on the profile pages as a "message wall" and private messages only showing up as private communication between members.
- I made a getMessages snippet that outputs messages. Optional parameters include recipient, sender, private (default: no), and sent (default: no). It is fully templatable with an output chunk (with message fields as placeholders). When used on the profile page, by default it outputs only the public messages sent to the profile owner (as "profile comments" by other people). If "sent" is marked as yes, it outputs messages sent by the sender. When the "private" parameter is marked yes, the snippet will only show the messages if the logged-in viewer is the recipient (for received messages) or sender (for sent messages). It also supports permissions settings.
- I also made a formIt hook called formit2message. It creates a new message from the "subject" and "message" fields with the logged-in user’s userid as the sender, and (by default) the profile owner’s userid as the recipient. An optional private parameter specifies whether the message is a public post (default) or private message. At the end, it refreshes the page to view the new message.
I will be adding more functionality as well, including automated notification sending, editing and deleting messages, and a bunch of user-specific settings, etc..., but some of that may require "extending" with custom database tables to avoid overusing the extended user fields already provided with MODx. How do I go about seeing if anyone is interested in developing this snippet with me? Where do I go from here?
Thanks for any feedback!
- Oleg