• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
VdoCipher: Secure Video Hosting for BusinessVdoCipher
☰
Sign Up
  • Solutions
    • E-learning
    • Enterprise
    • Developer
    • Healthcare
    • Live Streaming
  • Features
  • Pricing
    • Video Hosting & DRM Solution
    • Live Streaming Solution
  • Live
  • Developer
  • About
    • Testimonials
    • The Company
  • Contact
Login
Sign Up

Custom variables as watermark on WordPress videos

January 6, 2023 /

Please visit Add Text to Videos with Watermark for a detailed introduction to adding a watermark to your videos. This particular blog explains what is going on under the hood of the WP plugin, and is useful only if you are adding your own custom-built variables as part of the watermark. Currently, name, IP, and email can be shown as part of the watermark.

Table Of Contents:

  • Default WordPress fields that can be added
  • Custom filter addition to the WordPress hook
  • JSON Code addition to the VdoCipher WordPress Plugin
  • Example Steps to configure custom field “Phone number” as a watermark

Watermark on videos adds extra security for the video from screen capture by adding variables such as email, IP or date information to the videos. Custom variables are now supported in plugin 1.6

Default WordPress fields that can be added

Our plugin has been configured to replace the following strings in the annotation code by default:

  • {name} – Current User display name
  • {email} – Current User email
  • {username} – Current User Login
  • {id} – Current User ID

Till version 1.5 of our WordPress video hosting plugin, watermark on videos could only have a limited number of dynamic variables. With version 1.6, we have now added filter hooks on the annotation code to enable other plugins or themes to change the annotation code.

Custom filter addition to the WordPress hook

You can now add a custom filter to the hook `vdocipher_annotate_preprocess` . Example code for adding custom filter is:

function customfunc($vdo_annotate_code){
 $customVariable = "Hello world";
 $vdo_annotate_code = str_replace('{var1}', $customVariable, $vdo_annotate_code);
 return $vdo_annotate_code;
}

add_filter('vdocipher_annotate_preprocess', 'customfunc');

Display WordPress Default field like User Fullname

An example code to display the full name is as follows:

function customvdofunc($vdo_annotate_code){
    $fullname = "";
    if (is_user_logged_in()) {
        $current_user = wp_get_current_user();
        $firstname = $current_user->user_firstname;
        $lastname = $current_user->user_lastname;
        $fullname = $firstname . " " . $lastname;
     }
     $vdo_annotate_code = str_replace('{fullname}', $fullname, $vdo_annotate_code);
     return $vdo_annotate_code;
}
add_filter('vdocipher_annotate_preprocess', 'customvdofunc');

This would replace the string ‘{fullname}’ in the watermark code to the fullname of the logged in user.

JSON Code addition to the VdoCipher WordPress Plugin

The above code enables you to replace the token {var1} with the value of $customVariable. You can then use an annotation code like:

[
{'type':'rtext', 'text':'Your IP : {ip}', 'alpha':'0.8', 'color':'0xFF0000','size':'12','interval':'5000'},
{'type':'text', 'text':'{var1}', 'alpha':'0.5' , 'x':'150', 'y':'100', 'color':'0xFF0000', 'size':'12'}
]

This code on going through the above filter will become

[
{'type':'rtext', 'text':'Your IP : {ip}', 'alpha':'0.8', 'color':'0xFF0000','size':'12','interval':'5000'},
{'type':'text', 'text':'Hello world', 'alpha':'0.5' , 'x':'150', 'y':'100', 'color':'0xFF0000', 'size':'12'}
]

This function can be placed in the functions.php file in your theme. It is recommended to create a child theme before making such edits.

Example Steps to configure custom field “Phone number” as a watermark

You can configure user-specific details like “phone numbers” as a watermark using the VdoCipher WordPress video plugin annotation field and add_filter function in the functions file. shortcode embedded in WordPress.

Note: This phone number is a Custom Field created for illustration using a  plugin named “Advanced Custom Fields” and the name for this custom field is phone_number. You might not need to configure such custom fields, your membership plugin that you might be using would already have such custom field addition functionality. The phone number addition of a user on their profile needs to be managed and taken care of from your WordPress setup side. Your WordPress developers can check and implement it. For this example, the sample WordPress viewer playing the video has the phone number  887788778877 on his profile.

custom variables like phone number addition in wordpress user profile

custom field phone number addition via plugin

Below is a code demonstrating the usage of a sample function for displaying the saved phone number as a watermark and plugin setup.

Additions in functions.php WordPress file

  1. Login to your WordPress account having theme editor access.
  2. Open functions.php through Appearance>Theme File Editor or Tools>Theme File Editor
  3. Add given below custom PHP function in the functions.php file and save the file.
function customvdofunc($vdo_annotate_code){
   $Phonenumber = "";
   if (is_user_logged_in()) {
       $current_user = wp_get_current_user();
       $PNO = $current_user->phone_number;
          }
    $vdo_annotate_code = str_replace('{Phonenumber}', $PNO, $vdo_annotate_code);
    return $vdo_annotate_code;
}
add_filter('vdocipher_annotate_preprocess', 'customvdofunc');

