Can't set Approved status of media from Velocity script

Former Member
Former Member

I am trying to set media to approved after updating the media in a moderated forum, but the code is not working. Here's the code:

		#if (!$media.IsApproved)
            #set($mediaResponse = $core_v2_media.Update($galleryId, $mediaId, "%{ IsApproved = true }"))
        #end

...or is this a permissions issue, in which case I would need to use an automation as in the one in this post?

Parents Reply
  • Former Member
    0 Former Member in reply to Patrick M.

    Here's the code:

    Velocity script (uploadedit.vm):

    	#if ($mediaId && $mediaId > 0)
    		#set($media = $core_v2_media.Update($galleryId, $mediaId, $options))
            $core_v2_automation.Execute($core_v2_utility.ParseGuid('cc32ab16-bed4-4db0-bcc8-30595f540255'), "%{ GalleryId = '$galleryId', MediaId = '$mediaId' }")
    	#else

    Manual automation:

    #set($galleryId = $core_v2_utility.ParseInt($context_v2_automationTrigger.Arguments.Parameters.Value('GalleryId')))
    #set($mediaId = $core_v2_utility.ParseInt($context_v2_automationTrigger.Arguments.Parameters.Value('MediaId')))
    #set($mediaResponse = $core_v2_media.Update($galleryId, $mediaId, "%{ IsApproved = 'true' }"))

Children