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

How can I check if I am at a member profile.

Discussion in 'XenForo Development Discussions' started by Vincent, Apr 3, 2011.

  1. Vincent

    Vincent Well-Known Member

    I'm almost done with my add-on, but I need one more thing,

    I need to know how to check if the visitor is on a profile of a user.

    How do I do this? :S
     
  2. Tilkißey

    Tilkißey Well-Known Member

    use this if condition in your template
    HTML:
    <xen:if is="{$controllerName} == 'XenForo_ControllerPublic_Member' ">your codes</xen:if>
    another way

    if you use this way, you can fetch all users which are viewing a member's profile
    in database
    xf_session_activity table
    controller_name = XenForo_ControllerPublic_Member
    controller_action = Member
    params = user_id=X

    controller action is defined for actions, so, u can also check controller_name is equal or not to XenForo_ControllerPublic_Member
     
  3. Kier

    Kier XenForo Developer Staff Member

    In PHP or a template? And from where?
     
  4. Vincent

    Vincent Well-Known Member

    Template.
    In sidebar_share_page I need to do the check if the page is on the member list or not.
     
  5. Kier

    Kier XenForo Developer Staff Member

    <xen:if is="{$controllerName} == 'XenForo_ControllerPublic_Member' AND {$controllerAction} == 'Member'">... your stuff here... </xen:if>
     
    Vincent likes this.

Share This Page