medals put in signature

mmoore5553

Well-known member
Does anyone know how to do this. I changed the listener.php and put in the correct area but i do not see a hook I can have it be part of the signature. It would be above normal signature. I have done with with userfields but would love to do it with medal system.
 
There is a hook directly above the signature you can use:

Rich (BB code):
		<xen:hook name="message_content" params="{xen:array 'message={$message}'}">
		<div class="messageContent">		
			<article>
				<blockquote class="messageText ugc baseHtml{xen:if $message.isIgnored, ' ignored'}">
					<xen:include template="ad_message_body" />
					{xen:raw $message.messageHtml}
				</blockquote>
			</article>
			
			{xen:raw $messageContentAfterTemplate}
		</div>
		</xen:hook>
		
		
		<xen:if is="{$visitor.content_show_signature} && {$message.signature}">
			<div class="baseHtml signature ugc{xen:if $message.isIgnored, ' ignored'}"><aside>{xen:raw $message.signatureHtml}</aside></div>
		</xen:if>
		
		{xen:raw $messageAfterTemplate}
		
		<div id="likes-{$messageId}"><xen:if is="{$message.likes}"><xen:include template="likes_summary" /></xen:if></div>
	</div>

Append your output to the bottom of the contents of the "message_content" template hook.
 
Curious is anyone up to fixing the medals to show up before signature . This is a paid request as i can not get the formatting correct to display. If i use the hook above it does not show up at all. I am sure something with the parameters but if i just do the hook it still does not do it.
 
I have tried two different ways ...

