XF 2.0 Get parent node_id when the content type is post ( alert )

aana

Active member
hello,

how can i get parent node_id into the $alert variable when the content type is post ( account_alerts_popup ) ?

Did someone know ?

thanks.
 
Assuming you're talking about within the template, $content is the post itself, and thus $content.Thread would be the thread. Therefore, $content.Thread.node_id would be the node the post is in.
 
thanks,
i am speaking about the account_alerts_popup template.

When i dump the $alert variable :

HTML:
"alert_id" => 1856393
    "alerted_user_id" => 1
    "user_id" => 26705
    "username" => "test"
    "content_type" => "post"
    "content_id" => 1405794
    "action" => "insert"
    "event_date" => 1547642014
    "view_date" => 1547642017
    "extra_data" => "a:0:{}"
    "depends_on_addon_id" => ""

I am trying to get the parent node_id of this post, my goal is to change the alert if the topic is on node_id xx.

By exemple :
if the new response is on a topic from the node id = 1
i want to hide the username / avatar of the poster on the alert.
 
Last edited:
For alerts.

In account_alerts_popup AND account_alerts :
HTML:
<xf:if is="$alert->***->Thread->node_id == nodeId AND (!$xf.visitor.is_admin OR !$xf.visitor.is_moderator)">
       <xf:macro template="alert_macros" name="row" arg-alert="{$alert}" arg-ano="1"/>
<xf:else />
        <xf:macro template="alert_macros" name="row" arg-alert="{$alert}" arg-ano="0" />
</xf:if>


In alert_macros :
HTML:
<xf:macro name="row" arg-alert="!" arg-ano="0">

And:
HTML:
<xf:if is="$ano == 0">
    <xf:avatar user="$alert.User" size="xxs" defaultname="{$alert.username}" />
<xf:else />
     <xf:set var="$alert.user_id" value="userId" />
      <xf:avatar user="$alert.User" size="xxs" defaultname="userName" />
</xf:if>


Removing quote option.
In post_macros :
HTML:
<xf:if is="$thread.canReply() AND $thread.node_id != nodeId">
 
Last edited:
Top Bottom