PDA

View Full Version : working on a new template modification - need help


scottkoz20
03-03-2018, 06:42 PM
I am working on modification that will allow members to link their Facebook Messenger Account to their user profile. I already have the postbit and profile fields set, that was not much of a lift. However, when I try to add information to the memberaction_dropdown, I can't get this to link right

Postbit - Works
<vb:if condition="$post['fieldxx']"><a href="https://m.me/{vb:raw post.fieldxx}" target="_blank"><img src="images/postbit_social/messenger.png" alt="Contact {vb:raw post.fieldxx} on Messenger" border="" /></a></vb:if>

Member Dropdown - partial works (does not link to the user to message - bold is not working)
<li class="left">
<a href="https://m.me/{vb:raw post.fieldxx}" target="_blank" class="siteicon_profile">
Contact me on Messenger
</a>
</li>



Thoughts?


Thanks,
Scott

MarkFL
03-03-2018, 06:54 PM
Try this:

<li class="left">
<a href="https://m.me/{vb:raw memberinfo.fieldxx}" target="_blank" class="siteicon_profile">
Contact me on Messenger
</a>
</li>

scottkoz20
03-03-2018, 07:03 PM
that worked... now, I need to make this an if based on the post field

Thanks Mark!

MarkFL
03-03-2018, 07:23 PM
I would recommend doing this with a plugin rather than hacking your templates. Create a plugin hooked at "memberaction_dropdown" with the PHP code:

if ($memberinfo['fieldxx'])
{
$template_hook['memberaction_dropdown_items'] .= '<li class="left">
<a href="https://m.me/' . $memberinfo['fieldxx'] . '" target="_blank" class="siteicon_profile">
Contact me on Messenger
</a>
</li>';
}

scottkoz20
03-03-2018, 07:32 PM
I have a number of hacks already added to the memberaction_dropdown from the past leadership of the site I run now :)

I probably should look at adding them all as plug-ins at some point. :)

when I write-up the modificaiton, can I add the plug-in to the details (with you as a co-author)?

MarkFL
03-03-2018, 07:35 PM
Sure, anything I post as a suggestion in a thread can be used freely. While I appreciate the citation as co-author, it's not necessary. :)

scottkoz20
03-03-2018, 10:04 PM
published


https://vborg.vbsupport.ru/showthread.php?t=326172