One setting is manual and you have to put the code in where you want it. I added it at the very top in red. It was suppose to render where you put the manual code. Which did not work. Then i added a drop down but i have took it out but that code is in red at bottom. The color in orange i was not sure if i had to add anything there. This is the listener.php.
PHP:
<?php
class bdMedal_Listener {
    public static function load_class($class, array &$extend) {
        static $classes = array(
      [COLOR=#ff9900]    'XenForo_ControllerAdmin_User',[/COLOR]
   
[COLOR=#ff9900]            'XenForo_ControllerPublic_Member',[/COLOR]
[COLOR=#ff9900]            'XenForo_ControllerPublic_Help',[/COLOR]
   
[COLOR=#ff9900]            'XenForo_Model_Import',[/COLOR]
        );
   
        if (in_array($class, $classes)) {
            $extend[] = str_replace('XenForo_', 'bdMedal_Extend_', $class);
        }
    }
 
    public static function load_class_importer($class, array &$extend) {
        if (strpos($class, 'vBulletin') != false AND !defined('bdMedal_Extend_Importer_vBulletin_LOADED')) {
            $extend[] = 'bdMedal_Extend_Importer_vBulletin';
        }   
    }
 
    public static function init_dependencies(XenForo_Dependencies_Abstract $dependencies, array $data) {
        XenForo_Template_Helper_Core::$helperCallbacks['medalimage'] = array('bdMedal_Model_Medal', 'helperMedalImage');
        XenForo_Template_Helper_Core::$helperCallbacks['medalimagesize'] = array('bdMedal_Model_Medal', 'helperMedalImageSize');
    }
 
    public static function template_create($templateName, array &$params, XenForo_Template_Abstract $template) {
  [COLOR=#ff0000]    if ($templateName == 'message') {[/COLOR]
[COLOR=#ff0000]            $template->preloadTemplate('bdmedal_message_medals');[/COLOR]
        }
        elseif ($templateName == 'member_view') {
            $template->preloadTemplate('bdmedal_member_view_sidebar_middle1');
            $template->preloadTemplate('bdmedal_member_view_tabs_heading');
            $template->preloadTemplate('bdmedal_member_view_tabs_content');
        }
        elseif ($templateName == 'PAGE_CONTAINER') {
            $template->preloadTemplate('bdmedal_navigation_tabs_help');
        }
    }
 
    public static function template_hook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template) {
        $positionInPost = XenForo_Application::get('options')->get('bdMedal_positionInPost');
   
        if ($positionInPost != 'manual') {
            if (strpos($positionInPost, $hookName) === 0) {
                // found the position
                $hookParams['user']['xf_bdmedal_awarded_cached'] = @unserialize($hookParams['user']['xf_bdmedal_awarded_cached']);
                $ourTemplate = $template->create('bdmedal_message_medals', $hookParams);
                $rendered = $ourTemplate->render();
           
                // output
                $positionInternal = trim(str_replace($hookName, '', $positionInPost), '_');
                switch ($positionInternal) {
                    case 'top':
                        $contents = $rendered . $contents;
                        break;
                    case 'bottom':
                        $contents .= $rendered;
                        break;
                }
            }
        }
   
        if ($hookName == 'member_view_sidebar_middle1') {
            $ourTemplate = $template->create('bdmedal_member_view_sidebar_middle1', $template->getParams());
            $rendered = $ourTemplate->render();
            $contents .= $rendered;
        }
        elseif ($hookName == 'member_view_tabs_heading') {
            $ourTemplate = $template->create('bdmedal_member_view_tabs_heading', $template->getParams());
            $rendered = $ourTemplate->render();
            $contents .= $rendered;
        }
        elseif ($hookName == 'member_view_tabs_content') {
            $ourTemplate = $template->create('bdmedal_member_view_tabs_content', $template->getParams());
            $rendered = $ourTemplate->render();
            $contents .= $rendered;
        }
        elseif ($hookName == 'navigation_tabs_help') {
            $ourTemplate = $template->create('bdmedal_navigation_tabs_help');
            $rendered = $ourTemplate->render();
            $contents .= $rendered;
        }
  [COLOR=#ff0000]    elseif ($hookName == 'message_content') {[/COLOR]
[COLOR=#ff0000]            $ourTemplate = $template->create('bdmedal_message_medals');[/COLOR]
[COLOR=#ff0000]            $rendered = $ourTemplate->render();[/COLOR]
[COLOR=#ff0000]            $contents .= $rendered;[/COLOR]
        }
    }
}
 
Um why is that color not rendering out . I reported that bug awhile ago but i see you jake using it fine ? I guess look for the color parts ...
 
Another way to do this is select the manual position in the option page and add this in 'message' template (anywhere)

Code:
 <xen:include template="bdmedal_message_medals">
            <xen:map from="$message" to="$user" />
        </xen:include>
 
it's a little bit tricky because of the requiored medal data for the template, but got if finally;)

That's a own add-on, so you don't need to change anything in the orignal bd medal files:)
set the display option to "manual"
I thought I would give this a try and it works but when I click on the medals, it produces an error: 'The requested member could not be found'. Any ideas to fix this? Here's an area of where the medals are showing:
http://sck-mobile.com/community/ind...ine412kid-to-clan-killas®-online-gaming.2026/
 
I thought I would give this a try and it works but when I click on the medals, it produces an error: 'The requested member could not be found'. Any ideas to fix this? Here's an area of where the medals are showing:
http://sck-mobile.com/community/index.php?threads/welcome-sunshine412kid-to-clan-killas®-online-gaming.2026/
i can't see the medals;)

also the postbit looks really strange for guests because you're hidding the data...
foob.webp

BUT wouldn't you need to hide them here => http://sck-mobile.com/community/index.php?forums/welcome-yourselves.6/ too;)

if not, i can see at least, who posted the 1. and last post;)
 
I thought I would give this a try and it works but when I click on the medals, it produces an error: 'The requested member could not be found'. Any ideas to fix this? Here's an area of where the medals are showing:
http://sck-mobile.com/community/index.php?threads/welcome-sunshine412kid-to-clan-killas®-online-gaming.2026/
have you tried it with http://xenforo.com/community/threads/medals-put-in-signature.29110/#post-340758 ???

IMO it doesn't make sense to continue work on an unnecessary add-on, if it's already possible with the original add-on^^:d
 
I'm totally confused now. The link to the add-on you say is already possible, is the link to 'this' page! ;-)
It's a post link. Post #10 of this thread, I quoted below for your viewing:

Another way to do this is select the manual position in the option page and add this in 'message' template (anywhere)

Code:
 <xen:include template="bdmedal_message_medals">
            <xen:map from="$message" to="$user" />
        </xen:include>

He asked if you tried this in the template instead of using his addon.
 
It's a post link. Post #10 of this thread, I quoted below for your viewing:



He asked if you tried this in the template instead of using his addon.
Ok, I understand about putting the code into the 'message' template but the part about "selecting the manual position in the option page" has me confused...
 
Ok, I understand about putting the code into the 'message' template but the part about "selecting the manual position in the option page" has me confused...
In AdminCP > Options > [bd] Medal, you will find the position option. Set it to manual
 
Oh, I see. But I actually wanted to keep them showing in the avatar area 'as well as' above the sigs...;-)
 
Top Bottom