2 Replies Latest reply on Jan 27, 2016 3:08 PM by meta.000

    Using mention functionality with code.


      I am wondering how do i use the mention functionality using code. Our previous developer used  jiveDoc.tags = ["text"]; for tags. I was wondering if there is a way to something similar for mention functionality as well ?


      We are trying to edit an existing script to mention places and people as well. Right now it only adds tags to the post.


      Thank you!

        • Re: Using mention functionality with code.
          Scott A Johnson

          Hi Usman,


          User mentions are handled by a macro, which is inserted as an anchor element in the content. You could insert the macro anchor element programmatically. You'd have to know the data use for a few macro parameters to do so.


          Here's an example of what the macro anchor element looks like:


          <a class="jive-link-profile-small jive_macro jive_macro_user" href="javascript:;" jivemacro="user" 
          data-id="[the-user-id-to-mention]" data-type="person" data-objecttype="3" 
          ___default_attr="[the-user-id-to-mention]" data-orig-content="Scott Johnson" data-renderedposition="10_8_111_16">Scott Johnson</a>


          The data-id and __default_attr attributes would be the user's id, data-type and data-objecttype will always be person and 3 (Jive's code for the User object type), data-orig-content I believe should match the link text, which is usually the user's name or username.

          The data-renderedposition looks like coordinates within the rendered content, but it doesnt appear to have any affect on the actual output.


          Hope this helps,


            • Re: Using mention functionality with code.

              Hi Scott,


              Thank you for sharing that solution. The problem is that the user or place is not static, they change with the user input and that is causing the issues. I should've clarified the problem a little. The above problem is a part of a form where the inputs is the name of the user that is to be tagged and when the form is submitted they automatically get tagged in the post.


              Thank you for any help you can offer.