Jump to the post that solved this thread.
Not Solved Most variables not working on forumdisplay_thread
#11
Not Solved
(2015-08-11, 03:52 PM)Ad Bakker Wrote: Which information is in $post['fid5']?

This is custom, nation's link.

(I'm doing this for a game.)
I'm new to MyBB, has been using WordPress and only know HTML/CSS.
Reply
#12
Not Solved
(2015-08-11, 04:12 PM)XP Mai Wrote: This is custom, nation's link.
(I'm doing this for a game.)

OK, we are going to name it $thread['fid5'] (so that is the name to be used in the template).
In script forumdisplay.php gp to line 1315 which reads:

$plugins->run_hooks("forumdisplay_thread_end");

Directly before that add the following 2 lines:

$query = $db->simple_select("userfields", "fid5", "ufid = {$thread['uid']}");
$thread['fid5'] = $db->fetch_array($query)['fid5']; 

Try this out together with $thread['username']. When these work fine we can go to the avatar.
Regards, Ad Bakker (NL)
Reply
#13
Not Solved
Is it the same pattern for all other variables I want to make?
I'm new to MyBB, has been using WordPress and only know HTML/CSS.
Reply
#14
Not Solved
(2015-08-11, 05:16 PM)XP Mai Wrote: Is it the same pattern for all other variables I want to make?

That's a matter of choice. The variable name you define in the php script is the one you must use in the template. So you can choose any name, as long as it is not an existing one.

But if you mean by "pattern": the way it works, yes. Only for the avatar it is perhaps more complex, I don't know yet.


OK, I finished it with the avatar, add the lines below to furumdisplay.php below the 2 lines that were added before:

$query = $db->simple_select("users", "avatar, avatardimensions, username", "uid = {$thread['uid']}");
$avatar = $db->fetch_array($query);
$profilelink = get_profile_link($thread['uid']);
$thread['avatar'] = "";
if ($avatar['avatar'] != "")
{
	$useravatar = format_avatar($avatar['avatar'], $avatar['avatardimensions'], $mybb->settings['postmaxavatarsize']);
	$thread['avatar'] = "<div class=\"author_avatar\"><a href=\"{$profilelink}\"><img src=\"{$useravatar['image']}\" alt=\"\" {$useravatar['width_height']} /></a></div>";
}

When you add {$thread['avatar']} to the proper place in template forumdisplay_thread the avatar will appear there linking to the thread starter's profile.

Now the variables that you mentioned in your opening post are treated.

I am curious whether you get it working. I am sure it will work, because I tested it.
Regards, Ad Bakker (NL)
Reply
#15
Not Solved
It gets logged in avatar, not thread OP's.
I'm new to MyBB, has been using WordPress and only know HTML/CSS.
Reply
#16
Not Solved
(2015-08-15, 07:29 PM)XP Mai Wrote: It gets logged in avatar, not thread OP's.

Can you be some more specific with what you try to say here?
Regards, Ad Bakker (NL)
Reply
#17
Not Solved
The avatar shows my avatar, not OP's avatar.
I'm new to MyBB, has been using WordPress and only know HTML/CSS.
Reply
#18
Not Solved
(2015-08-15, 08:45 PM)XP Mai Wrote: The avatar shows my avatar, not OP's avatar.

Sure you used this query and you are not the opening poster?

$query = $db->simple_select("users", "avatar, avatardimensions, username", "uid = {$thread['uid']}");

I checked and ran the code once again, and here it does exactly what it should be.
Regards, Ad Bakker (NL)
Reply
#19
Not Solved
(2015-08-11, 04:52 PM)Ad Bakker Wrote:
(2015-08-11, 04:12 PM)XP Mai Wrote: This is custom, nation's link.
(I'm doing this for a game.)

OK, we are going to name it $thread['fid5'] (so that is the name to be used in the template).
In script forumdisplay.php gp to line 1315 which reads:

$plugins->run_hooks("forumdisplay_thread_end");

Directly before that add the following 2 lines:

$query = $db->simple_select("userfields", "fid5", "ufid = {$thread['uid']}");
$thread['fid5'] = $db->fetch_array($query)['fid5']; 

Try this out together with $thread['username']. When these work fine we can go to the avatar.

The forum becomes white until I remove the code.
I'm new to MyBB, has been using WordPress and only know HTML/CSS.
Reply
#20
Not Solved
(2015-08-16, 01:38 PM)XP Mai Wrote: The forum becomes white until I remove the code.

Which is strange because I installed it exactly as shown here, and this worked fine.

Can you show your forum_display.php, lines 1310 - 1330, and your template forumdisplay_thread?
Regards, Ad Bakker (NL)
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)