MyBB Community Forums

Full Version: Lastposter avatar 3.0.x
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
(2019-03-07, 12:13 PM)Whiteneo Wrote: [ -> ]@canadacommunitty honestly there are people into my forums who help me into design parts i am only a programer, so many times i could not be abble to give support to skin development, and that i why i can not cover more than add a customized tags and css for users can do it by themselves.

I recomend you to ask for help to a skin developer that guys know what they do better i only can help you with problems within the mod or solve issues, etc. But in other parts is hard and complex and more enought i have many pendants to deal with, some things at home, real life, etc.

I have to reject many paid jobs aswell due the same thing, so i will sugest to contact an skin developer Smile

I respect your answer, by the way you did a great good job on this plugin!  Wink
How can I get rid of the Hashtags ( # ) and UID that output around the Username for some reason whenever I switch on "Show Avatar on Index"?

Example:

[Image: 2Y9j3eB.png]
Read the first post there is the solution.

And READ THE PLUGIN INFORMATION. The plugin itself show a warn text about this when happens. And tell you how to fix it.

So ok read the first post and go to the image screen with this issue and follow instructions.

It is incredible how people ask for the same things once and again and even when we have covered in all senses Smile
Hi Neo

How can i do a string replace in the forumbit_depth2_forum_lastpost template with formatname option ON ?

i want to put this in the template;

		$admin = '';
		$admin = '<span class="administrators">';

		if ( strpos($lastpost_profilelink, $admin) !== false )
		{
			$lastpost_profilelink = str_replace($admin, "", "{$link}");
			$lastpost_profilelink = str_replace("</span>", "", "{$link}");
			$lastpost_profilelink = str_replace("<a","<a class=\"administrators\" ", "{$lastpost_profilelink}");
		}

The code works everywhere except where the plugin changes the colour. Maybe i am using the wrong variable to replace?
You have to add it into pre_output_page hook where the usernames where formated due cache basis.

That way it will replace the current html mybb default format for usergroups and override whitin your customized one to prevent format the names within this current function.
(2019-07-06, 03:02 PM)Whiteneo Wrote: [ -> ]You have to add it into pre_output_page hook where the usernames where formated due cache basis.

That way it will replace the current html mybb default format for usergroups and override whitin your customized one to prevent format the names within this current function.

Should be here right?

					if($mybb->version_code >= 1808)
					{
						$cache->cache['users'][$user['uid']] = $user['username'];
						$user['username'] = "#{$user['username']}{$user['uid']}#";
					}
					else
					{
						$username = format_name($user['username'], $user['usergroup'], $user['displaygroup']);	
						$_f['lastposterav'] = $username;
						$user['username'] = build_profile_link($_f['lastposterav'], $user['uid']);										
					}

but where is build_profile_link function when the mybb version code >= 1808 ?
Nope i am talking about

			$format = "#{$avatarep['username']}{$avatarep['uid']}#";
			if(is_array($cache->cache['groups']) && !empty($cache->cache['mods']))
			{
				$compare = explode(",", $cache->cache['mods']);
				if(in_array($avatarep['uid'], $compare))
                {
                    $old_username = str_replace('{username}', $format, $cache->cache['usergroups'][$avatarep['usergroup']]['namestyle']);
                    if ($old_username != '')
                    {
                        $content = str_replace($old_username, $format, $content);
                    }
                }
				
			}

That part you can add your own code within the usergroups or vars like cancp, etc.

But maybe you want to do something different that i was thinked.

What exactly is the purpose of the end code you wanna use ?

Because there are many ways to add classes or customize things for usernames, but if you wanna use the links or anything else maybe there must be another way like the first thing you do, but if you provide me more information maybe i can helpt to you Smile
You will know MyBB formats the username like this:

<span class="administrators">{username}</span>

the problem is that it does not style the link, so after build_profile_link function, the link looks like:

<a href="someuser_id"><span class="administrators">{username}</span></a>

i want to achieve:

<a [font=Monaco, Consolas, Courier, monospace]class="administrators" href="someuser_id">{username}</a>[/font]

It works with the code i gave, but not with the plugin. Hope that explains.
I see it is not posible right now because the current values are not available to search or overwrite it (at least in the last current versions of the plugin).

But you have to call the $lastpost_profilelink var and set the value to find and replace. Right now only it is posible to add in inside the username var, that is what i do to put the values inside the forum name and replace it within the format or any other value, but with the user links are not disponible, i was tryed to add a new hook inside forumbits but the values are not loaded in the right instance the only way will be if we can get at least the template var value or the $lastpost_profilelink var but right now it has no values and even it can not be overwriten.

This will need a more complex code additions or maybe if you add it inside the build_profile_link function that is inside in the core of functions.php file must be more easy to deal with that code you wish.

You will have this:

function build_profile_link($username="", $uid=0, $target="", $onclick="")
{
	global $mybb, $lang;

	if(!$username && $uid == 0)
	{
		// Return Guest phrase for no UID, no guest nickname
		return htmlspecialchars_uni($lang->guest);
	}
	elseif($uid == 0)
	{
		// Return the guest's nickname if user is a guest but has a nickname
		return $username;
	}
	else
	{
		// Build the profile link for the registered user
		if(!empty($target))
		{
			$target = " target=\"{$target}\"";
		}

		if(!empty($onclick))
		{
			$onclick = " onclick=\"{$onclick}\"";
		}

		return "<a href=\"{$mybb->settings['bburl']}/".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
	}
}

Then you can modify it before the return function with the conditional to add the class right there or use another plugin function that can deal with this values to override it in all places where this function was called.

But i think the best way to do the thing you need is inside this part.
Ok, thanks for looking. i already modify build_profile_link function like you say, and it works. Just not where the plugin makes changes. i will leave it on the todo list.
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