MyBB Community Forums

Full Version: Displaying News on your homepage
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
Hmm, that must have been added for 1.4.

I would just like to point to once again to people, that this was designed for 1.2 and I have never actually tested it against 1.4.
How do you display a user's avatar?

It works for 1.4. I use 1.4.4 and it works like a charm.
I also have a question Blush Is there a way to pull only the posts with a specific subject from the forum ID . For example, only the posts that contain "[ARMA]" in the subject will be pulled from the forum ID and the rest of the posts are ignored by the script?

Something along the lines off "if subjectline contains "*[ARMA]*" echo $post" or something Huh
(2009-01-29, 09:43 PM)Cultred Wrote: [ -> ]How do you display a user's avatar?

The code here has a part to display the user's avatar:
http://community.mybboard.net/thread-220...#pid213534


(2009-01-30, 02:23 PM)zoog Wrote: [ -> ]Something along the lines off "if subjectline contains "*[ARMA]*" echo $post" or something Huh

This will only work properly in PHP 5, since it needs to do a search for the whole needle string:
if(strpos($whateverTheSubjectVarIsCalled, '*[ARMA]*') !== FALSE)
{
// echo the post
}
Thank you.

Except that thee attribute "src" is left empty. I tried and it just said '<img src="">'. Is there a reason? In the src attribute, I put:
{$row2['u.avatar']}
(2009-01-30, 07:37 PM)MrD. Wrote: [ -> ]This will only work properly in PHP 5, since it needs to do a search for the whole needle string:
if(strpos($whateverTheSubjectVarIsCalled, '*[ARMA]*') !== FALSE)
{
// echo the post
}

Thanks man. Thanks for your continues support on this script.

I'm going to try it out tomorrow, I first need to get some sleep Smile
(2009-01-30, 08:01 PM)Cultred Wrote: [ -> ]Thank you.

Except that thee attribute "src" is left empty. I tried and it just said '<img src="">'. Is there a reason? In the src attribute, I put:
{$row2['u.avatar']}

Looking at my DB, I think that should be 'avatar' and not 'u.avatar'
i know this code isnt that great, but it works for me.

if($mybb->user['avatar'] > "") 
{
echo "<a href='/member.php?action=profile&uid=". $mybb->user['uid']."'><img style='border: none;' src='".$mybb->user['avatar']."'/></a><br /><br />";
}

basically it shows the users avatar only when one exists (stops image not found error.)
That will show the avatar of the user currently logged in, not the avatar of the user who made the post which is being outputted by this script.
(2009-01-30, 11:51 PM)Craigw Wrote: [ -> ]i know this code isnt that great, but it works for me.

if($mybb->user['avatar'] > "")
{
echo "<a href='/member.php?action=profile&uid=". $mybb->user['uid']."'><img style='border: none;' src='".$mybb->user['avatar']."'/></a><br /><br />";
}

basically it shows the users avatar only when one exists (stops image not found error.)
The
if($mybb->user['avatar'] > "")
should actually be
if($mybb->user['avatar'] != "")
since it makes no sense to check if it's greater than(>) "", as it's not a valid check. You can leave it how you have it though if you want, just saying..

Good job, MrD.Smile
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33