Announcement

Collapse
No announcement yet.

Link to Edit Signature for your own posts

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Link to Edit Signature for your own posts

    In looking over the vb5 templates I can see there's ways of isolating things to specific users/groups. I'm not quite able to figure out how to do what I want to do though, and hope you might have an idea.

    What I essentially want to do is setup a custom template for an Edit Signature Link. I'd have this template display via a hook on the toolbar below the poster's signature. I don't want it to appear on every post though, just on your own posts.

    Is this difficult to do?

    #2
    Do you want to be able to edit the signature inline inside your posts? Or just add a link to the User Settings > Account page where they edit their signature?

    Comment


      #3
      Doing it inline would be really nice, but I think that would go beyond the scope of a simple template mod. If that's possible though, then definitely inline.

      Comment


        #4
        Doing it inline would be difficult as you would have to add another instance of CKEditor.

        Comment


          #5
          I'd be happy with just taking the user to their account settings and opening the editor there.

          there's a vb:url function, though I can't find a list of valid variables for it.

          Comment


            #6
            You can just make the url relative without the base url.

            Or use this vb template code for the baseurl:
            Code:
            ​​​​​{vb:raw baseurl}

            Comment


              #7
              Code:
              {vb:raw baseurl}/settings/account
              That will get me to the settings page, but still not having any luck limiting the link to one's own posts. Then there's also opening the editor once on the settings page. I'm going to have to step away from this for a bit I think. Going crosseyed trying to pour through vague documentation.

              Comment


                #8
                Are you using conversation_footerleft or conversation_footerright hook location?

                Try this:

                Code:
                <vb:if condition="$user['userid'] == $conversation['userid'] AND $vboptions['allow_signatures'] AND $user['showsignatures']">
                    <a href="{vb:raw baseurl}/settings/account">Edit Signature</a>
                </vb:if>
                You will have to add this in the Hook Arguments field to make the $conversation object available to the template used by your hook.
                Code:
                conversation=conversation
                You can display debug info to see what properties are available in the $user and $conversation objects.

                Code:
                {vb:debugvardump user}
                {vb:debugvardump conversation}
                If you want to have the Edit Post Signature popup appears when you link from the Edit link, then you can pass a querystring.

                Code:
                ​​​​​​<a href="{vb:raw baseurl}/settings/account?mode=edit-signature">Edit Signature</a>
                Then add another template hook (at settings_account hook location) that checks if that querystring parameter exists. If it does, then trigger a click event to the Edit Post Signature link which has a css class of js-signature__edit.

                Code:
                document.querySelector('.js-signature__edit').click();

                Comment


                  #9
                  To check for the passed querystring from a template:

                  Code:
                  <vb:if condition="isset($_GET['mode']) AND $_GET['mode']=='edit-signature'">
                      trigger click here using javascript
                  </vb:if>

                  Comment


                    #10
                    Btw, I moved this topic to a more appropriate forum channel.

                    Comment


                      #11
                      I had gotten the template hook options setup and the link to display on my own. It was similar to the custom fields in how that worked, but I used the footerleft hook. I'm going to give your suggestions a try in a bit and your paypal a click in a day or two.

                      Comment


                        #12
                        You have to also make sure you have a check if signature is not globally disabled and if user has not opted to hide his signature before displaying edit signature link. I have that check in my suggested code.

                        Comment


                          #13
                          Looks like that's almost working. The click event triggers but goes back to the home page instead of opening the editor. Strange.

                          Comment


                            #14
                            No Javascript error?

                            When you are on the User Settings > Account page and you open Chrome dev tools and paste the trigger code to the console, does it open the Edit Signature popup modal? Just making sure the trigger code works by itself.

                            Comment


                              #15
                              Pasting into a console does work, but loading it through a <script> call takes me to the homepage. Couldn't see any JS errors. Some mixed content warnings and an image or two I need to relink, but no JS error.

                              Comment

                              Working...
                              X