Additions in functions php WordPress file

Adding JSON to the VdoCipher WordPress Plugin field

You need to add the following JSON code in the plugin settings to call the custom function and display the viewer’s phone number as a watermark.


[{"type":"rtext", "text":"{Phonenumber}", "alpha":"0.90","color":"#FFFF00","size":"12","interval":"5000","skip":5000}]

Adding JSON to the VdoCipher WordPress Plugin field

On playback of the videos, the watermark will show the phone number of the viewer playing the video. Similarly, you can call other custom or WordPress data fields via functions.php and display the same by adding more lines of JSON code in the VdoCipher plugin field.

watermark showing the phone number of the viewer playing the video

Supercharge Your Business with Videos

At VdoCipher we maintain the strongest content protection for videos. We also deliver the best viewer experience with brand friendly customisations. We'd love to hear from you, and help boost your video streaming business.

Free 30-day trial →
Decorative Circle

Filed Under: Technology Using VdoCipher Watermark WordPress Tagged With: custom watermark video wordpress secure streaming wordpress watermark

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Secure Your Videos

Blog Categories

  • DRM 
  • APIs and Sample Codes
  • WordPress
  • E-learning
  • Media
  • Video Tech

Popular Posts

  • Google Widevine DRM
  • WordPress video plugin
  • Video Quality
  • Dynamic Watermarking
  • Encrypted Video Streaming
  • Video Hosting For Online Courses
  • Online Video Player
  • Apple Fairplay DRM
  • SVOD VS TVOD VS AVOD
  • Exoplayer
  • DRM

Top Recent Posts

  • Enterprise Video Platform
  • Cloud Video Platform
  • Video Player for Android
  • DRM Solution
  • Video Bitrate
  • React Native Video
  • Video Piracy
  • Learning Management System
  • AVPlayer
  • Live Streaming Websites
  • DRM Providers
  • DRM Security
  • Private Video Hosting
  • HTML5 Video Player

Schedule Demo Link
Popular Blogs
  • How many use easy video download piracy tools ?
  • Apple FairPlay DRM : Video Protection on iOS & Safari
  • 12 Video Piracy Statistics, 6 Prevention Methods
  • Elearning Video Protection from Piracy
  • Content Creator Economy Growth and other Statistics Report
  • Top 21 Education Apps In India For Online Learning
  • How To Embed Videos in WordPress A Comprehensive Guide
  • Live Streaming Platform For E-learning Media & Broadcast
  • Explained in Simple Language, 32 Key DRM Encryption Terminologies
  • Best Video Player for Android Comparison 2024
Recent Blogs
  • How to Build a Flutter Live Streaming Application?
  • How To Prevent Video Download From Your Website?
  • DRM Server Solutions with Widevine License and Apple FairPlay
  • Top 12 Live Streaming Platforms: All You Need To Know in 2025
  • Best DRM Tools to protect your Videos & other Digital Assets
  • Best Video Frame Rate or FPS for Cinematic Movies, 4K, YouTube & Instagram
  • Top DRM Products Overview as Software Service and Hardware
  • 15+ Best Study Apps For Students In 2025
Featured Blogs
  • Online Video Player
  • Video Encryption
  • Video Protection
  • Video Hosting
  • Widevine DRM
  • Fairplay DRM
  • Video Quality
  • Online Video Platform
  • Video hosting for business
Comparison
  • VdoCipher vs Vimeo
  • VdoCipher vs Dacast
  • VdoCipher vs YouTube
  • VdoCipher vs Zoom
  • VdoCipher vs JW Player
  • VdoCipher vs Dacast Live
    Contact Us
  • Phone : +91 7619171878
  • Whatsapp : +91 7042238654
  • E-mail : support@vdocipher.com
Company
  • Home
  • Glossary
  • Features
  • About Us
  • Pricing
  • FAQs
  • Contact
Services
  • Enterprise
  • E-Learning
  • Developer
  • Healthcare
  • Live Streaming Platform
  • Video Analytics
  • Media and Entertainment
  • DRM and Antipiracy
  • APIs for Developers
  • Video Hosting
  • Video API
  • Video DRM
  • Google DRM
  • DRM License Server
  • Custom Video Player
  • Play Integrity
Countries Served
  • Secure Video Hosting in USA
  • Secure Video Hosting in India
  • Secure Video Player in Brazil
  • Secure Video Streaming in UK
  • Secure Video Streaming in Saudi Arabia
  • Video Encryption in Spain
  • Video Encryption in Italy
  • Protected Video Streaming in Indonesia
  • Encrypted Video Player in Canada
  • Protected Video Streaming in Australia
  • Encrypted Video Player in Germany
  • Video DRM for Sri Lanka
  • Video DRM for Middle East
  • DRM Encryption for Europe
  • DRM Encryption for Asia
  • DRM Solutions for Japan
  • DRM Solutions for UAE
  • DRM Software for Chile
  • DRM Software for Russia

Copyright © 2025 VdoCipher. All rights reserved.

  • Terms
  • Privacy Policy