are you sure it is stored in a custom post, not in usermeta?
and if in custom post, how is each user stored?
Hi Robin, You are correct – it is in usermeta.
ok, so do you know how to amend files and ftp them to your site?
I don’t, but I can learn.
find
wp-content/plugins/bbpress/templates/default/bbpress/loop-single-reply.php
transfer this to your pc and edit
before line 56 which says
<?php do_action( 'bbp_theme_after_reply_author_details' ); ?>
add the following
<?php echo 'hello' ; ?>
and save
create a directory on your theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpress
where %your-theme-name% is the name of your theme
Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
wp-content/themes/%your-theme-name%/bbpress/loop-single-reply.php
bbPress will now use this template instead of the original
You should now see ‘hello’ where you want the neighborhood field
If you get this far, then come back
I will get to work on it, thanks.
great, so now I need to know the names of the fields you want in the database
so I need to construct a bit of code that looks like
$neighborhood = get_user_meta ($user_id, ‘%what_the_field_is_called%’ , true) ;
so I need %what_the_field_is_called% for both field 🙂
The avatar field is profile-picture
The neighborhood field is user-subdivision
ok replace the
<?php echo 'hello' ; ?>
with
<?php
$neighborhood = get_user_meta (get_current_user_id(), 'user-subdivision' , true) ;
echo '<li>'.$neighborhood.'</li>' ;
?>
and let’s see if that does that one first
for the avatar, I need to know what is stored in the usermeta, so can you try adding this after line 44
<?php bbp_reply_author_link( array( 'show_role' => true ) ); ?>
to get
<?php bbp_reply_author_link( array( 'show_role' => true ) ); ?>
<?php
$avatar = get_user_meta (get_current_user_id(), 'profile-picture' , true) ;
echo '<li>'.$avatar.'</li>' ;
?>
I need to see if this produces a url or link to media item etc.
I’m not sure what is wrong – it is not changing anything. The funny thing is, it still says hello. I checked in the file manager to make sure the file was changed and it is. I cleared the cache on the website and cleared my browsing data. Even when I write a new reply, it still says hello.
I will start over and see how it goes.
My problem was I put the file back in the bbpress directory instead of the theme directory. Here are the results:
You can see the page here: http://www.staging8.commercecitynorth.com/forums/topic/a-discussion-board-is-such-a-good-idea/
The neighborhood is showing up, the thing is though – it is the current logged in users neighborhood, not the person who posted.
oops sorry, I’ll correct that
try
<?php
$neighborhood = get_user_meta (bbp_get_reply_author_id(), 'user-subdivision' , true) ;
echo '<li>'.$neighborhood.'</li>' ;
?>
come back if that doesn’t work
ok, can you change the other one to
<?php bbp_reply_author_link( array( 'show_role' => true ) ); ?>
<?php
$avatar = get_user_meta (bbp_get_reply_author_id(), 'profile-picture' , true) ;
echo '<li>herestart'.$avatar.'hereend</li>' ;
?>
The neighborhood works. the image does not:
that’s fine, I wanted to see what was in the database ie in this case 1345, I suspect it is a reference to a media image
ok, so we are making progress.
I don’t expect this to work, just to return the next stage
so amend that to
<?php bbp_reply_author_link( array( 'show_role' => true ) ); ?>
<?php
$image_id = get_user_meta (bbp_get_reply_author_id(), 'profile-picture' , true) ;
$image = get_post_meta ($image_id, _wp_attached_file, true)
echo '<li>herestart'.$image.'hereend</li>' ;
?>
oops semi colon missing from $image = line
<?php bbp_reply_author_link( array( 'show_role' => true ) ); ?>
<?php
$image_id = get_user_meta (bbp_get_reply_author_id(), 'profile-picture' , true) ;
$image = get_post_meta ($image_id, _wp_attached_file, true) ;
echo '<li>herestart'.$image.'hereend</li>' ;
?>