- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经使用自定义配置文件字段设置了 BuddyPress,该字段列出了与我的网站相关的标签的复选框。
有没有办法在新帖子发布时根据注册的 BuddyPress 用户的自定义个人资料字段选择向其发送自动通知?
最佳答案
save_post
Hook 可以帮助您。
http://codex.wordpress.org/Plugin_API/Action_Reference/save_post
大致如下:
function send_bp_message( $post_id )
{
//verify post is not a revision
if( wp_is_post_revision($post_id) )
{
return;
}
// get the user ids you want to notify
global $bp, $wpdb;
$custom_field_id = 1; // the profile field you want to check
$custom_field_value = 'true'; // the value you're looking for
$stmt = $wpdb->prepare("
SELECT
{$bp->profile->table_name_data}.user_id
FROM
{$bp->profile->table_name_data}
LEFT JOIN
{$bp->profile->table_name_fields} ON {$bp->profile->table_name_fields}.id = {$bp->profile->table_name_data}.field_id
WHERE
{$bp->profile->table_name_fields}.id = %d
AND
{$bp->profile->table_name_data}.value LIKE %s
", $custom_field_id, $custom_field_value);
$recipient_ids = $wpdb->get_col($stmt); // array of matched user ids
// send buddypress notification to matched user ids
// (you could loop through $recipient_ids to send individual notifications)
$msg_args = array(
'sender_id' => 1, // 1 = admin
'recipients' => $recipient_ids,
'subject' => 'New post',
'content' => 'A new post has been created...'
);
$thread_id = messages_new_message($message_args);
}
add_action('save_post', 'send_bp_message');
关于php - BuddyPress,发布新故事时发送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13752956/
我要在这里做的是遍历Storybook故事,以便可以对它们进行视觉回归测试: const puppeteer = require('puppeteer'); const { toMatchImageS
有人可以帮我解释一下涉及老虎机的 Rasa 故事吗: ## story with email * intent_request_email - utter_request_email * in
我们能够实现与 Instagram Stories 的共享,但无法实现与 Facebook Stories 的共享,如下 these指示 。尽管已安装并更新 Facebook 应用,Android 仍
我在使用 Facebook 开放图表故事时遇到问题。我只想发布一个带有对象标题的故事。我尝试使用开放图形对象调试器,我可以清楚地看到 og:title 已定义,但我发布的提要中没有标题。 我也尝试使用
如何将数据从 .properties 文件动态加载到 jBehave 故事文件?我一直在我的故事文件中使用 $ ,例如: When the stock is traded at price : $ T
我是 jbehave 的新手 我正在尝试通过 junit 执行 jbehave。 jbehave 似乎只从类路径加载故事文件。是否可以将其配置为从用户定义的路径中获取故事文件。 public clas
我们刚刚开始考虑使用 JBehave 进行验收测试,我想知道使用它的人是如何组织故事的编写和故事文件的存储的。目前只是在开发它们,所以我们将故事文件与实现它们的 Java 代码一起存储在资源文件夹中。
我正在尝试按顺序运行 jbehave 故事。 我的集成测试包结构如下所示 src/it/some/package/name/packageA/a.story src/it/some/package/n
我有一个 jBehave 故事如下; Scenario: Setup test GivenStories: common/story_1.story, common/sto
有人可以帮我运行一个 JBehave 故事吗?我在 Eclipse 中有一个 Maven 项目。 故事是: Meta: @author Nikolay Vasilev @bdd-talk: BG JU
我们有一个 Web 开发项目团队,我们决定使用单个存储库及其优缺点。我们将待办事项分成 Jira 故事,每个故事都有几个 FE 和 BE 任务。喜欢: ABC-1 显示猫 1.1. ABC-2 [FE
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
在我们公司,我们目前正在尝试建立故事 map (Jeff Patton)的概念。 我有以下问题:- 在具有交叉问题/任务的故事 map 中会发生什么?我们有贯穿整个项目的事件。故事 map 中的这些事
我想获得与远程 GIT 和 SVN 存储库同步的本地 GIT 存储库。 我正在执行的步骤如下: > git push Everything up-to-date > git pull Already
目前我所有的 .stories 文件都保存在 stories 目录中。随着我添加更多组件,它会增长。 相反,我想根据 Storybook 站点上的文档在组件级别添加每个组件的 .stories 文件:
我在网上读到 snapchat 和 instagram 有不同的方法来捕获视频,而不是在 Android 中使用相机 API,这允许它们向捕获的内容添加过滤器/贴纸等。 任何人都可以建议解决这个问题的
在 let returnTrip = Page(story: .ReturnTrip) 中它给了我们错误。我真的不知道为什么1 enum Story { case ReturnTrip (String
我们刚刚开始将Jira(带有Jira Agile插件-Scrum模板)用于我们的问题跟踪程序和敏捷计划。 我对故事和改进之间的差异(或预期的差异)感到困惑。我们所有的“东西”都写成故事。这些故事描述了
我正在为一个网站设计一个数据库,该数据库将至少表示 4 种不同的对象类型(文章、博客文章、照片、故事),每一种都有足够不同的数据要求来保证他们自己的表。我们希望用户能够发表任何这些类型的评论。评论的数
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
我是一名优秀的程序员,十分优秀!