AlexCrome CS

Current Version - 1-3

UPDATE: Fixed a few bugs in RegistrationPM and QuickReply, download the updated version from http://askcrome.co.uk/AlexCrome.CS-1.3.1.zip

Today I'm updating my package to include one additional CSModule, and one additional Control.  This package now contains the following addons, with new additions highlighted in Green:

Registration PM - Sends a private message to each user when they are created

MarkThreadsReadOnUserCreate - Marks all posts created before a new user registered as being read so the user’s ‘Unread posts’ page is not clogged up with posts created before he or she joined.

NotifyAdministratorOnUserCreate - Sends an email out to the specified email addresses whenever a new user is created.  Particularly useful when you're moderating newly created users.

MarkAllPostsRead - Similar to MarkThreadsReadOnUserCreate however, the control works on demand.

Quick Reply - Based on the CreateEditPostForm, it allows you to place a reply to post form at the bottom of a post list, and have all posts be in reply to the original.

UserHasUnreadPrivateMessageCondition - Allows you to display content based on whether or not a user has any unread Private Messages. The most obvious use of this is to give users a message when they have new private messages.

You can may download this package from http://askcrome.co.uk/AlexCrome.CS-1.3.zip http://askcrome.co.uk/AlexCrome.CS-1.3.1.zip, which also includes the source code for the package.

 

Breaking Changes

There is one small breaking change in the RegistrationPM module.  The Body and Subject Resources have been moved into a separate resource file - AlexCrome.CS.Resources, and so you'll have to move your resources into that.  As the resources are now in their own file, the resource names are hardcoded to "RegistrationPM_Subject" and "RegistrationPM_Body"

Bug Fixes

The MarkAllPostsRead control will now refresh the page when it's complete, instead of doing a postback, ensuring that the icons for posts and sections are updated correctly.

RegistrationPM will now sends once a user has been approved if your site requires users to be approved by an administrator.

Installation

Before you can this package, you must copy communityserver_override.config to the root of your website and copy AlexCrome.CS.dll to your website’s bin folder. You also need to open up your web.config file and find the <controls> section. After the last <add ... /> item, add

<add tagPrefix="ACControl" namespace="AlexCrome.CS.Controls" assembly="AlexCrome.CS" />

You will also need to merge the provided communityserver_override.config file with your existing one (if you don't have one, just copy the provided file into your web directory), and copy the AlexCrome.CS.Resources.xml file to the Languages files of each language your site uses (~/Languages/LANGUAGE KEY/) (translating the file as appropriate).

 

RegistrationPMclip_image002_thumb1[4]

The RegistrationPM CSModule sends a private message to each user when they are created.

For each language your site uses, copy the AlexCrome.CS.Resources.xml file into the appropriate language folder (Languages/<language>/resources.xml), and modify the existing resources as appropriate.  N.B. to include the user's username, use [username].  It is advised that you do so to prevent an issue whereby the module will fail if two users register within 15 minutes of each other (see Known Issues for more details).

Finally, open the communityserver_override.config file and change the SenderUsername to the username of the user who should appear to have sent the RegistrationPM.

MarkThreadsReadOnUserCreate

The MarkThreadsReadOnUserCreate module will mark all posts created before a new user registered as being read so the user’s ‘Unread posts’ page is not clogged up with posts created before he or she joined.

No further setup is required to install this module.

MarkAllPostsReadclip_image004_thumb1

The MarkAllPostsRead control is similar to the MarkThreadsReadOnUserCreate CSModule however, the control works on demand.

A common place to place this control is in the Forum Shortcuts. To do so, you need to open up ~/Themes/YOUR THEME/Forums/forum.master in a text editor. Next, find the line similar to

<ContentTemplate>
    <CSControl:SiteUrl UrlName="post_NotRead" Parameter1="-1"
                 ResourceName="Utility_ForumAnchorType_PostsNotRead" Tag="Li" runat="server" />
    <CSControl:SiteUrl UrlName="forumSubscriptions"
                 ResourceName="Utility_ForumAnchorType_ForumSubscriptions" Tag="Li" runat="server" />
</ContentTemplate>

Replace that with

<ContentTemplate>
    <CSControl:SiteUrl runat="server" UrlName="post_NotRead" Parameter1="-1"
                  ResourceName="Utility_ForumAnchorType_PostsNotRead" Tag="Li"  />
    <CSControl:SiteUrl runat="server" UrlName="forumSubscriptions"
                  ResourceName="Utility_ForumAnchorType_ForumSubscriptions" Tag="Li" />
    <li><ACControl:MarkAllPostsReadControl runat="server" Text="Mark all posts as read" /></li>
</ContentTemplate>

Save the file and upload it to your website. Goto your forums and the shortcuts box should look similar to the one above.

QuickReplyimage

The QuickReply control is based on the CreateEditPost Control, and can be placed anywhere in the context of a Thread.

A common place to place this control would be at the bottom of the flat thread view.  To add the control here, you'll have to open up ~/Themes/YOUR THEME/Forums/thread-flatview.ascx, and add your code toward the end of the file, just before the Ad Template.

The Control is based on the CreateEditPost control, so you should be able to copy the code from either ~/Themes/YOUR THEME/Forums/createeditpost.aspx or ~/Themes/YOUR THEME/Forums/quickreply.aspx

Please note, it is important that you include a GoToCurrentPostAction in the UnmodreatedSuccessActions to ensure that the new post is displayed when the user submits their post.

UserHasUnreadPrivateMessageConditionclip_image006_thumb1

The UserHasUnreadPrivateMessageCondition allows you to display content based on whether or not a user has any unread Private Messages. The most obvious use of this is to give users a message when they have new private messages.

To do this, open up Themes/default/Common/UserWelcome.ascx in a text editor and find the following line:

<CSControl:UserData runat="server" LinkTo="UserPrivateMessages" ResourceName="PrivateMessage_Unread">
<LeaderTemplate>| </LeaderTemplate></CSControl:UserData>

Replace that with

<CSControl:ConditionalContent runat="server">
    <ContentConditions><ACControl:UserHasUnreadPrivateMessageCondition runat="server"
UseAccessingUser="true" /></ContentConditions>
    <TrueContentTemplate><br /><CSControl:UserData runat="server" LinkTo="UserPrivateMessages"
Text="You have Unread PMs" /></TrueContentTemplate>
    <FalseContentTemplate>| <CSControl:UserData runat="server" LinkTo="UserPrivateMessages"
ResourceName="PrivateMessage_Unread" /></FalseContentTemplate>
</CSControl:ConditionalContent>

And save. Upload the file to your website and when a user has any unread PMs, the top right corner should look similar to the one above. When the user has no unread PMs, it should look how it normally does.

  

Known Issues

Private Message may fail to send if two users register within 15 minutes of each other.
If duplicate posting is disabled on your forum, Community Server may detect the registration as a duplicate post. A workaround for this is to include [username] somewhere in the resource body which will be converted into the user’s username when the private message is sent.
The RegistrationPM module sends a copy of the PM to the sender
There is currently no known workaround for this issue. You may however delete your copy of the private message without deleting the new user’s version.

 

All Versions