Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display points in forum posts

  • Profile photo of sheryll
    sheryll
    Member

    @sheryll

    I’m trying to display the points in forum posts and I used the code xberserker provided for comment posts. it didn’t work because the forum user id is called by a different function.

    I tried different variations to try to get the user id but to no avail, here is what I had:
    `<?php
    $user = bp_get_the_topic_post_poster_name($user->id);
    if(function_exists(‘cp_displayPoints’)){
    cp_displayPoints($user->ID);
    } ?>`

    Can any help me solve this? Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Profile photo of Tosh
    Tosh
    Participant

    @xberserker

    Which forum do you have on your site? Or are you talking about the buddypress group forums?

    Profile photo of sheryll
    sheryll
    Member

    @sheryll

    The buddypress group forums.

    Profile photo of Tosh
    Tosh
    Participant

    @xberserker

    I tried a few things I think we are on the right track. It’s still only showing the persons logged in points for me.

    Profile photo of sheryll
    sheryll
    Member

    @sheryll

    yes, same here.At least I’m not getting any php error messages so the codes make sense. I only know very basic php. I think the issue is:

    $user = bp_get_the_topic_post_poster_name($user->id);

    $user->id , I think this is the part that needs to be changed because this one references the id for comments or regular wp, I just don’t know what bp uses to reference the id. Does this make sense? Again, I’m just a beginner so if what I’m saying makes no sense at all please do let me know.

    Profile photo of Tosh
    Tosh
    Participant

    @xberserker

    https://svn.buddypress.org/trunk/bp-forums/bp-forums-templatetags.php

    I think what we need might be in there. But the way BuddyPress finds the ID’s or at least than I have found is these pretty much:

    $bp->displayed_user->id
    $bp->loggedin_user->id

    https://codex.buddypress.org/developer-docs/the-bp-global/

    Profile photo of sheryll
    sheryll
    Member

    @sheryll

    any luck with this? I’ve honestly spent hours using different combinations but still without success. It seems so straightforward but I wonder why it is not recognizing the ID in the forums.

    Profile photo of Tosh
    Tosh
    Participant

    @xberserker

    I haven’t had any luck either … :/ @r-a-y @hnla Do you have any ideas?

    Profile photo of r-a-y
    r-a-y
    Moderator

    @r-a-y

    @xberserker @sheryll – You need to find the forum poster ID, so the appropriate template tag you’re looking for is this:
    `bp_get_the_topic_poster_id()`

    Profile photo of Tosh
    Tosh
    Participant

    @xberserker

    @r-a-y Tried this but it only displays the points of the logged in user.

    `$cp_pointsuser = bp_get_the_topic_poster_id();
    if(function_exists(‘cp_displayPoints’)){
    cp_displayPoints($cp_pointsuser);
    } `

    Profile photo of r-a-y
    r-a-y
    Moderator

    @r-a-y

    @xberserker – You can only use bp_get_the_topic_poster_id() within /groups/single/forum/topic.php or within the forum topics loop.

    Profile photo of sheryll
    sheryll
    Member

    @sheryll

    yes, I’ve been using bp_get_the_topic_poster_id() but it still doesn’t work.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Display points in forum posts’ is closed to new replies.
Skip to toolbar