plugins - return bbp_get_topic_author_id as integer

As the title suggests I would like to receive the topic author as an integer I am using it in conjunction with myCRED, s

As the title suggests I would like to receive the topic author as an integer I am using it in conjunction with myCRED, so far, I have tried this:

$user_id = bbp_get_topic_author_id(  $topic_id = 0 );
$mycred  = mycred();

if ( ! $mycred->exclude_user( $user_id ) )
    $mycred->update_users_balance( $user_id, 1 );

I assumed bbp_get_topic_author_id returned a integer like get_current_user_id but the script acted as if the line didn't exist and continued with the rest of the plugin. This makes me assume that it is returning some variable but cannot be understood by mycred. Thanks in advance.

P.S I am unsure what to tag this so I have only selected bbpress

As the title suggests I would like to receive the topic author as an integer I am using it in conjunction with myCRED, so far, I have tried this:

$user_id = bbp_get_topic_author_id(  $topic_id = 0 );
$mycred  = mycred();

if ( ! $mycred->exclude_user( $user_id ) )
    $mycred->update_users_balance( $user_id, 1 );

I assumed bbp_get_topic_author_id returned a integer like get_current_user_id but the script acted as if the line didn't exist and continued with the rest of the plugin. This makes me assume that it is returning some variable but cannot be understood by mycred. Thanks in advance.

P.S I am unsure what to tag this so I have only selected bbpress

Share Improve this question edited Jul 30, 2019 at 13:53 tejt asked Jul 30, 2019 at 11:00 tejttejt 14 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The problem is that $user_id = bbp_get_topic_author_id( $topic_id = 0 ) is malformed. You need to remove the = 0 from $topic_id = 0 and make sure that the variable $topic_id actually contains the ID of the topic you are trying to get the author of.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745284040a4620453.html

相关推荐

  • plugins - return bbp_get_topic_author_id as integer

    As the title suggests I would like to receive the topic author as an integer I am using it in conjunction with myCRED, s

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信