PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Merge Tag - Add Multisite Site Name

  1. I'm trying to add the MU Site Name to Merge Tags drop down.

    I found the "Gform merge tags" documentation and using that, I added to functions.php

    snippet:

    gform.addFilter("gform_merge_tags", "add_merge_tags");
    	function add_merge_tags(mergeTags, elementId, hideAllFields, excludeFieldTypes, isPrepop, option){
    		mergeTags["custom"].tags.push({ tag: '{site_name}', label: 'Site Name' });
    
    		return mergeTags;

    I now see the custom merge tag: "Site Name" in the Merge Tag dropdown but don't see how to assign that tag to the actual site name. I can get the site name using:

    //get MU site name
    		global $blog_id;
    		$local_site_name = get_blog_details( array( 'blog_id' => $blog_id ) );

    I'm thinking that the above just adds the tag to the list but somewhere else the content gets assigned to the tag label. ( The docs could be a bit clearer on this subject! )

    Any help would be appreciated!

    Posted 11 years ago on Saturday April 27, 2013 | Permalink
  2. Darn! Is there one easy way to add a new merge tag? This is certainly not intuitive!

    Posted 11 years ago on Sunday April 28, 2013 | Permalink
  3. I found this: http://www.gravityhelp.com/documentation/page/Gform_merge_tags

    Again, this seems to only show how to add the tag to the merge tag list but not how to assign content to the tag.

    is there another example somewhere that shows this?

    Posted 11 years ago on Monday April 29, 2013 | Permalink
  4. Tried adding the tag and get error when viewing Entry:

    script type="text/javascript">
    	gform.addFilter("gform_merge_tags", "add_merge_tags");
    
    	function add_merge_tags(mergeTags, elementId, hideAllFields, excludeFieldTypes, isPrepop, option){
    		mergeTags["custom"].tags.push({ tag: '{site_name}', label: 'Site Name' });
    
    		return mergeTags;
    	}
    </script>

    I get error:

    Uncaught ReferenceError: gform is not defined

    Just after the first gform...

    Posted 11 years ago on Monday April 29, 2013 | Permalink
  5. Still have not found a solution. Anyone have ideas?

    Posted 11 years ago on Wednesday May 1, 2013 | Permalink
  6. Ron, we've asked the development team for their input on this for you. Hang tight.

    Posted 11 years ago on Thursday May 2, 2013 | Permalink
  7. Awesome, thanks Chris!

    Posted 11 years ago on Thursday May 2, 2013 | Permalink
  8. David Peralty

    Have a look at this for more information - http://www.gravityhelp.com/documentation/page/Gform_replace_merge_tags

    Posted 11 years ago on Friday May 3, 2013 | Permalink
  9. I'll give that a try. Thanks.

    Posted 11 years ago on Friday May 3, 2013 | Permalink
  10. It appears to be working... thanks!

    Posted 11 years ago on Friday May 3, 2013 | Permalink