• Resolved Chuckie

    (@ajtruckle)


    I asked about this before, but I have just stumbled on the [bbp-topic-form] shortcode!

    It does exactly what I want! It shows the new topic form and includes a drop-down list of forums.

    So I have created new page on my website.

    My issue is (and I am using the bbp style pack theme):

    1. I need to add a Create New Topic button on the main forum index page (same look and feel as the Search button.

    2. This button should only be visible on the forum index page when the user is logged in and is not blocked.

    I just need a button or hyperlink styles like a button that when clicked goes to my new-topic page.

    Please advise. Thanks.

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter Chuckie

    (@ajtruckle)

    At the moment I get a nice “Create new topic” button when I am on an actual forum page.

    I now need this same button at the top of the main forums index page that is linked to my new “new-topic” page. I even see this as a excellent tweak to bbp style pack.

    Thread Starter Chuckie

    (@ajtruckle)

    As an attempt to solve this myself I have create a basic widget that links to the page. It you look at my side bar you will see it.

    I think it will do. Ideally this widget should only show if the user is logged in but I don’t know how to do that with the widget I have.

    Plugin Author Robin W

    (@robin-w)

    if you add the ‘widget logic’ plugin, you can control when widgets display

    https://ww.wp.xz.cn/plugins/widget-logic/

    otherwise paste the code for your widget, and I’ll add the logic

    Thread Starter Chuckie

    (@ajtruckle)

    Thanks. It is a “Custom HTML” widget at the moment:

    <ul class="ts-downloads-widget">
    	<li>[fas-plus-circle] <a href="https://www.publictalksoftware.co.uk/new-topic/">Create New Topic</a></li></ul>

    I would like to avoid installing the plugin if poss.

    • This reply was modified 6 years, 3 months ago by Chuckie.
    • This reply was modified 6 years, 3 months ago by Chuckie.
    • This reply was modified 6 years, 3 months ago by Chuckie.
    Plugin Author Robin W

    (@robin-w)

    it’s not possible to run php code in the standard widgets, so logic or a pho widget such as

    https://ww.wp.xz.cn/plugins/php-code-widget/

    is needed

    Thread Starter Chuckie

    (@ajtruckle)

    Ok, I have installed “Widget Logic” to test this on my staging site. What logic do we need here?

    Thanks.

    Thread Starter Chuckie

    (@ajtruckle)

    I assume it is similar to what you suggested in bbPress forum for user statistics.

    Something like:

    is_user_logged_in() && is_bbpress() && current_user_can( 'spectate' )

    But I am not exactly sure of the complete content I should input into that logic box.

    Plugin Author Robin W

    (@robin-w)

    that should work, it’s a while since I’ve used that plugin, so you’ll need to have aplay and see what works

    Thread Starter Chuckie

    (@ajtruckle)

    If I use the is_user_logged_in() bit it works. But the moment I extend it:

    return (is_user_logged_in() && is_bbpress());

    It doesn’t work.

    Plugin Author Robin W

    (@robin-w)

    just

    is_user_logged_in() && is_bbpress())

    • This reply was modified 6 years, 3 months ago by Robin W.
    Thread Starter Chuckie

    (@ajtruckle)

    Seems missmatch in the ( ) characters there?

    It does not like using is_bbpress()

    • This reply was modified 6 years, 3 months ago by Chuckie.
    Thread Starter Chuckie

    (@ajtruckle)

    I will stick with is_user_logged_in. It is sufficient.

    Thank you.

    Thread Starter Chuckie

    (@ajtruckle)

    Just occurred to me. What exactly is is_bbpress() checking for?

    Thread Starter Chuckie

    (@ajtruckle)

    That is why:

    http://hookr.io/functions/is_bbpress/

    This limits to bbPress pages. Don’t want that limit.

    That why I did not see widget on homepage.

    No need to test for blocked as I assume blocked not allow to create topic.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Adding Create New Topic button’ is closed to new replies.