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.

moving the 'new discussion' button

edited March 2013 in Vanilla 2.0 - 2.8

Hello,
Please can someone link me to the correct thread for this if there is one.
I am new to vanilla and i am using it to set up a Q&A system for HTML and Wordpress themes. I have successfully managed to move the 'new discussion' button from the sidebar to the main content area but this has made the button become the whole width of the content area. This is an easy fix in itself with CSS. However, I would like to move the 'New Discussions' button to somewhere else on the main content area. I would like it to be placed in the area that includes 'All Discussions' and 'My Discussions'. I have tried to echo the button in this place within the helper_functions.php within the discussions folder but I cant seem to manage to move it.

Is there a bit of code that I am include where ever I want on the page?

I would like to put it in a list with the 'All Discussions' and 'My Discussions' area as seen here from another website using Vanilla.
image

Can someone help or direct me to the right place?

Comments

  • For some reason I can't see what you want to do on the image - maybe a red arrow pointing from where it is to where you want it.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • edited March 2013

    sorry i should have put an arrow in the image.

    Okay, so I've managed to move the add new post button to the main container, not the sidebar. This made the button stretch to the width of the main container which I fixed with css.

    I would like an action to get the new discussions button and place it elsewhere on the main container.

    I have attached a picture of what my page currently looks like.

    I can't remember what file I edited but it changed the button from 'panel' to 'content'. This by default put the button at the top but I would like to place the 'new post' button in the 'Tabs DiscussionsTabs' div.

    Preferably, i would like just an 'echo' script so I can place the button where ever. I'm not too confident with php, I can just about work my way around and I haven't been able to find a solution for this on here or elsewhere.

    I hope this helps

  • It looks like you are using vanilla 2.1 with a table layout. Is this correct?

    IF so, you can simply override the discussions/table view through your theme.

    If you are running 2.0, what plugins are you running?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • I am using version 2.0.18.4 embedded into Wordpress - a fresh installation from here about 2 days ago. I did look for version 2.1 but couldn't find a download link on here

    Plugins - Embed Vanilla and Q&A

  • I have just edited the default vanilla theme for the time being until I get my bearings and edited the css and php files accordingly

  • edited March 2013

    I think I have finally cracked it. after searching every file in the file system for something that represents creating a new post, in the newdiscussion.php file in the modules, the line:

    echo Anchor(T('Start a New Discussion'), '/post/discussion'.(array_key_exists('CategoryID', $Data) ? '/'.$Data['CategoryID'] : ''), 'BigButton NewDiscussion');

    can be pasted into the helper_function.php in the discussions folder. This works works as expected. Thanks for your help guys, sorry to create a new discussion over something as silly as this. I was searching the forum and google for the last two days and wasn't able to find anything. Hopefully the above will help someone!

  • edited March 2013

    @danielhand No don't alter the core the way to move that is in the theme hooks .

    You remove this on every controller

    $this->_AddButton($Sender, 'NewDiscussionModule');
       }
    

    And you add this instead. This will put the new discussion on the menu.

    $Sender->Menu->AddLink('NewDiscussion', Img('themes/PurpleHazeEmbedFriendly/design/images/new.png', array('title' => T('Start New Discussion'))), 'post/discussion',  array('class' => 'Button'));  
    
  • okay thanks for this. Will give this a go!

    Unfortunately, I have just upgraded the forum to 2.1 and now I'm getting Apache Port 80 errors!

    Start again, I think :(

  • 2.1 is still in beta testing use a stable version.

  • edited March 2013

    is there a stable version that lets me enable table view? A couple of websites i've seen that are using Vanilla are in table view instead of lists like 2.0.18 which would suggest thats 2.1 as it lets you enable it in the Dashboard?

    I'm just getting the port 80 issues when trying to enable themes/plugins. I have just noticed that there are a lot of problems with port issues on 2.1

  • The table view is part of the theme. You can completely customize the html structure of a page by overriding the view in a theme.

    You could copy the table views from 2.1 and massage any errors that pop up to work with 2.0. This is probably more effort than you want to do, but it would help you understand the extent of customization of themes.

    Check out the Vanilla Wiki for more info, particularly this page.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • edited March 2013

    massage any errors that pop up to work with 2.0.

    I'm going to massage my errors , will be back in a couple of days ! :)

  • @hgtonight said:
    You could copy the table views from 2.1 and massage any errors that pop up to work with 2.0. This is probably more effort than you want to do

    It is, indeed. First hand experience, I had to create a full theme with a table layout, and it was a nightmare with headaches on the side. I will get a tattoo with written "I hate making themes".

Sign In or Register to comment.