質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

Q&A

0回答

511閲覧

有名プラグイン「Buddypress」の通知バグについて

退会済みユーザー

退会済みユーザー

総合スコア0

WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

0グッド

0クリップ

投稿2018/08/09 22:56

編集2018/08/10 04:45

お世話になります。
PHPに相当詳しくないと難しいかと思いますが…、

###バグの内容

★概要
「コメントされた」という通知はあっても、「コメントに返信された」という通知がない。

同様の報告

https://bbpress.org/forums/topic/notification-when-reply-in-topic-receives-reply/

★詳細
WordPressの有名プラグイン「BBPress」で掲示板を作り、
「BuddyPress」から通知を受け取っています。

私が作った掲示板にAさんがコメントすると、
「Aさんにコメントされた」
と私に通知があります。

これはいいのですが、
しかし、

Aさんのコメントに誰かが返信しても、
「誰かに返信された」
とAさんに通知が来ないのです。

###試したコード
functions.phpに下記で未解決

php

1/* notifications */ 2 3function jpr_buddypress_add_notification( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $author_id = 0, $is_edit = false, $reply_to = 0 ) { 4 5 $current_topic_id = bbp_get_topic_id(); 6 $ids_of_subs = bbp_get_topic_subscribers($current_topic_id); 7 8 // this is who the notification goes to. whose post is replied to 9 $topic_author_id = bbp_get_topic_author_id( $reply_to ); 10 11 // Bail if somehow this is hooked to an edit action 12 if ( !empty( $is_edit ) ) { 13 return; 14 } 15 16 // Get author information 17 // $topic_author_id = bp_loggedin_user_id(); 18 $secondary_item_id = $author_id; 19 20 // Hierarchical replies 21 if ( !empty( $reply_to ) ) { 22 $reply_to_item_id = bbp_get_topic_author_id( $reply_to ); 23 } 24 25 // pass the $reply_id to the function that formats the notification 26 $topic_id = $reply_to; 27 28 // Get some reply information 29 $args = array( 30 'user_id' => $topic_author_id, 31 'item_id' => $topic_id, 32 'component_name' => bbp_get_component_name(), 33 'component_action' => 'bbp_new_reply', 34 'date_notified' => get_post( $reply_id )->post_date_gmt, 35 ); 36 37 // Notify the topic author if not the current reply author 38 if ( $author_id !== $topic_author_id ) { 39 $args['secondary_item_id'] = $secondary_item_id ; 40 41 bp_notifications_add_notification( $args ); 42 } 43 // Notify the immediate reply author if not the current reply author 44 if ( !empty( $reply_to ) && ( $author_id !== $reply_to_item_id ) ) { 45 $args['secondary_item_id'] = $secondary_item_id; 46 47 bp_notifications_add_notification( $args ); 48 } 49} 50// remove the bbpress notification function so we don't get dupicate notifications 51remove_action( 'bbp_new_reply', 'bbp_buddypress_add_notification', 10, 7 ); 52add_action( 'bbp_new_reply', 'jpr_buddypress_add_notification', 10, 7 ); 53 54// remove the bbpress format notification function before using our custom function 55remove_filter( 'bp_notifications_get_notifications_for_user', 'bbp_format_buddypress_notifications', 10, 5 ); 56 57function jpr_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { 58 59 // New reply notifications 60 if ( 'bbp_new_reply' === $action ) { 61 $topic_id = bbp_get_reply_id( $item_id ); 62 $topic_title = bbp_get_reply_title( $item_id ); 63 $topic_link = wp_nonce_url( add_query_arg( array( 'action' => 'bbp_mark_read', 'topic_id' => $topic_id ), bbp_get_reply_url( $item_id ) ), 'bbp_mark_topic_' . $topic_id ); 64 $title_attr = __( 'Topic Replies', 'bbpress' ); 65 66 if ( (int) $total_items > 1 ) { 67 $text = sprintf( __( 'You have %d new replies', 'bbpress' ), (int) $total_items ); 68 $filter = 'bbp_multiple_new_subscription_notification'; 69 } else { 70 if ( !empty( $secondary_item_id ) ) { 71 $text = sprintf( __( 'You have %d new reply to %2$s from %3$s', 'bbpress' ), (int) $total_items, $topic_title, bp_core_get_user_displayname( $secondary_item_id ) ); 72 } else { 73 $text = sprintf( __( 'You have %d new reply to %s', 'bbpress' ), (int) $total_items, $topic_title ); 74 } 75 $filter = 'bbp_single_new_subscription_notification'; 76 } 77 78 // WordPress Toolbar 79 if ( 'string' === $format ) { 80 $return = apply_filters( $filter, '<a href="' . esc_url( $topic_link ) . '" title="' . esc_attr( $title_attr ) . '">' . esc_html( $text ) . '</a>', (int) $total_items, $text, $topic_link ); 81 82 // Deprecated BuddyBar 83 } else { 84 $return = apply_filters( $filter, array( 85 'text' => $text, 86 'link' => $topic_link 87 ), $topic_link, (int) $total_items, $text, $topic_title ); 88 } 89 90 do_action( 'jpr_format_buddypress_notifications', $action, $item_id, $secondary_item_id, $total_items ); 91 92 return $return; 93 } 94} 95add_filter( 'bp_notifications_get_notifications_for_user', 'jpr_format_buddypress_notifications', 10, 5 );

###環境
WordPress最新、インストール直後で、プラグインは上の2つしか入れていない状態です。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

terrace

2018/08/10 00:36

原因を知りたいのか、対応方法を知りたいのか、どうして欲しいのかがわからないのですが… 既にBuddypressのバグであると断じていらっしゃるので、公式フォーラムとかバグレポートを利用した方が良いかと思います。
退会済みユーザー

退会済みユーザー

2018/08/10 00:41

公式フォーラム案件だな
m.ts10806

2018/08/10 01:02

×PHPに相当詳しくないと難しい ○WordPressのこのプラグインに詳しくないと難しい  = 公式へどうぞ。 PHPに精通しているけどWordPressに精通していない人の方がおそらく多いです。
退会済みユーザー

退会済みユーザー

2018/08/10 02:05

ぶっちゃけ、バグだ何だといい切る前に仕様を確認したり、ユーザーの条件の違いを調べたほうが自力解決に近づくけどね。同じ環境を第三者が再現できないような話題ならなおさら自分で解決するために試行錯誤しなきゃいけない。WordPress上にユーザーアカウントを持っているかどうかとか、案外そういうところかもしれないよ。
退会済みユーザー

退会済みユーザー

2018/08/10 04:18

terraceさん、解決策ですね。mts10806さん、そうですね。m6uさん、英語圏でも同じ質問があり、2年ほど直っていないようです。papinianusさん、それはメール通知ですね。みなさん、ご意見ありがとうございます。l
CHERRY

2018/08/10 04:41

英語圏の質問のURL を 質問に「参考URL」して、記載していただけませんか?
退会済みユーザー

退会済みユーザー

2018/08/10 04:45

CHERRYさん、「同様の報告」として質問文に追記致しました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問