Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
VectorPlexus Posted May 13, 2018 Posted May 13, 2018 I'm trying to edit some templates using hooks, so I can change how the name of a member gets displayed, if he is in a certain group, so I'm using in a fair amount of templates, successfully, something like this: {{if $row->inGroup( $group = \IPS\app\Whatever::getGroup() }} Whatever {{else}} Actual primary group {{endif}} However, there is this specific template, with which I've been at it for hours now, and can't have it working: \applications\core\dev\html\front\widgets\activeUsers.phtml div.ipsWidget_inner.ipsPad > ul.ipsList_inline.ipsList_csv.ipsList_noSpacing.ipsType_normal as soon as I use something to "search" (inGroup(), in_array(), search_in_array(), etc) it borks that page and it seems to get in a loop (error 500/memory issue) I have absolutely no idea how to go around this... Thanks in advance! EDIT: I feel like this is an escaping issue, I already had to change some of the quotes in the URL that exists there, because it was having the same effect
newbie LAC Posted May 14, 2018 Posted May 14, 2018 12 hours ago, Herlander Carvalho said: div.ipsWidget_inner.ipsPad > ul.ipsList_inline.ipsList_csv.ipsList_noSpacing.ipsType_normal $row inside foreach loop In your case $row outside <ul class='ipsList_inline ipsList_csv ipsList_noSpacing ipsType_normal'> {{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members' ) ) }} {{foreach $members as $row}} <li> 12 hours ago, Herlander Carvalho said: However, there is this specific template, with which I've been at it for hours now, and can't have it working: In that template $row is an array not object
VectorPlexus Posted May 14, 2018 Author Posted May 14, 2018 13 hours ago, opentype said: You should provide the complete code. You are absolutely right, but I wasn't sure what to post since it's an edit of a default template, and I was really fed up with the amount of time I spent trying to fix this issue 1 hour ago, newbie LAC said: in that template $row is an array not object As soon as I read this I knew that was the problem, and fixed it, duh! Thank you you so very much for your help!!! but I still have the URL not being properly parsed though. This is just an exact copy of what the template has: <a href="{url="app=core&module=members&controller=profile&id={$row['member_id']}" seoTemplate="profile" seoTitle="$row['seo_name']"}" data-ipshover="" data-ipshover-target=""> If I use it exactly like that, server hangs... when I try different solutions to avoid the quotes hell, I may get something "closer " to the expected result but $row['member_id'] is always returning value 1? puzzled... EDIT: Here's the full edit code for reference, its using replacing btw: <ul class="ipsList_inline ipsList_csv ipsList_noSpacing ipsType_normal"> {{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members' ) ) }} {{foreach $members as $row}} <li> <a href="{url="app=core&module=members&controller=profile&id={$row['member_id']}" seoTemplate="profile" seoTitle="$row['seo_name']"}" data-ipshover="" data-ipshover-target=""> {{if \IPS\Member::load( $row['member_id'] )->inGroup( $patronsGroup = \IPS\patreon\Login::getPatronsGroup() ) }} {expression="\IPS\Member\Group::load( $patronsGroup )->formatName( $row['member_name'] )" raw="true"} {{else}} {expression="\IPS\Member\Group::load( $row['member_group'] )->formatName( $row['member_name'] )" raw="true"} {{endif}} </a> </li> {{endforeach}} {{else}} {{foreach $members as $row}} <li> {{if $row['in_editor']}} <i class="fa fa-circle-o-notch fa-spin" data-ipstooltip="" data-ipstooltip-label="{lang="block_user_in_editor"}"> </i> {{endif}} {expression="\IPS\Member\Group::load( $row['member_group'] )->formatName( $row['member_name'] )" raw="true"} </li> {{endforeach}} {{endelse}} {{endif}} </ul>
newbie LAC Posted May 14, 2018 Posted May 14, 2018 You load member so you can use it {{$member = \IPS\Member::load( $row['member_id'] );}} <a href="{$member->url()}" data-ipshover="" data-ipshover-target=""> instead of <a href="{url="app=core&module=members&controller=profile&id={$row['member_id']}" seoTemplate="profile" seoTitle="$row['seo_name']"}" data-ipshover="" data-ipshover-target="">
VectorPlexus Posted May 15, 2018 Author Posted May 15, 2018 Thank you again for your help @newbie LAC The hover thingy wasn't working but I managed to edit your suggestion to do so: <a href="{$member->url()}" data-ipshover="" data-ipshover-target="{$member->url()->setQueryString( 'do', 'hovercard' )}">
Recommended Posts
Archived
This topic is now archived and is closed to further replies.