Skip to:
Content
Pages
Categories
Search
Top
Bottom

Function passes a null parameter

  • @slimshadys

    Participant

    Hello all.
    I’ve been editing the bbPress 2.6.5 plugin a bit, in order to fit my use.

    As of now, I just wanna track down the topic_id and the author_id.
    That’s pretty simple, given the set of functions available for the community.

    So I managed to write this little code here:

    	global $author_id;
    	global $id_of_topic;
    
    	$id_of_topic = bbp_get_topic_id();
        	$author_id = bbp_get_topic_author_id($id_of_topic);
    

    The ID of the Topic is successfully retrieved, let’s say it’s “18446744073709551615”,
    but once I pass that variable to bbp_get_topic_author_id(), the output of $author_id is 0.

    Now that’s pretty weird considering that if I pass the number 18446744073709551615 directly into that function, everything goes fine, I retrieve the author_id successfully.

    One thing I noticed tho, is that printing out $id_of_topic, once with %d and once with %u (just after I call bbp_get_topic_id() ), I get two different values.

    – %d = 0
    – %u = 18446744073709551615

    Pretty weird.. How can I somehow pass the %u to bbp_get_topic_author_id()?

    Thanks in advance! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • @slimshadys

    Participant

    Nevermind, managed to get it working with this workaround:

    	$author_id = get_post_field( 'post_author', $topic_id );
    

    Now I have the proper $author_id! 🙂

    @robin-w

    Moderator

    great – glad you are fixed

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar