Skip to:
Content
Pages
Categories
Search
Top
Bottom

Is there any way to let only topic owner to edit topic tags?

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

  • Robin W
    Moderator

    @robin-w

    you would need to know how to copy a bbpress template, modify it and then load it to your child theme

    so you would need FTP access to your site

    If that sound possible, the come back and I’ll try to help further

    posting this untested code in here just so I don’t lose it !

    <?php
    					$user_id = wp_get_current_user()->ID;
    					$topic_id = bbp_get_topic_id() ;
    					$topic_author = bbp_get_topic_author_id( $topic_id ) ;
    					$is_topic_author = ($topic_author == $user_id ? true : false) ;
    					if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags' ) && $is_topic_author ) : ?>
    

    Sadegh Hosseini
    Participant

    @mr-seven

    Hi and thanks for your quick answer.
    I have child theme and I can copy bbpress theme inside it.
    I’d be thankful if you tell me how can I use these codes.
    Please consider that I want to let Keymaster and topic owner to edit topic tags.


    Robin W
    Moderator

    @robin-w

    ok, so

    create a directory on your childtheme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your childtheme

    find
    wp-content/plugins/bbpress/templates/default/bbpress/form-reply.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/form-reply.php
    bbPress will now use this template instead of the original
    and you can amend this

    so amend this file – copy it to your Pc and use norepad or similar

    around line 70 you will see

    <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags' ) ) : ?>

    replace this with

    <?php
    	$user_id = wp_get_current_user()->ID;
    	$topic_id = bbp_get_topic_id() ;
    	$topic_author = bbp_get_topic_author_id( $topic_id ) ;
    	$is_topic_author = ($topic_author == $user_id ? true : false) ;
    	if ( bbp_allow_topic_tags() && current_user_can('assign_topic_tags' ) && ($is_topic_author || bbp_is_user_keymaster() ) : ?>

    This is untested, and if it doesn’t work – do come back !

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar