Skip to:
Content
Pages
Categories
Search
Top
Bottom

Functions not working on front page

  • I have the following code on my front page to display the topics:

    <?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
    <li<?php topic_class(); ?>>

    <span class="left">
    <strong><?php bb_topic_labels(); ?> <big><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></big><?php topic_page_links(); ?></strong>
    <span class="time"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?> ago</a> in <a href="<?php forum_link(); ?>"><?php forum_name(); ?></a></span>
    </span>
    <span class="author">by <a href="<?php post_author_title_link(); ?>"><?php topic_last_poster(); ?></a></span>

    </li>
    <?php endforeach; endif; // $topics ?>

    BUT the forum_link, forum_name, and post_author_title_link functions do not work. Any ideas how I can get them to work on the front page or use alternative functions to show this information.

    Thanks.

Viewing 19 replies - 1 through 19 (of 19 total)

  • Gautam Gupta
    Participant

    @gautamgupta

    Change them to forum_link( $topic->forum_id ), forum_name( $topic->forum_id ), post_author_title_link( $topic->topic_last_post_id ) (not tested, but should work).

    (Replace > with the greater than sign.)


    kevinjohngallagher
    Member

    @kevinjohngallagher

    Gautam,

    Can you confirm if this “Greater than” and “less than” nonsense is in the nightly builds, and thus something for us to fix in the latest version, or if it’s down to a hack purely on the bbPress website.

    Because it’s getting quite mental.


    chrishajer
    Participant

    @chrishajer

    Kevin, we added the svn revision number to the version, so any theme that echos the meta generator tag will have the version, like “1.1-alpha-2440”. Checking the source here, this site is not running the very latest trunk, although it is running trunk of some revision (but a revision before 2441 – we just don’t know which one since the version tag was not changed until 2441.)

    [meta name=”generator” content=”bbPress 1.1-alpha” /]

    On my test installation http://bbpress.chrishajer.com/trunk/ you can see it’s running r2441:

    [meta name=”generator” content=”bbPress 1.1-alpha-2441″ /]

    Test posting there in code tag or backticks shows completely fubar formatting. It is apparently something we can fix in trunk. Not sure when that particular problem was introduced.


    chrishajer
    Participant

    @chrishajer

    Oh yeah, that post was made just once without editing, just in case it matters to anyone.

    Thanks, those worked great. Had to change the author link though as that function spits out the anchor tags itself.

    I used this if anyone is interested:

    <a href="<?php user_profile_link( $topic->topic_last_poster ); ?>"><?php topic_last_poster(); ?></a>

    Another quick question though, I’m try to show the gravatar for a logged in user in the header and the mystery man if not logged in. This is teh code I have so far, but it’s not working very well, it always shows the mystery man and shows the avatar of the profile your viewing and not the logged in user.

    <?php if ( $avatar = bb_get_avatar( $user->ID,$size='48' ) ) : ?>
    <?php echo $avatar; ?>
    <?php unset($avatar); endif; ?>

    Thanks


    kevinjohngallagher
    Member

    @kevinjohngallagher

    Ok, “$user” is blank/empty for some reason, it’s not even a global that needs to be redefined. I’m sure I’ve fixed this elsewhere, let me hunt around some of my forums and get back to you :)

    EDIT: it’s $bb_current_user

    Apparently, we wanted to be as different from wordpress as possible ;-)

    global $bb_current_user;

    echo bb_get_avatar($bb_current_user->ID, 100);

    Works fine except when viewing the profile of a user the avatar becomes that of the profile you are viewing regardless of whether you are logged in or not. So for example if I view /forums/profile/cameron it would show camerons avatar even though i might be logged in as john.


    kevinjohngallagher
    Member

    @kevinjohngallagher

    I can’t replicate that I’m afraid.

    I’m looking at the profile page of a different user and I’m getting my own Avatar.

    add this before your code and read the output:

    print_f($bb_current_user)

    It should give you a bit of insight.

    that code throws an error Call to undefined function print_f()

    The avatar shows correct every but when viewing the profile page, it’s as though bbPress treats that as the current user and changes the avatar.

    You say you get your own avatar when viewing a profile, what happens if you view the same profile but logged out? Do you get mystery man or the profiles avatar?


    kevinjohngallagher
    Member

    @kevinjohngallagher

    offs – my bad, i’m so sorry.

    I mean print_r been swapping languages too much this weekend.

    On my version, the avatar I get shown on every page is my own, even other profiles.

    I actually haven’t written the code to get teh grey man, just to test/output my own avatar.

    What I want to happen is if you are logged out then show the mystery man, if you could help me to do this, it’d be much appreciated. Thanks.


    kevinjohngallagher
    Member

    @kevinjohngallagher

    I am mate, the function bb_get_avatar() returns either your Gravatar or the default gravar that you specified in your admin section under Settings / Discussion.

    In order for that to happen you have to type in the code I’ve given you above. I’ve got it working right now, i’m looking at it.

    It’s not working for you for some reason I can’t replicate, so you need to debug the array and look to se what’s happening with print_r($bb_current_user) – and we’ll try from there.

    If I’m not logged in then that code shows 0 but when I visit the profile page of a user the avatar will change to that of the profile I’m viewing.

    If I’m logged in then I get the following mess:

    BP_User Object ( [data] => stdClass Object ( [ID] => 1 [user_login] => cameron [user_pass] => $P$B1pN/b8ZvQpPDtPILqpJCPqT4M4F0f/ [user_nicename] => cameron [user_email] => EMAILREMOVED [user_url] => http://www.paperviewmagazine.com/members/cameron/ [user_registered] => 2010-04-16 22:27:31 [user_activation_key] => [user_status] => 0 [display_name] => Cameron [spam] => 0 [deleted] => 0 [aim] => [yim] => [jabber] => [use_ssl] => 0 [nickname] => Cameron [chat_hide] => true [mini_track] => Sat, 12 Jun 2010 04:39:24 -0700 [first_name] => Cameron [description] => This is some information about me [admin_color] => fresh [rich_editing] => true [primary_blog] => 2 [last_activity] => 2010-06-14 14:53:08 [source_domain] => www.paperviewmagazine.com [pvwp_user_level] => 10 [bp_latest_update] => Array ( [id] => 1 [content] => Test status message ) [bb_user_settings] => m0=c&m1=c [pvwp_4_user_level] => 0 [pvwp_1_user_level] => 1 [pvbb_capabilities] => Array ( [keymaster] => 1 [throttle] => 1 ) [capabilities] => Array ( [keymaster] => 1 [throttle] => 1 ) [pvwp_7_user_level] => 0 [pvwp_capabilities] => Array ( [administrator] => 1 ) [comment_shortcuts] => false [pvwp_6_user_level] => 0 [pvwp_5_user_level] => 0 [pvwp_8_user_level] => 0 [pvwp_2_user_level] => 0 [pvwp_3_user_level] => 0 [pvwp_12_user_level] => 10 [pvwp_user-settings] => m5=c&m6=c&m9=c&m0=c&m10=c&m8=o&m7=c&m1=c&m2=c&editor=tinymce&hidetb=1&m11=c&m3=c&m12=c&m13=c&m4=c [pvwp_13_user_level] => 10 [pvwp_11_user_level] => 10 [pvwp_10_user_level] => 10 [pvwp_1_capabilities] => Array ( [contributor] => 1 ) [pvwp_8_capabilities] => Array ( [administrator] => 1 ) [pvbb_topics_replied] => 13 [topics_replied] => 13 [pvwp_6_capabilities] => Array ( [administrator] => 1 ) [pvwp_7_capabilities] => Array ( [administrator] => 1 ) [pvwp_3_capabilities] => Array ( [administrator] => 1 ) [pvwp_4_capabilities] => Array ( [administrator] => 1 ) [pvwp_2_capabilities] => Array ( [administrator] => 1 ) [pvwp_5_capabilities] => Array ( [administrator] => 1 ) [bp_liked_activities] => Array ( [1] => activity_liked [3] => activity_liked ) [pvwp_7_user-settings] => m5=c&m6=c&m9=c&m0=c&m10=c&m8=c&m7=c&m1=c&m2=c&editor=tinymce&hidetb=1&m11=c&m3=c&m12=o&m13=c&m4=c [pvwp_11_capabilities] => Array ( [administrator] => 1 ) [pvwp_13_capabilities] => Array ( [administrator] => 1 ) [pvwp_10_capabilities] => Array ( [administrator] => 1 ) [pvwp_12_capabilities] => Array ( [administrator] => 1 ) [pvwp_3_user-settings] => m5=c&m6=c&m9=c&m0=c&m10=c&m8=o&m7=c&m1=c&m2=c&editor=tinymce&hidetb=1&m11=c&m3=o [pvwp_4_user-settings] => m5=c&m6=c&m9=c&m0=o&m10=c&m8=c&m7=c&m1=c&m2=c [pvwp_2_user-settings] => m5=c&m6=c&m9=c&m0=c&m10=c&m8=c&m7=c&m1=c&m2=o&editor=tinymce&hidetb=1&m11=c&m3=c&m12=c&m13=c&m4=c [bb_user_settings_time] => 1276463427 [pvwp_10_user-settings] => m5=c&m6=c&m9=o&m0=c&m10=c&m8=c&m7=c&m1=c&m2=c&editor=tinymce&hidetb=1&m11=o&m3=o&m12=c [screen_layout_dashboard] => 1 [metaboxhidden_dashboard] => Array ( [0] => dashboard_recent_comments [1] => dashboard_incoming_links [2] => dashboard_plugins [3] => dashboard_quick_press [4] => dashboard_recent_drafts [5] => dashboard_primary [6] => dashboard_secondary ) [metaboxhidden_nav-menus] => Array ( [0] => add-post [1] => add-post_tag ) [pvwp_user-settings-time] => 1276464114 [nav_menu_recently_edited] => 3 [meta-box-order_dashboard] => Array ( [normal] => dashboard_right_now,dashboard_recent_comments,dashboard_incoming_links,dashboard_plugins,dashboard_quick_press,dashboard_recent_drafts,dashboard_primary,dashboard_secondary [side] => [column3] => [column4] => ) [pvwp_2_user-settings-time] => 1275215993 [pvwp_7_user-settings-time] => 1275772159 [pvwp_4_user-settings-time] => 1271497216 [closedpostboxes_dashboard] => Array ( ) [pvwp_3_user-settings-time] => 1275065270 [pvwp_10_user-settings-time] => 1274906535 [managenav-menuscolumnshidden] => Array ( [0] => link-target [1] => css-classes [2] => xfn [3] => description ) [pvwp_dashboard_quick_press_last_post_id] => 51 [pvwp_7_dashboard_quick_press_last_post_id] => 6 [pvwp_3_dashboard_quick_press_last_post_id] => 63 [pvwp_10_dashboard_quick_press_last_post_id] => 3 ) [ID] => 1 [id] => 1 [caps] => Array ( [keymaster] => 1 [throttle] => 1 ) [cap_key] => pvbb_capabilities [roles] => Array ( [0] => keymaster ) [allcaps] => Array ( [use_keys] => 1 [administrate] => 1 [moderate] => 1 [participate] => 1 [keep_gate] => 1 [import_export] => 1 [recount] => 1 [manage_options] => 1 [manage_themes] => 1 [manage_plugins] => 1 [edit_users] => 1 [manage_tags] => 1 [edit_others_favorites] => 1 [manage_forums] => 1 [delete_forums] => 1 [delete_topics] => 1 [close_topics] => 1 [stick_topics] => 1 [move_topics] => 1 [view_by_ip] => 1 [edit_closed] => 1 [edit_deleted] => 1 [browse_deleted] => 1 [edit_others_tags] => 1 [edit_others_topics] => 1 [delete_posts] => 1 [throttle] => 1 [ignore_edit_lock] => 1 [edit_others_posts] => 1 [edit_favorites] => 1 [edit_tags] => 1 [edit_topics] => 1 [edit_posts] => 1 [edit_profile] => 1 [write_topics] => 1 [write_posts] => 1 [change_password] => 1 [read] => 1 [keymaster] => 1 ) [first_name] => Cameron [last_name] => [user_login] => cameron [user_pass] => $P$B1pN/b8ZvQpPDtPILqpJCPqT4M4F0f/ [user_nicename] => cameron [user_email] => EMAILREMOVED [user_url] => http://www.paperviewmagazine.com/members/cameron/ [user_registered] => 2010-04-16 22:27:31 [user_activation_key] => [user_status] => 0 [display_name] => Cameron [spam] => 0 [deleted] => 0 [aim] => [yim] => [jabber] => [use_ssl] => 0 [nickname] => Cameron [chat_hide] => true [mini_track] => Sat, 12 Jun 2010 04:39:24 -0700 [description] => This is some information about me [admin_color] => fresh [rich_editing] => true [primary_blog] => 2 [last_activity] => 2010-06-14 14:53:08 [source_domain] => www.paperviewmagazine.com [pvwp_user_level] => 10 [bp_latest_update] => Array ( [id] => 1 [content] => Test status message ) [bb_user_settings] => m0=c&m1=c [pvwp_4_user_level] => 0 [pvwp_1_user_level] => 1 [pvbb_capabilities] => Array ( [keymaster] => 1 [throttle] => 1 ) [capabilities] => Array ( [keymaster] => 1 [throttle] => 1 ) [pvwp_7_user_level] => 0 [pvwp_capabilities] => Array ( [administrator] => 1 ) [comment_shortcuts] => false [pvwp_6_user_level] => 0 [pvwp_5_user_level] => 0 [pvwp_8_user_level] => 0 [pvwp_2_user_level] => 0 [pvwp_3_user_level] => 0 [pvwp_12_user_level] => 10 [pvwp_user-settings] => m5=c&m6=c&m9=c&m0=c&m10=c&m8=o&m7=c&m1=c&m2=c&editor=tinymce&hidetb=1&m11=c&m3=c&m12=c&m13=c&m4=c [pvwp_13_user_level] => 10 [pvwp_11_user_level] => 10 [pvwp_10_user_level] => 10 [pvwp_1_capabilities] => Array ( [contributor] => 1 ) [pvwp_8_capabilities] => Array ( [administrator] => 1 ) [pvbb_topics_replied] => 13 [topics_replied] => 13 [pvwp_6_capabilities] => Array ( [administrator] => 1 ) [pvwp_7_capabilities] => Array ( [administrator] => 1 ) [pvwp_3_capabilities] => Array ( [administrator] => 1 ) [pvwp_4_capabilities] => Array ( [administrator] => 1 ) [pvwp_2_capabilities] => Array ( [administrator] => 1 ) [pvwp_5_capabilities] => Array ( [administrator] => 1 ) [bp_liked_activities] => Array ( [1] => activity_liked [3] => activity_liked ) [pvwp_7_user-settings] => m5=c&m6=c&m9=c&m0=c&m10=c&m8=c&m7=c&m1=c&m2=c&editor=tinymce&hidetb=1&m11=c&m3=c&m12=o&m13=c&m4=c [pvwp_11_capabilities] => Array ( [administrator] => 1 ) [pvwp_13_capabilities] => Array ( [administrator] => 1 ) [pvwp_10_capabilities] => Array ( [administrator] => 1 ) [pvwp_12_capabilities] => Array ( [administrator] => 1 ) [pvwp_3_user-settings] => m5=c&m6=c&m9=c&m0=c&m10=c&m8=o&m7=c&m1=c&m2=c&editor=tinymce&hidetb=1&m11=c&m3=o [pvwp_4_user-settings] => m5=c&m6=c&m9=c&m0=o&m10=c&m8=c&m7=c&m1=c&m2=c [pvwp_2_user-settings] => m5=c&m6=c&m9=c&m0=c&m10=c&m8=c&m7=c&m1=c&m2=o&editor=tinymce&hidetb=1&m11=c&m3=c&m12=c&m13=c&m4=c [bb_user_settings_time] => 1276463427 [pvwp_10_user-settings] => m5=c&m6=c&m9=o&m0=c&m10=c&m8=c&m7=c&m1=c&m2=c&editor=tinymce&hidetb=1&m11=o&m3=o&m12=c [screen_layout_dashboard] => 1 [metaboxhidden_dashboard] => Array ( [0] => dashboard_recent_comments [1] => dashboard_incoming_links [2] => dashboard_plugins [3] => dashboard_quick_press [4] => dashboard_recent_drafts [5] => dashboard_primary [6] => dashboard_secondary ) [metaboxhidden_nav-menus] => Array ( [0] => add-post [1] => add-post_tag ) [pvwp_user-settings-time] => 1276464114 [nav_menu_recently_edited] => 3 [meta-box-order_dashboard] => Array ( [normal] => dashboard_right_now,dashboard_recent_comments,dashboard_incoming_links,dashboard_plugins,dashboard_quick_press,dashboard_recent_drafts,dashboard_primary,dashboard_secondary [side] => [column3] => [column4] => ) [pvwp_2_user-settings-time] => 1275215993 [pvwp_7_user-settings-time] => 1275772159 [pvwp_4_user-settings-time] => 1271497216 [closedpostboxes_dashboard] => Array ( ) [pvwp_3_user-settings-time] => 1275065270 [pvwp_10_user-settings-time] => 1274906535 [managenav-menuscolumnshidden] => Array ( [0] => link-target [1] => css-classes [2] => xfn [3] => description ) [pvwp_dashboard_quick_press_last_post_id] => 51 [pvwp_7_dashboard_quick_press_last_post_id] => 6 [pvwp_3_dashboard_quick_press_last_post_id] => 63 [pvwp_10_dashboard_quick_press_last_post_id] => 3 )


    kevinjohngallagher
    Member

    @kevinjohngallagher

    Coolio, right mate, first thing, edit that to delete your email :)

    I’ll write more , just wanted to get you that asap


    kevinjohngallagher
    Member

    @kevinjohngallagher

    Cameron, you “build awesome websites”… look at the source code. It’s a lovely well formatted multidimentional array. It’s not a mess, it’s the most concise and beautiful debugging tool you’ll ever have. Trust me, you’ll love it bro :)

    When you go to a profile page, what does the array say? (don’t post it)

    Does it say the information of the logged in user, or the person who’s profile page you’re on?

    No matter where I go, on the site, I get the informaiton of the logged in user. If you don’t, then you’ve found a bug.

    This code here should solve the logged in/out issue – though there is probably a better way to handle it :)

    if (empty($bb_current_user) || $bb_current_user == 0)

    {

    echo "<img src='grey_man'>";

    } else {

    echo bb_get_avatar($bb_current_user->ID, 100);

    }

    Okay the problem is defo with being logged out. When logged in you get the correct Avatar (your own) when viewing profiles. However when logged out you don’t get the guest avatar but the user of the profile your viewing.

    So to clarify I do get the User Info like you do, but the not when logged out! And the array doesn’t work when logged out so there is no info to show.


    kevinjohngallagher
    Member

    @kevinjohngallagher

    Kool and the gang. We’re one step closer.

    EDIT: Yes, you’re partly right. I get the same. Ok, thats a bug. Well done!

    When logged out, visiting a user’s profile page the default avatar is replaced with the profile owner’s avatar.

    That said my code above definately works to not display the gravatar if you’re logged out, insteadyou can display any image you want.

    if (empty($bb_current_user) || $bb_current_user == 0)

    {

    echo "create an image output here to any image on yoru server";

    } else {

    echo bb_get_avatar($bb_current_user->ID, 100);

    }

    Would work as a quick fix. But would much rather use built-in code etc. Any ideas how long this bug will take to fix?


    kevinjohngallagher
    Member

    @kevinjohngallagher

    At the current rate of maximum of 1 release a year… no idea, sorry.

    That said, there are some really good people working on it, so just add your bug report to http://trac.bbpress.org and someone with the technical know how will look at it eventually :)

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