“Create Topic” Forum Index
-
Hi,
Is there a way to add the “Create New Topic” button on the forum index page? This could then maybe link to a new topic page.
The page I need help with: [log in to see the link]
-
I guess not!
Apologies, I’m tied up on a paid project, so can only dip in/out.
The short answer is not at the moment, but if you :
1. create a ‘new topic’ page with the shortcode [bbp-topic-form] in the content
2. amend the line
$topic_page = 'http://www.mysite.com/create-new-topic/' ;in the code below to be the link to the page above
function rew_create_new_topica () { $topic_page = 'http://www.mysite.com/create-new-topic/' ; global $bsp_forum_display ; if (!empty ($bsp_forum_display['Create New Topic Description'])) $text=$bsp_forum_display['Create New Topic Description'] ; else $text=__('Create New Topic', 'bbp-style-pack') ; if ( bbp_current_user_can_access_create_topic_form() && !bbp_is_forum_category() ) echo '<div class="bsp-new-topic"> <a href ="'.$topic_page.'">'.$text.'</a></div>' ; } add_action ('bbp_template_before_forums_index' , 'rew_create_new_topica' ) ;and then drop this into your functions file
then this should get you there.
If you don’t know how to add stuff to functions file, come back.
Glad I spent the effort writing this for you.
So sorry, I’m traveling at the moment. I’m going to give this a go and let you know what happens. Probably next weekend. I should be able to implement it 🙂 Thank you.
Greetings,
Thank you for the above information.
I have completed this, however this does not load the new topic page. I have also turn on the Create New topic button in the style Pack.
I can confirm that I have the correct page amended in the supplied text.
if I press the button, it just takes me to the bottom of the screen where the new topic section is. I would like for this to not be here, but rather have the new page for the new topic.
Regards
-
This reply was modified 8 years, 6 months ago by
spadixon.
ok, so lets fix the first problem first
so are you getting the new topic button on the forum index page now?
Thanks mate for the reply.
Yes, I can confirm the button is on the page.
In the settings page, button tab, No 1 is selected. Go to a topic and I can see the button above the topics.
Regards
ok, you keep referring to the button on an individual forum page.
The code I gave you is for a new button that appears on the forum index page. You can forget about anything in settings or the plugin, this is all outside of that.
So on the forum index page you have a button, so where does that go if you click it?
I’ve implemented what you posted and looks like it’s working perfectly. All I need to do is just add some css. Thank you so much Robin and really do appreciate it.
great – glad you are fixed !
Cheers 🙂
Sorry mate, might have got our terms confised
This pic shows that on the home index, there are no buttons
http://picpaste.com/2017-12-05_18_41_36-Microsoft_Edge-MHiIC1qj.png
However in this one in a forum you will see the buttons
http://picpaste.com/2017-12-05_18_42_01-Microsoft_Edge-opN1S072.png
The create new topic button, will then just scroll to the bottom of the page, rather than go to a new page for topic creating.
Cheers
The create new topic button, will then just scroll to the bottom of the page, rather than go to a new page for topic creating.
on the topic page that is what it is supposed to do, and I don’t plan to change that.
can you post the code that you have added to your functions file here please
Ah ok, I was hoping to not have create a new topic shown on the topic page.
Here is the code
function rew_create_new_topica () {
$topic_page = ‘http://localhost/501stcopperheadoutpost/new-topic/’ ;
global $bsp_forum_display ;
if (!empty ($bsp_forum_display[‘Create New Topic Description’])) $text=$bsp_forum_display[‘Create New Topic Description’] ;
else $text=__(‘Create New Topic’, ‘bbp-style-pack’) ;
if ( bbp_current_user_can_access_create_topic_form() && !bbp_is_forum_category() ) echo ‘<div class=”bsp-new-topic”> ‘.$text.’</div>’ ;
}add_action (‘bbp_template_before_forums_index’ , ‘rew_create_new_topica’ ) ;
ok, try this
function rew_create_new_topica () { $topic_page = ‘http://localhost/501stcopperheadoutpost/new-topic/’ ; global $bsp_forum_display ; if (!empty ($bsp_forum_display[‘Create New Topic Description’])) $text=$bsp_forum_display[‘Create New Topic Description’] ; else $text=__(‘Create New Topic’, ‘bbp-style-pack’) ; if ( bbp_current_user_can_access_create_topic_form() ) echo ‘<div class=”bsp-new-topic”> ‘.$text.’</div>’ ; } add_action (‘bbp_template_before_forums_index’ , ‘rew_create_new_topica’ ) ; -
This reply was modified 8 years, 6 months ago by
The topic ‘“Create Topic” Forum Index’ is closed to new replies.