Flarum (v1.7.1)
    Preparing search index...
    • Fetches the mention text for a specified user (and optionally a post ID for replies, or group).

      Automatically determines which mention syntax to be used based on the option in the admin dashboard. Also performs display name clean-up automatically.

      Parameters

      • user: any
      • postId: any
      • group: any

      Returns string

      // '@"User"#1'
      getMentionText(User) // User is ID 1, display name is 'User'
      // '@"User"#p13'
      getMentionText(User, 13) // User display name is 'User', post ID is 13
      // '@username'
      getMentionText(User) // User's username is 'username'
      // '@"Mods"#g4'
      getMentionText(undefined, undefined, group) // Group display name is 'Mods', group ID is 4