Skip to:
Content
Pages
Categories
Search
Top
Bottom

User capabilities : delete topics


  • martineva
    Participant

    @martineva

    Hello there !
    I’ve been on troubble since a few days, just trying to let my forum users to delete their own topics.

    I tried several plugins, on WordPress, but it seems that even if I create a new role and custom it with the “delete topic” option, it won’t be memorized, maybe due to php bbpress capabilities ?? Anyway those plugins seem to create only WordPress roles, not bbpress roles. So even if there is “forum options” set, maybe it’s not the good way to do it properly.

    Then I’ve been reading this : https://codex.bbpress.org/custom-capabilities/, and I was able to set a new role, but still, even if the 'delete_topics' => true," is set, the users can’t see anything like a delete button on the front end (same with the “delete replies” option, BTW).

    Following this other thread https://bbpress.org/forums/topic/bbpress-custom-user-role/ I created a separated php file, but once again I could see no effect, worse : I got 404 pages instead of my website pages.

    I must say it’s my first forum, and I’m not a good coder, so if anybody could help me to get this solved, it would be very, very nice !

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

  • manueldo
    Participant

    @manueldo

    Hi martineva! I am in the same situation and have the same problem, and tried the same as you without results.
    The only way I could “solve” it, was modifying the capabilities for the default particpant role in the core of the plugin.
    In the Primary caps I had to set moderate=true and then blocked all things that I don´t want the user do in the other options. Anyway I had to hardcode some other parts of the plugin because it inherits some moderator capabilities, eg. this user will be able to stick a topic.

    I know this is not the way to solve it but it is the only way I found. And like you, this is my first forum, and I am not a developer.

    I hope we could find other way soon!
    ps.) Sorry for my english, isn´t the best.


    Pascal Casier
    Moderator

    @casiepa

    Hi,
    It’s unfortunately a known issue in current version:
    https://bbpress.trac.wordpress.org/ticket/2685

    Hopefully fixed in next upcoming release.

    Pascal.


    martineva
    Participant

    @martineva

    @manueldo : I tried to modify the participant role, but didn’t tried to set it with moderate=true trick … I’m going to try it as soon as posible, cause it sounds definietely interesting. Could you please telle me more about the others modifications you had to do ? Thx

    @casiepa
    : thank you for telling me I’m maybe not as dumb as I thought … I was going crazy, thinking I was doing something wrong… So let’s do as you say : waiting for the next release 🙂


    martineva
    Participant

    @martineva

    feedback for manueldo : your core customization worked well, I just have the same problem as you said : the user is able to set the topic as sticky. Could you please say me where you did the modification ’bout that ?? Anyway, thank you very very much 🙂


    manueldo
    Participant

    @manueldo

    Good @martineva, but think that with an update this changes will disappear!
    To delete tha “stick” option I modified two files, the form for a new topic and the template for the topics.

    1) The form (this depend on your theme, for mine was here): themes/YOUR.THEME/bbpress/form-topic.php, line 130 aprox. I commented the html part where the form show the sticky drop down list <!–<p><label for=”bbp_stick_topic”><?php _e( ‘Topic Type:’, ‘bbpress’ ); ?></label><br />

    2) Topic templates: content/plugins/bbpress/includes/topics/template.php, line 2421 aprox. I commented the php for stick and for merge.
    //’stick’ => bbp_get_topic_stick_link( $r ),
    //’merge’ => bbp_get_topic_merge_link( $r ),

    When you update your theme, 1) will be stop working and you will have to do it again.
    When you update bbpress, 2) will be stop working and you will have to do it again.
    But for now, this is the only option I found.


    martineva
    Participant

    @martineva

    totally agree with the update issue, but until the bug is fixed, it will perfectly fit what I needed ! Thanks again 🙂


    martineva
    Participant

    @martineva

    hum ? I think I did correctly the modifications, but the standard user were not allowed anymore to create a new topic.
    I usually have a button to create a new topic, or, if you go a th bottom of the page, the new topic form. With the modifications activated, this form wasn’t showing anymore.

    Anyway, don’t bother too much with this, deleting the topics is working, that’s the most important 🙂


    manueldo
    Participant

    @manueldo

    @martineva, the error was mine, I copied wrong the second part.

    The original is:
    <p>
    <label for=”bbp_stick_topic”> <?php _e( ‘Topic Type:’, ‘bbpress’ ); ?>
    </label><br /><?php bbp_form_topic_type_dropdown(); ?>
    </p>

    And you have to comment all that part, so add (without “) “<!–” before <p> and add (without “) “–>” after the </p>.

    The correct final has to be:

    <!–<p>
    <label for=”bbp_stick_topic”> <?php _e( ‘Topic Type:’, ‘bbpress’ ); ?>
    </label><br /><?php bbp_form_topic_type_dropdown(); ?>
    </p>–>
    This way the dropdown list for stickying will not be showed.

    I hope this help!


    martineva
    Participant

    @martineva

    Hey, wonderful; no more sticking or merge button ! But I just discovered the delete topic function is also available in topics the user had not created himself … Where could I did something wrong ??? in the core capabilities php, the participant topic caps ‘edit others topics’ and ‘delete others topics’ are both set as “false” …
    My bbpress/includes/topics.capabilities.php file has been inchanged since the beginning … is there something to custom here as well ?

    thank you


    Robkk
    Moderator

    @robkk

    I think you guys can just hot-patch the issue until the bug is fixed in core and so you guys do not mess with any other core code to cause any other possible issues.

    https://bbpress.trac.wordpress.org/changeset/5852


    manueldo
    Participant

    @manueldo

    @martineva, the buttons delete and edit are shown but when you click it doesn´t work it is not your topic.
    Thanks @robkk, I will try what you are suggesting.


    martineva
    Participant

    @martineva

    Ewww … still no new-topic form is shown …
    I don’t understand : I erased the previous modifications in order to try you patch, Robkk, but even with the basic files re-abled (not patched yet), the new topic form is still mising … even for the keymaster ! It just vanished. help ???


    manueldo
    Participant

    @manueldo

    @robkk GREAT! your suggestions worked very well!


    @martineva
    , Don´t you forget to modified again (back to original) the theme? themes/YOUR.THEME/bbpress/form-topic.php, where you commented the “stick” option? I think your error could be in this file. Maybe just a , or }? Don´t you have the original to check?


    martineva
    Participant

    @martineva

    I finally re-installed bbpress, to be sure 🙂 Went back to the previous configuration, where users can create new topics, but can’t delete them.
    Now I have to try the patch … If it worked for you, I hope I will succeed do do it as well !


    manueldo
    Participant

    @manueldo

    haha, that never fails! And you will only have to modify the topics/capabilities and replies/capabilities, forget all other changes because aren´t necessary.

    Have a good time!


    Robkk
    Moderator

    @robkk

    I tested out the patch and it works pretty well for a custom user role I created. I just used the tutor role mentioned in this guide https://codex.bbpress.org/custom-capabilities/ and it worked when I created and switched to that test user.

    Make sure to not touch the core plugin files again. This was a simple thing to do which is not bad, but something else might cause further conflicts.


    martineva
    Participant

    @martineva

    Yay ! works well, thank you both for helping sooo much 🙂

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