Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter
Support for Vanilla Forums Cloud product

In this Discussion

Follow Us


DefaultFormatter

edited March 2008 in Questions
This discussion is related to the DefaultFormatter addon.
DefaultFormatter

Comments

  • Maybe I should have named it ForceFormatter...
  • when you've got something like include($Configuration['SomePath'] . 'someFile.php'); and that $Configuration['SomePath'] is set in an other file, you should add at the top of the file:if (!defined('IN_VANILLA')) exit(); or you extension will be vulnerable when register_globals is on.
  • ok thanks, I'll update this ASAP
  • Uploaded version 0.0.2 of DefaultFormatter.
  • Hey! This is a total godsend. I had no idea how to override the default BBCode formatting. Just one question, probably a dumb one... where do I go to set the default formatter?
  • There is a settings.php file (or I hope so!) in the distribution.

    By the way, I have a problem: I don't know (yet) how to hide an item in the preference form of the account.php page.
    So whether users will choose to display the selector, his/her choice will be overriden.

    I'll try to overrive the AddPreference function of the PreferencesForm class...
  • Hi folks,

    Would there be a way to set different default formatters for different roles? I'm looking for a way to force BBCode for everyone, except for administrators who could choose between BBCode and HTML.
  • and a frontend when you get around to it :-P
  • Uploaded version 0.1.0 of DefaultFormatter.
  • 0.1.0 is roles based: no more settings.php, edit your roles.
    You should find
    • Can format the comments with any formatter
    • Can see the formatter selector
    • Will see the ??? formatter pre-selected
    in the permissions list.
  • sweet EDIT: with DefaultFormatter, it preselects bbcode for me, even though none of the "automatically select _______" are checked in the roles page, and I have the "can see the formatter selector", and "can format the comments with any formatter" checked for admin role.I didn't have any of the previous versions installed.
  • It must be your prefs. As we decided by email, we should rename
    Can format the comments with any formatter
    to
    Ignore DefaultFormatter extension for this role, and those few related settings below
    Because it's simply what this check box does.
    Gonna wait a bit for other glitches before the change (and maybe a better idea to replace Can format the comments with any formatter).
  • I get the following error messages at the top of my forum after adding DefaultFormatter:

    Notice: Undefined index: PERMISSION_FORMATTERS_ALL in /home/robom3/public_html/forum/extensions/DefaultFormatter/default.php on line 46

    Notice: Undefined index: PERMISSION_FORMATTERS_Text in /home/robom3/public_html/forum/extensions/DefaultFormatter/default.php on line 51

    Notice: Undefined index: PERMISSION_FORMATTERS_Text in /home/robom3/public_html/forum/extensions/DefaultFormatter/default.php on line 51

    Notice: Undefined index: PERMISSION_FORMATTERS_Html in /home/robom3/public_html/forum/extensions/DefaultFormatter/default.php on line 51

    Notice: Undefined index: PERMISSION_FORMATTERS_SHOW in /home/robom3/public_html/forum/extensions/DefaultFormatter/default.php on line 64



    I'm really not good with a lot of code. Is there something I need to fix?
  • Never mind, I figured it out. Solution was in a line of the readme that I missed.
  • Anyway this will occur if the 'Add your comments' textarea is displayed to guests (as in Guest Post). I must find a way to solve it.
    But what line were you missing? I don't quite understand...
  • I got the same until I made a selection in 'Roles & Permissions'. However I'm still getting it for guest users, even though they can't see the 'Add your comments' textarea. One oddity. If I disable this extension I'm left with these in the 'Roles & Permissions' list: # PERMISSION_FORMATTERS_ALL # PERMISSION_FORMATTERS_SHOW # PERMISSION_FORMATTERS_Text # PERMISSION_FORMATTERS_Markdown Although whether or not they're checked seems to make no difference. (As you can see, I have the Markdown extension installed but it's the same when that's disabled.)
  • yes, if you enable an extension that adds a permission, theres almost no possible way to get rid of it. they don't do anything once the extension is disabled.
  • With a bit of Googling I found a fix for the error messages showing for guests, by adding this line to default.php: error_reporting(5);
  • I added that to my file, and the errors still appear for guests. Does it have to be added to a specific place in the code? Am I missing something?
  • Sorry, I was quite busy these days. I'm gonna try to find something smart to deal with guests.
    Like the first version, I'm gonna add few lines of conf at the top of the default.php file, just for the guests.

    Something better to suggest ?
  • "I added that to my file, and the errors still appear for guests. Does it have to be added to a specific place in the code? Am I missing something?"

    Sorry, haven't been back here for a while.

    I added it at the top of default.php, after

    <?php
    /*...
    ...*/</b>

    and before

    if (!defined('IN_VANILLA')) exit();


    "Something better to suggest ?"

    My suggestion works for me (although, of course, it's hiding the error messages rather than fixing the error).
  • you just need to add

    && $Context->Session->UserID > 0

    to the if condition in line 44 to exclude guests of the permissions mesh
  • after adding that, i get this error: Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/xx/public_html/messageboard/extensions/DefaultFormatter/default.php on line 44
  • ... although also adding error_reporting(5); makes all errors go away.
  • SheilaSheila ✭✭
    Hi!

    Very good add-on, makes things easier and more simple for end users. Noticed that when this add-on is installed, in user profiles option for formatter is still visible and might be confusing. So I commented that out from the source but guess it would be better if DefaultFormatter would do it somehow automatically.

    Meanwhile if somebody is willing to do what I did (and don't blame me if it breaks something ;) ), formatter-line to comment out is in Vanilla.Control.Preferences.Form.php
  • Hello, I am using Vainilla 1.1.8 and I had some errors: not defined PERMISSION_FORMATTERS_ALL ... I just changed each condition: if (!$Context->Session->User->Permissions['PERMISSION_FORMATTERS_ALL'] ) adding isset function if ( isset($Context->Session->User->Permissions['PERMISSION_FORMATTERS_ALL']) && ! $Context->Session->User->Permissions['PERMISSION_FORMATTERS_ALL'] ) And it works perfectly... I dont know if this apply to other versions, It would be nice to update the code. Best, Yo
  • EDIT: Found it!
  • The version (0.1.0) I downloaded on 2010-03-11 worked just fine (locally) with Vanilla 1.1.10...
Sign In or Register to comment.