Skip to:
Content
Pages
Categories
Search
Top
Bottom

Delete a notice to all users


  • Gunu
    Participant

    @grafcom

    Hello,

    creating a message for all users works as expected – logged-in users see the message at the top of their screen.

    However, when I go to my account – messages > all member notices I can activate or de-active notices from there, this also works but there is no possibility to delete these messages.

    Using WordPress 4.9.1 and BuddyPress 2.9.2

    Anyone have an idea?

    Thanks

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

  • Gunu
    Participant

    @grafcom

    Update:

    When I look at the code with Firbug I see – inactive:

    <a class="button" href="http://mystite.com/subfolder/members/member-name/messages/notices/delete/3/?_wpnonce=7b9fe1d26c" aria-label="Delete">x</a>

    But this button is not accessible


    Gunu
    Participant

    @grafcom

    Another update.

    I found the “code” link in the following file: plugins/buddypress/bp-templates/bp-legacy/buddypress/members/single/messages/notices-loop.php

    I changed the following code:
    <a class="button" href="<?php bp_message_notice_delete_link(); ?>" class="confirm" aria-label="<?php esc_attr_e( "Delete Message", 'buddypress' ); ?>">x</a>

    In this:
    <a class="button" href="<?php bp_message_notice_delete_link(); ?>" class="confirm" title="<?php esc_attr_e( "Delete Message", "buddypress" ); ?>">x</a>

    Now the “delete message” link is visible, however if I click on it I get an WP error message.

    “Are you sure you want to do this?” – No Yes or No button but a link back to the messages with the text “try it again”


    Gunu
    Participant

    @grafcom

    After a lot of digging here I found this:

    bp_message_notice_delete_link uses wrong action for nonce generation

    I made this change in the source code: fix nonce for sitewide notice deletion.

    Changed in source code from this file /buddypress/bp-templates/bp-legacy/buddypress/members/single/messages/notices-loop.php
    <a class="button" href="<?php bp_message_notice_delete_link(); ?>" class="confirm" aria-label="<?php esc_attr_e( "Delete Message", 'buddypress' ); ?>">x</a>
    in this
    <a class="button" href="<?php bp_message_notice_delete_link(); ?>" class="confirm" title="<?php esc_attr_e( "Delete Message", "buddypress" ); ?>">x</a>

    Now I see the delete button and can delete messages, but this goes wrong again after an update from Buddypress.

    I would like to receive an advice.
    Thanks


    Gunu
    Participant

    @grafcom

    @DJPaul

    any suggestion for this?

    Thanks


    Boone Gorges
    Keymaster

    @boonebgorges

    Applying https://buddypress.trac.wordpress.org/changeset/11750 should fix the problem. Note that this change is in bp-messages/bp-messages-template.php, *not* notices-loop.php. There should be no need to reapply these changes after BuddyPress 3.0, where the fix will become part of the BP release.


    anahimia
    Participant

    @anahimia

    Thanks a lot! That was the solution.
    Regards.

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