Settings¶
Basic settings¶
PYBB_DEFAULT_AUTOSUBSCRIBE¶
Users will be automatically subscribed to topic when create post in it.
Default: True
PYBB_DISABLE_SUBSCRIPTIONS¶
Users won’t be able to subscribe to topic.
If you want to have a more advanced mode than enable / disable (for example, use model permissions),
you just have to overwrite the “may_subscribe_topic” method of the Permission handler.
If you disabled topic subscriptions, already subscribed users will still receive notifications:
see PYBB_DISABLE_NOTIFICATIONS
to stop notifications sending.
Default: False
PYBB_DISABLE_NOTIFICATIONS¶
Users which have subscribed to a topic won’t receive notifications but still be able to subscribe
to topics. See PYBB_DISABLE_NOTIFICATIONS
to disable topic subscription too.
This is usefull if you want to to use your own notification system. Additionally, if your custom
user model has a receive_emails
field, it will be used to determine whether to send notification
emails to each user.
Default: False
PYBB_USE_DJANGO_MAILER¶
When True and django-mailer app installed, then for sending email pybbm will use this app. With django-mailer you can manage emails from your site in queue. But in this case you have to periodically actually send emails from queue. For more information see app home page.
Default: False
Emoticons¶
PYBB_SMILES_PREFIX¶
Prefix for emoticons images set, related to STATIC_URL.
Default: ‘pybb/emoticons’
PYBB_SMILES¶
Dict for emoticon replacement. Key - text to be replaced, value - image name.
Default:
{
'>_<': 'angry.png',
':.(': 'cry.png',
'o_O': 'eyes.png',
'[]_[]': 'geek.png',
'8)': 'glasses.png',
':D': 'lol.png',
':(': 'sad.png',
':O': 'shok.png',
'-_-': 'shy.png',
':)': 'smile.png',
':P': 'tongue.png',
';)': 'wink.png'
}
e.g. text ”;)” in post will be replaced to:
<img src="{{ STATIC_URL }}{{ PYBB_SMILES_PREFIX }}wink.png">
with default setting.
User profile settings¶
Next settings used only if you don’t customize user profile model, user profile creation form or templates.
PYBB_AVATAR_WIDTH¶
Avatar width to use in templates (avatars scaled using sorl.thumbnail if it installed and included in project).
Default: 80
PYBB_AVATAR_HEIGHT¶
Avatar height to use in templates (avatars scaled using sorl.thumbnail if it installed and included in project)
Default: 80
PYBB_DEFAULT_TIME_ZONE¶
Default time zone for forum as integer. E.g. setting to 1 means GMT+1 zone.
Default: 3 (Moscow)
PYBB_DEFAULT_AVATAR_URL¶
Will be used if user doesn’t upload avatar
Default: settings.STATIC_URL + ‘pybb/img/default_avatar.jpg’
Style¶
You can use builtin templates with custom basic template.
PYBB_TEMPLATE_MAIL_TXT¶
Builtin txt emails templates will inherit this template
Default: ‘pybb/mail_templates/base.html
PYBB_TEMPLATE_MAIL_HTML¶
Builtin html emails templates will inherit this template
Default: ‘pybb/mail_templates/base-html.html
Markup engines¶
PYBB_MARKUP¶
Markup engine used in forum. Also see PYBB_MARKUP_ENGINES (deprecated) below
Default: ‘bbcode`
PYBB_MARKUP_ENGINES_PATHS¶
Dict with avaiable markup engines path. One of them should be selected with PYBB_MARKUP
Markup engine should be a path to a class, that inherits from pybb.markup.base.BaseParser. Markup engine should take care of replacing smiles in body with related emoticons.
by default PyBBM support bbcode and markdown markup:
{
'bbcode': 'pybb.markup.bbcode.BBCodeParser',
'markdown': 'pybb.markup.markdown.MarkdownParser'
}
Please note, that previous version of pybb used two different settings : PYBB_MARKUP_ENGINES and PYBB_QUOTE_ENGINES which were callables. This is still supported, but is deprecated.
Post cleaning/validation¶
PYBB_BODY_CLEANERS¶
List of paths to ‘cleaner’ functions for body post to automatically remove undesirable content from posts. Cleaners are user-aware, so you can disable them for some types of users.
Each function in list should accept auth.User instance as first argument and string instance as second, returned value will be sended to next function on list or saved and rendered as post body.
For example this is enabled by default rstrip_str cleaner:
def rstrip_str(user, str):
if user.is_staff:
return str
return '\n'.join([s.rstrip() for s in str.splitlines()])
Default:
PYBB_BODY_CLEANERS = ['pybb.markup.base.rstrip_str', 'pybb.markup.base.filter_blanks']
PYBB_BODY_VALIDATOR¶
Extra form validation for body of post.
Called as:
PYBB_BODY_VALIDATOR(user, body)
at clean_body method of PostForm Here you can do various checks based on user stats. E.g. allow moderators to post links and don’t allow others. By raising:
forms.ValidationError('Here Error Message')
You can show user what is going wrong during validation.
You can use it for example for time limit between posts, preventing URLs, etc.
Default: None
Anonymous/guest posting¶
PYBB_ENABLE_ANONYMOUS_POST¶
Allow post for not-authenticated users.
Default: False
See anonymous posting for details.
PYBB_ANONYMOUS_USERNAME¶
Username for anonymous posts. If no user with this username exists it will be created on first anonymous post.
Default: ‘Anonymous’
PYBB_ANONYMOUS_VIEWS_CACHE_BUFFER¶
Number of anonymous views for each topic, that will be cached. For disabling caching anonymous views just set it to None.
Default: 100
Premoderation¶
PYBB_PREMODERATION¶
Filter for messages that require pre-moderation.
Default: False
See Pre-moderation for details.
Attachments¶
PYBB_ATTACHMENT_UPLOAD_TO¶
Directory in your media path for uploaded attacments.
Default: ‘pybb_upload/attachments’
Polls¶
Note: For disabling polls on your forum, write custom permission handler and return from may_create_poll method False See PYBB_PERMISSION_HANDLER setting.
Permissions¶
PYBB_AUTO_USER_PERMISSIONS¶
Automatically adds add post and add topic permissions to users on user.save().
Default: True
PYBB_PERMISSION_HANDLER¶
If you need custom permissions (for example, private forums based on application-specific user groups), you can set PYBB_PERMISSION_HANDLER to a class which inherits from pybb.permissions.DefaultPermissionHandler (default), and override any of the filter_* and may_* method. For details, look at the source of pybb.permissions.DefaultPermissionHandler. All methods from permission handler (custom or default) can be used in templates as filters, if loaded pybb_tags. In template will be loaded methods which start with ‘may’ or ‘filter’ and with three or two arguments (include ‘self’ argument)
Default: ‘pybb.permissions.DefaultPermissionHandler’
Urls¶
PYBB_NICE_URL¶
Changes old/classics URLs to more semantic URLs using Category/Forum/Topic’s slug. For example www.yourforum.com/forum/1 becomes www.yourforum.com/c/category_slug/forum_slug. Old URLs will have a permanent redirections to new ones.
Default: False
PYBB_NICE_URL_PERMANENT_REDIRECT¶
When PYBB is set to use PYBB_NICE_URL, this setting changes the HTTP response code used to redirect old style URL to new one. True (default) use 301 (permantent) redirect. If set to False, it uses 302 (temporary) redirect. False value is usefull for testing period to not loose SEO related to old URLs, then, once testing period is over, setting this to True will ensure that your old URLs will be updated to the new ones next time the Search Engine will check it.
Default: True
PYBB_NICE_URL_SLUG_DUPLICATE_LIMIT¶
Limit for checking duplicate slugs. After reaching this limit while trying to find unique slug ValidationError will be raised.
Default: 100
PYBB_ENABLE_ADMIN_POST_FORM¶
Enable admin post form that allowed staff to post with any username automagically creating it if it did not exist.
Default: True