plugins - return bbp_get_topic_author_id as integer

admin2025-04-22  0

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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745284041a294281.html

最新回复(0)