Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Guest Post

1246

Comments

  • Hi, nice add-on I have some thoughts and opinions: - it says permisson error if CAPTCHA test doesn't pass, there should be some 'Please try it again' or 'Please enter the code'. - it is necessary to fill CAPTCHA if I use my login name, it shouldn't be so, because if I am identified, I won't spam :) - prefixing comment body by "<strong>$UserDefined:</strong><br/><br/>" requires Html formatter installed, so I would recommend to use plain text as default, and make this prefix customizable or switchable in admin (not sure how to manage already posted comments, maybe just leave them). - requires creating guest user by user and setting it in default.php (together with CAPTCHAenable/disable setting), but guest user can be created by add-on as an option and the settings can be saved/changed in admin. I'll probably solve the error message issue, maybe others. If so then I'd post diffs here
  • Also there was some question about limiting a non-registered user to only some specific category or list of categories.
    I think this might be solved by using CategoryRoles and by using some new role for the guest user.
  • klip said:Also there was some question about limiting a non-registered user to only some specific category or list of categories.
    I think this might be solved by using CategoryRoles and by using some new role for the guest user.
    Yes, technically that would work. But the Guest Post form would still be added to all categories. Personally, I find that annoying, and potentially confusing for guests. Hence the need to hack the extension and add the "if category" condition.
  • @timfire: ah, you are right
  • So there is also another place to filter categories where we want to display the GuestPost form.
    Now I'm not sure if $CommentGrid is available when default.php is called by core. If you filter it by category id in a delegated function, it is available.

    If you want the guest post form to be displayed on a certain category only, you have to add the CategoryID filter into the condition (on line 33):

    && ($CommentGrid->Discussion->CategoryID == 5)

    where 5 is CategoryID of category you want the guest form to be displayed only at.

    So the code looks like this
    function CommentGrid_ShowGuestPostForm(&$CommentGrid) { if ($CommentGrid->ShowForm == 0 && $CommentGrid->Context->Session->UserID == 0 && ($CommentGrid->pl->PageCount == 1 || $CommentGrid->pl->PageCount == $CommentGrid->CurrentPage) && ((!$CommentGrid->Discussion->Closed && $CommentGrid->Discussion->Active && ($CommentGrid->Discussion->CategoryID == 5))) && $CommentGrid->CommentData ) $CommentGrid->ShowForm = 1; }
    you can add more categories by adding this:

    && (
    ($CommentGrid->Discussion->CategoryID == 5) ||
    ($CommentGrid->Discussion->CategoryID == 6) ||
    ($CommentGrid->Discussion->CategoryID == 7)
    )


    where 5, 6, 7 are ids of categories where it is going to be displayed
  • Thanks Klip, I'm just realising that you're answering to my request, though I don't use myself GuestPost.
    I would have myself tried to use a config table for non PHP techies. Those snippets are not tested (thanks to Klip for the pre-work):
    // among config items // This array contains the discussion ids where you want to show the GuestPost form $Context->PassThruVars['CategoriesForGuestPost'] = array(5,6,7); // instead of Klip's hack //... // was ...($CommentGrid->Discussion->CategoryID == 5)... // now is ...in_array($CommentGrid->Discussion->CategoryID, $Context->PassThruVars['CategoriesForGuestPost'])... //...
    NOTE: We may need $CommentGrid->Context instead of $Context here.
  • @Grahack, nice idea :)

    I just think inarray() should be in_array()
  • that's right, thanks, I edited my draft
  • i did everything and still geting this: Some problems were encountered
    The requested username and password combination could not be found.
    You do not have permission to add comments to discussions.
  • Have you created the guest account and password correctly?

    Posted: Friday, 28 December 2007 at 9:38AM

  • I went to the default.php and add a user name' GuestUsername' use the default name 'Guest' & and 'Guestpassword" change to my own 'passwordhere' I also created a new role call "Guest" and allow this role to add comment and HTML.

    thanks!
  • anyone?
  • Seems to me the guest account USERNAME and PASSWORD that you have entered do not match the ones entered in the default.php file...

    define('GuestUsername', 'Guest'); define('GuestPassword', '12345');

    I just checked with incorrect entries and I got the same error as you, then I corrected the entries and it works again.

    Later: If you are using CAPTCHA, are you sure you entering the correct code?

    Posted: Saturday, 29 December 2007 at 9:01AM

  • Thank you for your quick replay.

    on the Readme, when you state "you will need to set up a guest
    account if you do not already have one" Do i have to to create a new role? for example "Guest" or Register an account, like a regular user? user"Guest" & pass"12345" and put that info on the default.php?
  • No not a new role, simply a new member account called Guest with a password.

    Nobody will actually use this account directly, the GuestPost add-on will do all the work of signing in unregistered visitors using this account, that's why it needs the username/account details.

    Posted: Saturday, 29 December 2007 at 10:07AM

  • Wanderer

    Thank you for your help. I was using the new role option. Is working flawless now.
  • Does anyone have a way not just to do guest comments, but also to allow Guest to create New Discussions?
  • I'm not sure you want to allow this mate, before I installed Guest Post it was cool for a while, then the SPAMMERS got hold of my forum and they went wild adding spam content.

    Now with Guest Post I get an attempt maybe once every 2 months but my members jump on it quickly, notifying me and it gets deleted, they soon give up, it's too much trouble for them.

    Besides, you want people to register don't you? Dangling the "new discussion" carrot is a good way to do it.
  • Letting guests post new discussions also has an technical issue---the DiscussionForm does a UserID check and spits out a fatal error is the user is a guest. This means you would have to either modify the core DiscussionForm class, or you would have to write some sort of alternate posting class for guests.

    Obvious it can be done, but it makes things more complicated.
  • That's exactly why I've never bothered doing it :)
Sign In or Register to comment.