Skip to content
  1. Extras
  2. easyComm
  3. Snippets

easyComm snippets

ecForm

Snippet that outputs the form for adding a new message.

It can be called cached, because it only outputs the form HTML and creates the thread. On first call it creates a new message thread (ecThread) for the current resource. On every call it saves all snippet parameters to the ecThread.properties field as JSON.

ecForm parameters

ParameterDefaultDescription
threadresource-[[*id]]Message thread name. Must be unique.
formIdsame as threadUsed on the frontend to identify the form when there are multiple forms on the page.
allowedFieldsuser_name, user_email, user_contacts, subject, rating, textComma-separated list of fields allowed in the form.
requiredFieldsuser_name, textComma-separated list of required fields.
antispamFieldaddressField used as antispam. Must be hidden with CSS so users do not fill it; bots will.
autoPublish0Auto-publish. Empty = off, "OnlyLogged" = publish if user is logged in, "All" = publish for all.
agreementCheckbox1Show "I consent to processing of my personal data" checkbox.
tplFormtpl.ecFormForm chunk
tplFormReCaptchatpl.ecForm.ReCaptchaReCaptcha chunk
tplSuccesstpl.ecForm.SuccessChunk shown after successful submit. All fields of the created ecMessage are available.
starsThemedefaultStar rating theme: default, stars2, stars3, hearts. You can add your own in ec.css.
mailManagerAdmin email for notifications; overrides ec_mail_manager. Use for different addresses per ecForm call.
newEmailSubjUserSubject of "message received" email to user; overrides ec_mail_new_subject_user
tplNewEmailUsertpl.ecForm.New.Email.UserChunk for that email. If empty, email is not sent.
newEmailSubjManagerSubject of new-message email to manager; overrides ec_mail_new_subject_manager
tplNewEmailManagertpl.ecForm.New.Email.ManagerChunk for that email. If empty, email is not sent.
updateEmailSubjUserSubject of "message published/replied" email to user; overrides ec_mail_update_subject_user
tplUpdateEmailUsertpl.ecForm.Update.Email.UserChunk for that email. If empty, email is not sent.

File attachments

From 1.11.0-pl users can attach files to messages.

This is an extra feature, not a full file storage. Example: photos in product reviews.

ecForm parameters for files:

ParameterDefaultDescription
files0Enable file upload.
fileTypesjpg,jpeg,png,gif,webpAllowed file types.
fileSize0Max size per file in bytes. Default 0 = no limit (not recommended).
filesCount0Max number of files. Default 0 = no limit (not recommended).

Dependencies

Внимание

Before 1.11.4-pl the form required jQuery and jquery.form on the page. Otherwise you see "Can't find jQuery ajaxForm plugin!".

ecMessages

Snippet that outputs messages from a thread. Must be called uncached, because site cache is not cleared when messages are published in the manager.

ecMessages parameters

ParameterDefaultDescription
threadresource-[[*id]]Thread name.
threadsComma-separated list of threads to output from (e.g. "resource-1,resource-2"). Use * for all. Overrides thread.
votingEnable0Enable message voting. Default off.
votingAllowGuest0Allow guests to vote. Default: only logged-in users.
votingConsiderIP0For guests, check by IP. Default uses PHP session. Enable if you see vote manipulation. One vote per message per IP.
messagesSpecific message IDs to output.
subjectFilter by subject.
tpltpl.ecMessages.RowChunk for one message. Message fields and thread fields (prefix thread_) are available. Use resourceFields to add resource fields.
tplWrapperWrapper chunk. Use placeholder [[+output]]. For a single thread, all thread fields and formatted ratings [[+rating_wilson_percent]], [[+rating_simple_percent]] are available.
tplEmptyChunk when there are no messages.
starsThemedefaultStar theme: default, stars2, stars3, hearts.
sortbydateSort field
sortdirDESCSort direction
limit10Max number of messages
showUnpublished0Include unpublished messages
showDeleted0Include deleted messages
resourceFieldsAdd resource fields (prefix resource_), e.g. id,pagetitle,longtitle,introtext. id and pagetitle are added by default.
outputSeparator\nSeparator between message outputs
toPlaceholderSave result to a placeholder instead of outputting
toSeparatePlaceholdersSet a placeholder per message
showLog0Show log

ecMessagesCount

Outputs the count of messages in a thread (or threads). Must be called uncached.

ecMessagesCount parameters

ParameterDefaultDescription
threadresource-[[*id]]Thread name.
threadsComma-separated list of threads. * for all. Overrides thread.
subjectFilter by subject.
showUnpublished0Include unpublished
showDeleted0Include deleted

ecThreadRating

Outputs the rating of a thread. Must be called uncached. From 1.5.1-pl the default chunk includes schema.org AggregateRating microdata.

Parameters

ParameterDefaultDescription
threadresource-[[*id]]Thread name.
tpltpl.ecThreadRatingChunk for rating. Placeholders: rating_simple, rating_simple_percent, rating_wilson, rating_wilson_percent, and all ecThread fields.
algorithmwilsonAlgorithm: wilson or simple.
starsThemedefaultStar theme: default, stars2, stars3, hearts.
starWidthAndGup16,4Width and gap for filled stars. For default theme 16,4; for others 20,4.
toPlaceholderIf set, result is put in a placeholder with this name.

Detailed rating

From easyComm 1.7.0 ecThreadRating can show detailed vote info.

Detailed rating display

Use chunk tpl.ecThreadDetailedRating in parameter tpl.