Add author name in ...
 
Notifications
Clear all

[Solved] Add author name in Twitter Share content

7 Posts
2 Users
0 Reactions
1,119 Views
(@angelochiacchio)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

Hello, 
is there a way to add the name of the author when sharing a comment?
I imagine this is done in class.WpdiscuzHelper.php but I can crack it to work.

Thank you,

Angelo


   
Quote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6152
 

Hi @angelochiacchio,

Please try the following code:

add_filter('wpdiscuz_comment_end', function ($commentOutput, $comment){
$commentOutput = preg_replace('~(<a class="wc_tw"[^>]+href=[\'\"]+[^\'\"]+)(&url[^\'\"]+[\'\"]+)~is', '$1' . urlencode(' author:' . $comment->comment_author) . '$2', $commentOutput);
return $commentOutput;
}, 10, 2);

Put the code in the active theme functions.php file. 


   
ReplyQuote
(@angelochiacchio)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

Thanks guys. Works great.

One last thing. If I tweet the comment I get a ’ instead of a simple '. Is thi sa common issue?


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6152
 

@angelochiacchio,

Could you please provide us the twitter link where you see such an issue? 


   
ReplyQuote
(@angelochiacchio)
Active Member
Joined: 5 years ago
Posts: 11

   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6152
 

ok @angelochiacchio,

this will be fixed in the next update. 


   
ReplyQuote
(@angelochiacchio)
Active Member
Joined: 5 years ago
Posts: 11
Topic starter  

Ok. Looking forward then 🙂


   
ReplyQuote
Share:
Scroll to top