1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Extending Identities privacy settings to message user info and member card

Discussion in 'XenForo Development Discussions' started by Steve F, Oct 28, 2014.

  1. Steve F

    Steve F Well-Known Member

    I see in ViewPublic/Member.php the custom fields function. How can I take this and extend it to my template for my add-on, more specifically the template is used in the message user info and member card to display a users Identity (Gamer Tags) but I need this to abide by a users privacy settings.

    I see this in Member.php
            $customFieldsGrouped $fieldModel->groupUserFields($customFields);
            if (!
    $customFieldsGrouped['contact'] = array();
    Then is set
    'customFieldsGrouped' => $customFieldsGrouped,
    Passed to the template (member_view)
    return $this->responseView('XenForo_ViewPublic_Member_View', 'member_view', $viewParams);
    I can use this on the member_view page easily enough (as it is passed default to member_view) to do what it needs to but I need the same for my template.
    <xen:if is="{$customFieldsGrouped.contact}">
  2. Aayush

    Aayush Well-Known Member

    You can extend the actionCard() method of the XenForo_ControllerPublic_Member class and append the customFieldsGrouped variable to the viewParams and pass it to the member_card template. You can then access the var in the member_card template and display the gamertags accordingly.

    Hope this helps.
    Steve F likes this.
  3. Steve F

    Steve F Well-Known Member

    Thanks, will look at that approach.

    It is kind of confusing me a bit. I need to see if the $visitor is being followed by say a user that has posted, if so then show the identities. Is there a way I can make this global instead of having to append the variable to numerous templates?
  4. Aayush

    Aayush Well-Known Member

    In the member card thing, I remember an isFollowing or something like that is being sent to generate the members card. Maybe you can use that and check if the user is being followed.
    Last edited: Oct 30, 2014
  5. nothingatall

    nothingatall Member

    You ever figure this out?
  6. Steve F

    Steve F Well-Known Member

    This bug report explains a bit. So I'm just using what is available by the core identities settings.

    Using the below code in my templates.
    <xen:if is="({$user.allow_view_identities} == 'everyone' OR ({$user.allow_view_identities} == 'members' AND {$visitor.user_id}))"> 
    Content Here
    nothingatall likes this.

Share This Page