Making WordPress.org


Ignore:
Timestamp:
11/20/2018 06:10:25 AM (5 years ago)
Author:
dd32
Message:

Support Forums: Replace the forum Create Topic button with a 'Login to Create a Topic' button when logged out.

Fixes #3934.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

    r7854 r7875  
    243243    public function new_topic_link() {
    244244        if ( bbp_is_single_forum() ) {
    245             printf( '<a class="button create-topic" href="#new-topic-0">%s</a>', __( 'Create Topic', 'wporg-forums' ) );
     245            if ( bbp_current_user_can_access_create_topic_form() ) {
     246                printf(
     247                    '<a class="button create-topic" href="#new-topic-0">%s</a>',
     248                    __( 'Create Topic', 'wporg-forums' )
     249                );
     250            } elseif ( ! bbp_is_forum_closed() && ! is_user_logged_in() ) {
     251                printf(
     252                    '<a class="button create-topic login" href="%s">%s</a>',
     253                    wp_login_url(),
     254                    __( 'Login to Create a Topic', 'wporg-forums' )
     255                );
     256            }
     257
    246258            remove_filter( 'bbp_template_before_pagination_loop', array( $this, 'new_topic_link' ) );
    247259        }
Note: See TracChangeset for help on using the changeset viewer.