Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • @acustica

    Member

    @guigoz
    I’m very glad my solution was helpful for you! and your welcome

    @acustica

    Member

    @Ahjira @stevenkword
    As Suzanne mentioned, the `bp_message_thread_delete_link()` functions are only for the message index. On single message pages, the `$thread_template` global is used in place of the `$messages_template` global, and the usable template tags all begin with `bp_the_thread_` instead of `bp_message_thread_`. While there is no `bp_the_thread_delete_link()` function, it’s pretty easy to just directly add the code from the `bp_get_message_thread_delete_link()` function with appropriate substitutions.

    First, at the top of the members/single/messages/single.php template file, add this line:

    Then, wherever you want to add a delete link, add something like the following:
    `<a href="loggedin_user->domain . $bp->messages->slug . ‘/inbox/delete/’ . $thread_template->thread->thread_id, ‘messages_delete_thread’ ) ); ?>” title=”Delete this message” class=”button”>Delete`

    the “ code block above contains the adapted version of the `bp_message_thread_delete_link()` function.

    @acustica

    Member

    I was having this same problem and posted a lengthy comment about it in the trac ticket mentioned above ( https://trac.buddypress.org/ticket/2647 ), but in the meantime, I developed a workaround that works on my site and doesn’t require modifying any core files (and will fix the problem in any BP component, not just with friend request emails).

    Just add the following function (a filter) to your theme’s functions.php file:
    `
    /**
    * Intercept bp_core_catch_no_access() when nothing is set to enable smart login page redirects
    * and prevent BP from just redirecting the user to the homepage
    *
    * @param string $found_template The result of locate_template() call
    * @param mixed $templates Not sure what it’s for, but it’s generally bool false
    */
    function yourtheme_load_template_filter( $found_template, $templates ) {
    if ( ! $templates && empty( $found_template ) ) {
    // just set it as default theme file so that file_exists() returns true
    $found_template = get_stylesheet_directory() . ‘/index.php’;
    }
    return $found_template;
    }
    add_filter( ‘bp_located_template’, ‘yourtheme_load_template_filter’, 11, 2 );
    `

    It’s not a good permanent solution, but I haven’t noticed it affecting anything else (including BP 404s) on my site, and it leaves your BP install happily untouched. If the issue is fixed in the future, of course, I would highly recommend removing this fix, but as far as I can tell, it’s harmless, and certainly makes your site far more usable.

Viewing 3 replies - 1 through 3 (of 3 total)
Skip to toolbar