Tips and Tricks HQ Support Portal › Forums › WP PDF Stamper › PDF – Stamper – Begginer Help – Stamping Username
Tagged: pdf stamper, username
- This topic has 9 replies, 3 voices, and was last updated 3 years, 4 months ago by admin.
-
AuthorPosts
-
July 8, 2021 at 4:13 pm #83305gumateraParticipant
I need to stamp USERNAME (current username), but this variable is not available in plugin variables.
I read the article on https://www.tipsandtricks-hq.com/wp-pdf-stamper/pdf-stamper-dynamically-modifying-the-text-to-stamp-data, but I dont have technical skills to change the code and I would appreciate some help with this.
Basically what I need is to change the code shown in article to:
$text_to_stamp .= “Licensed to %current_username% – %current_user_email% by Company.”;
Can you help me?
July 8, 2021 at 4:33 pm #83306wzpModeratorHow is the user name and email address to be provided? From a membership plugin, from WordPress, or from a user form?
July 8, 2021 at 4:39 pm #83308gumateraParticipantFrom WP.
July 8, 2021 at 4:59 pm #83310wzpModeratorDid you look at this WordPress specific option?
July 8, 2021 at 9:16 pm #83312gumateraParticipantThanks for your support!
Yes, I am using the custom button. But I couldn’t find any variable available to stamp the Current-Username.
{Customer name} does not return current-username, right?
What I want is: From the Download Button, a logged-in user will download a PDF file with his username and email displayed in file’s footer in a sentence like “Licensed to gumatera – guma@gmail.com by Company.”
I dont know how to get the current username and use it in the wp filter (article link above) as $text_to_stamp .= “Licensed to %current_username% – %current_user_email% by Company.”;
I mean, I dont know the query to get the current user name and HOW to insert the username and email in this sentence to be displayed…
July 9, 2021 at 11:25 am #83315gumateraParticipantI sent a new reply, but I dont see it here…
July 9, 2021 at 2:34 pm #83317wzpModeratorWhat you are asking for (WP user name) is currently not supported. Much of the PDF Stamper plugin uses obfuscated PHP code; so it may be impossible for you to add a new variable, on your own. You might want to try requesting a custom work order quote; and one of the developers will get back with you.
July 9, 2021 at 4:54 pm #83320adminKeymasterHave a look at this post that shows how you can use an action hook to stamp additional text. If you are a developer, you can use this example to create your own customization that reads the currently logged-in user’s username and adds to the stamping:
FYI, if your post has too many URLs, the forum software may mark it as spam.
July 12, 2021 at 7:36 am #83328gumateraParticipantFind the solution below. Tested and verified!
///////////////////////////////////////
add_filter(‘filter_stamper_text_after_replacing_tags’, ‘customize_text_to_stamp’, 10, 2);
function customize_text_to_stamp ($text_to_stamp, $additional_params)
{$current_user = wp_get_current_user();
// Which you want to dispaly you can set below type
// $current_user->first_name //First Name of login User
// $current_user->last_name //Last Name of login User
// $current_user->display_name // Name of login User
// $current_user->user_email // Email$text_to_stamp .= “Some text here” . $current_user->user_login . “some text here”;
return $text_to_stamp;
}July 12, 2021 at 8:16 pm #83335adminKeymasterThank you for sharing your solution. Looks good to me.
-
AuthorPosts
- You must be logged in to reply to this topic.