Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Proper way to add code to a post

ZeaksZeaks New
edited March 2011 in Vanilla 2.0 - 2.8
I've searched these forums and have tried different ways to add code to a post such as using < code > tags like on here, but haven't figured it out. My sites have are based around questions that involve posting either php or css code sometimes js.
Most code displays ok by default, but some of it becomes hyperlinked. Is there a proper way to add code to a post?


  • Use < pre >< code > instead of just < code > and tell me if that makes a difference.
  • No, the <pre and <code tags display in the post like normal text
  • ddumontddumont ✭✭
    edited March 2011
    I think during the migration they forgot to install the syntax plugin.

    usually it's a pre tag with a lang attribute

    There was an error rendering this rich post.

  • ZeaksZeaks New
    edited March 2011
    hmm, actually, that works on one site, but not the other. Must be a something causing it to act up. I'll check the plugins and forum version. Thanks
  • dudieboydudieboy New
    edited March 2011
    Check your theme's CSS for .pre and .code styling. My forums are formatting code okay using the defaultsmarty theme, as seen here:
  • ZeaksZeaks New
    edited March 2011
    Yeah, that's how one site displays it, I'll look into the css for those classes. BTW, should I of been able to edit that post you linked? I was able to, I removed the "." on the last line just to see if I could, because the link came up to an edit post page....actually, im able to edit any post
  • The first time I did copy the wrong URL, but I changed it now. You were able to edit the post, without being a member of my site? If so that's a serious security leak. O_o
  • I logged in using my Twitter ID, I have the option to edit any post, even ones made by admins and mobs. Might be a permission setting?
  • Confirmed. Did you give members ( my role ) access to edit other ppls posts?

    That's a great plugin

    There was an error rendering this rich post.

  • Okay yeah, my permissions have been a little messed up since I imported Simple:Press data. I'll look into it, thanks for the warning.
  • ZeaksZeaks New
    edited March 2011
    I didn't do anything, just noticed the link and tested it by removing the period at the end of a line. figured you should know.

    As for the pre and code classes. It's not theme related, seems to be doing it with any theme, even the default. I've disabled plugins, but didn't help. I'll check the vanilla version.
  • Role permissions really need better definitions somewhere on this site. :\ Under Default Category Permissions I had given Members Add Edit Sink View access to comments and discussions thinking they would be able to edit their own posts. I didn't realize that would give them access to edit ANY post.
  • Good thing you caught it, you have a decent amount of posts on there :P
  • @Zeaks yeah, thanks for the heads up. Would you mind going back and see if you have the proper permissions now?
  • I only see the sink option now (not really sure what that does)
  • Yeah, me neither. ;) Thanks!
  • It makes it so that new posts do not bump the thread. Members should not have that.

    There was an error rendering this rich post.

Sign In or Register to comment.