Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I would like to edit the additional content for specific WooCommerce emails. Is there any hook filter to do this?
I have just managed to change the Heading text with a filter woocommerce_email_heading_customer_completed_order.
I would also like to do this for the additional content.
You can use the 'woocommerce_email_additional_content_' . $this->id.
Here you find a complete list of email ids.
So in your case:
woocommerce_email_additional_content_customer_refunded_order for full refund
woocommerce_email_additional_content_customer_partially_refunded_order for partial refund
Try this:
// edit the additional content of the "Refunded order" email
add_filter( 'woocommerce_email_additional_content_customer_refunded_order', 'custom_additional_content_customer_refunded_order', 99, 3 );
add_filter( 'woocommerce_email_additional_content_customer_partially_refunded_order', 'custom_additional_content_customer_refunded_order', 99, 3 );
function custom_additional_content_customer_refunded_order( $content, $object, $email ) {
$content = 'Your personalized additional content';
return $content;
}
The code has been tested and works. Add it to your active theme's functions.php.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I would like to know how can I remove token in form POST method because when I need between 10 and 15 min to fill a form and when I send it, I receive a token exception and I lost all my data.
Thank's for help
I wouldn't recommend removing the token. Instead increase the expiry time or after post redirect back with input values.
public function render($request, Exception $e)
{
if ($e instanceof \Illuminate\Session\TokenMismatchException) {
return redirect()->back()->withInput()->with('token', csrf_token());
}
return parent::render($request, $e);
}
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I am trying to implement a login with Facebook - thus far all is working, apart from the $user data I am being returned does not include the username (which I know does exist).
The array I am being returned is the following (with details purged):
Array ( [id] => ################ [email] => #.##############.co.uk [first_name] => ######## [gender] => male [last_name] => ######## [link] => https://www.facebook.com/app_scoped_user_id/################/ [locale] => en_GB [name] => ######## ######## [timezone] => 1 [updated_time] => 2014-05-06T21:23:33+0000 [verified] => 1 )
Has anyone had experience of this before?
The username field was removed in version 2.0 of the graph API. I'm not aware of any workaround (short of using version 1.0).
This change is listed in the "Removed Endpoints" section of the upgrade guide. You can also see that the "User" reference contains no mention of a username field for version 2.0, but does for version 1.0.
Not all fields are available through the API. You can see exactly what fields are available using the references I've provided above.
Looks like a Facebook Graph API bug.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
In Microsoft Azure website, how can we send email using SendGrid?
You need to get SendGrid UserId & Key from Azure, and then use below code to send email:
public void SendEmail(string emailTo, string emailSubject, string emailBody)
{
try
{
//Create the email object first, then add the properties.
SendGrid myMessage = SendGrid.GetInstance();
myMessage.AddTo(emailTo);
myMessage.From = new MailAddress("abc#xyz.com", "Abc Xyz");
myMessage.Subject = emailSubject;
myMessage.Text = emailBody;
// Create credentials, specifying your user name and password. (Use SendGrid UserId & Password
var credentials = new NetworkCredential("azure_xxxxxxxxxxxxxxx#azure.com", "xxxxxxxxxxxx");
// Create an Web transport for sending email.
var transportWeb = Web.GetInstance(credentials);
//Send the email.
transportWeb.DeliverAsync(myMessage);
}
catch (Exception ex)
{
string msg = ex.Message;
}
}
More more info you can refer following link http://sendgrid.com/docs/Code_Examples/csharp.html
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Ok what i am looking for here is to do the following.
Login in to the remote server.
Execute a few cmds.
Interaction such as yes/no to generate keys.
CPAN Documentation is a Good Resource
As I discussed with you earlier in perl chat, this module is well documented on CPAN. Using some of the examples from there...
To configure Net::SSH::Expect for your server:
my $ssh = Net::SSH::Expect->new (
host => "myserver.com",
password=> 'pass87word',
user => 'bnegrao',
raw_pty => 1
);
To log in using password:
my $login_output = $ssh->login();
if ($login_output !~ /Welcome/) {
die "Login has failed. Login output was $login_output";
}
To run commands:
my $ls = $ssh->exec("ls -l /");
print($ls);
my $who = $ssh->exec("who");
print ($who);
To close connection:
$ssh->close();
You should really ask if you have more specific questions, as just asking for examples isn't really going to help you in accomplishing your task. The documentation is also very complete, so you should check there.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
What's the best way to markup methods/URLs for a RESTful webservice using ReST/Sphinx? Is there a default domain that's suitable for marking up URLs with their possible parameters, HTTP methods, headers and body content?
Something along the lines of:
.. rest:method:: GET /api/foo
:param bar: A valid bar
:extension: json or xml
Retrieve foos for the given parameters. E.g.::
GET /api/foo.json?bar=baz
Does something like this already exist or is one of the default extensions usable, or will I have to write one myself?
The Sphinx Contrib project also seems to have an HTTP Domain package for documenting RESTful HTTP APIs. You can find its documentation on the Python packages site. I can't speak to its fitness: I'm only just starting to look into Sphinx, and I have a need to document RESTful APIs as well, and noticed this contributed package.
Since there doesn't appear to be any existing solution, I have implemented a very simple HTTP domain that I can use to mark up API methods:
import re
from docutils import nodes
from sphinx import addnodes
from sphinx.locale import l_, _
from sphinx.domains import Domain, ObjType
from sphinx.directives import ObjectDescription
http_method_sig_re = re.compile(r'^(GET|POST|PUT|DELETE)?\s?(\S+)(.*)$')
class HTTPMethod(ObjectDescription):
def handle_signature(self, sig, signode):
m = http_method_sig_re.match(sig)
if m is None:
raise ValueError
verb, url, query = m.groups()
if verb is None:
verb = 'GET'
signode += addnodes.desc_addname(verb, verb)
signode += addnodes.desc_name(url, url)
if query:
params = query.strip().split()
for param in params:
signode += addnodes.desc_optional(param, param)
return url
class HTTPDomain(Domain):
"""HTTP language domain."""
name = 'http'
label = 'HTTP'
object_types = {
'method': ObjType(l_('method'), 'method')
}
directives = {
'method': HTTPMethod
}
def setup(app):
app.add_domain(HTTPDomain)
It allows me to mark up methods like this and they'll be styled somewhat visually nicely:
.. http:method:: GET /api/foo/bar/:id/:slug
:param id: An id
:param slug: A slug
Retrieve list of foobars matching given id.
This was my first foray into both Sphinx and Python, so this should be considered very rudimentary code. If anybody is interested in fleshing this out, please fork this project on Github!