I am using joomla's default login module. In forgot module section, I have added one more column called username. Now how shall I send this username along with the token id in the mail?
Please help me.
Thanks in advance.
Open the following folder:
root/components/com_user/models/reset.php
Joomla 2.5
Lines 383 to 388, change this:
$body = JText::sprintf(
'COM_USERS_EMAIL_PASSWORD_RESET_BODY',
$data['sitename'],
$data['token'],
$data['link_text']
);
to this:
$body = JText::sprintf(
'COM_USERS_EMAIL_PASSWORD_RESET_BODY',
$data['fromname'], //added data type to get the username
$data['sitename'],
$data['token'],
$data['link_text']
);
Joomla 1.5
On line 256, change this:
$body = JText::sprintf('PASSWORD_RESET_CONFIRMATION_EMAIL_TEXT', $sitename, $token, $url);
to this:
$body = JText::sprintf('PASSWORD_RESET_CONFIRMATION_EMAIL_TEXT', $sitename, $fromname, $token, $url);
This is incorrect;
$data['fromname'], //added data type to get the username
This should read ;
$data['**username**'], //added data type to get the username
Also dont forget you will also need to modify the language string for this email to include and extra %s.
So in you email it will now read;
%$ = username
%$ = sitename
%$ = verification code
%$ = site link
Related
I have recently added s3 as a storage to my laravel application. I use signed url which works perfectly with uploaded images, but it does not with pdfs. I receive access denied, for the pdfs. If I make the files public via S3 console, I can receive it.
I am uploading these files with this mehtid:
Storage::disk('s3')->put();
I have tried signing the url with these two methods:
$url = Storage::disk('s3')->temporaryUrl(
$path, Carbon::now()->addMinutes(5)
);
$s3 = \Storage::disk('s3');
$client = $s3->getDriver()->getAdapter()->getClient();
$expiry = "+10 minutes";
$command = $client->getCommand('GetObject', [
'Bucket' => \Config::get('filesystems.disks.s3.bucket'),
'Key' => $path,
]);
$request = $client->createPresignedRequest($command, $expiry);
return (string) $request->getUri();
Any help would be appriciated!
I found out the solution.
The problem was, when I gave the url to pdf.js, it automatically changed "&" chars in the url to "&" , and s3 didnt recognize this url. I solved it using js string replace method
var pdfUrl = '{{\App\Models\DataHelper::getImgUrl($note->file)}}'; //getting the singed url
pdfUrl = pdfUrl.replaceAll("&", '&');
showPDF(pdfUrl); //pdf.js
How do I get customer telephone & order_id on the catalog/controller/checkout/success.php page for Send SMS on opencart-2.0.3.1?
I tried this:
//after this this line: $this->model_account_activity->addActivity('order_guest', $activity_data);}
$orderID = $this->session->data['order_id'];
$msisdn=$this->customer->getTelephone();
$sms ='Congrats! You have successfully made orderID# '.$orderID.' Thank You. #TestSMS';
Showing Error as Follows:
Warning: Illegal string offset 'breadcrumbs'
Notice: Array to string conversion
Warning: Illegal string offset 'breadcrumbs'
Thanks for share your file code here.
You have used a variable $data before your curl requeset, as opencart has global variable $data itself in which all data move from controller to template.
$data=$param.$sms.$sid;
$crl = curl_init();
curl_setopt($crl,CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($crl,CURLOPT_SSL_VERIFYHOST,2);
curl_setopt($crl,CURLOPT_URL,$url);
curl_setopt($crl,CURLOPT_HEADER,0);
curl_setopt($crl,CURLOPT_RETURNTRANSFER,1);
curl_setopt($crl,CURLOPT_POST,1);
curl_setopt($crl,CURLOPT_POSTFIELDS,$data);
$response = curl_exec($crl);
curl_close($crl);
Please change the $data variable name with any another variable here & userd the new variable in curl request, or used below code instaed of upper one
$dataNew=$param.$sms.$sid;
$crl = curl_init();
curl_setopt($crl,CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($crl,CURLOPT_SSL_VERIFYHOST,2);
curl_setopt($crl,CURLOPT_URL,$url);
curl_setopt($crl,CURLOPT_HEADER,0);
curl_setopt($crl,CURLOPT_RETURNTRANSFER,1);
curl_setopt($crl,CURLOPT_POST,1);
curl_setopt($crl,CURLOPT_POSTFIELDS,$dataNew);
$response = curl_exec($crl);
curl_close($crl);
I Need to create an email template. Also I need to load that customer template into another .phtml file and edit before send the email. After editing only I need to send the email. Can anyone please help me how to do this?
I searched and tried for this, but I only found articles related to send email without editing the existing email template.
example: http://www.caritorsolutions.com/blog/158-send-email-from-custom-module-in-magento
You can create an email template when going to System > Transactional Emails. The name you put in is the unique identifier for that template.
<?php
$templateName = 'template_name_you_put_in_in_the_backend';
$to = 'johndoe#example.com';
$customerName = 'John Doe';
// Load our template by template_id
$emailTemplate = Mage::getModel('core/email_template')->loadDefault($templateId);
$vars = array(
'customer_name' => $customerName
// Other vars that can be used in the mplate
);
// Store sends it
$senderName = Mage::getStoreConfig(Mage_Core_Model_Store::XML_PATH_STORE_STORE_NAME);
$senderEmail = Mage::getStoreConfig('trans_email/ident_general/email');
$emailTemplate->setSenderName($senderName);
$emailTemplate->setSenderEmail($senderEmail);
//Send the email!
$emailTemplate->send($to, $customerName, $emailTemplateVariables);
You can of course edit this file through System > Transactional Emails. If this isn't what you mean, can you clarify what you mean by 'editing the existing email template' ?
I'm having a simple problem while retrieving user's contact's images. So I make a request to
$url = 'https://www.google.com/m8/feeds/contacts/default/full?alt=json&max-results=9999&oauth_token=' . $accessToken;
And then I get huge JSON from which I have extracted full name and email. Then I tried getting contact's image, and haven't had any success.
I get with all contacts, and everyone has following structure:
entry [id, updated, category, title, link, gd$email].
In the link section, I got four links, of which first two are some kind of link to an image content but I cannot retrieve it.
Any body had any success in doing this kind of work !?
Tnx alot!
BTW: If some data from my case is missing, please report and I'll add it too!
EDIT: I have also tried to reach the image with URL
http://profiles.google.com/s2/photos/profile/" + userid + "?sz=" + size;
but the problem is I cannot get userId from contacts JSON.
You must call the photo endpoint and append to it a valid access token as a query parameter.
Example:
https://www.google.com/m8/feeds/photos/media/name.surname%40gmail.com/0?access_token=ACCESS_TOKEN
Docs:
https://developers.google.com/google-apps/contacts/v3/#contact_photo_management
Make a request again if the mentioned tags are available as given below.
$add = new Google_HttpRequest("https://www.google.com/m8/feeds/contacts/default/full?alt=json&v=3.0&max-results=500&access_token='.$token->access_token");
$add->setRequestMethod("GET");
$add->setRequestHeaders(array('GData-Version' => '3.0', 'content-type' => 'application/atom+xml; charset=UTF-8; type=feed'));
$submit = $client->getIo()->authenticatedRequest($add);
$sub_response = $submit->getResponseBody();
$temp = json_decode($sub_response, true);
foreach ($temp['feed']['entry'] as $image) {
$google_contact_id = $image['link'][2]['href'];
if (isset($image['link'][0]['href'])) {
$photo = new Google_HttpRequest($image['link'][0]['href']);
$photo_val = $client->getIo()->authenticatedRequest($photo);
$photo_return = $photo_val->getResponseBody();
$imgData = base64_encode($photo_return);
$pro_image = 'data:image/jpeg;base64, ' . $imgData . '';
}
}
I have two forms: (login form, register form) and they submitted to my component.
Login form:
I want to check login and pass and set status to "logged" in joomla.
Register form:
I want register new user in joomla.
How to do it?
$inplogin = JRequest::getVar('inplogin');
$inppass = JRequest::getVar('inppass');
???? JFactory::login($inplogin, $inppass); ????
???? JFactory::registeruser($inplogin, $inppass); ????
???
For Login
$result = JFactory::getApplication()->login(array('username'=>$username, 'password'=>$password));
For Registration
require_once JPATH_ROOT.DS.'components'.DS.'com_users'.DS.'models'.DS.'registration.php';
$model = new UsersModelRegistration();
jimport('joomla.mail.helper');
// Attempt to save the data.
jimport('joomla.user.helper');
$username = ; //your user name here
$password = ; //your password here
$data = array( 'username'=>$email,'name'=>$email,'email1'=>$email,'password1'=>$password, 'password2'=>$password, 'block'=>1 );
$return = $model->register($data);
I don't see how this is related specifically to joomla.
you need to use the same $_SESSION variable in both cases. after you declare the variable, you can check on the beginning of your index page if this var exists (and if so, whether the credentials are correct or not). something like:
<?php
session_start();
if (!isset($_SESSION['logged']) {
header("location:login.php");
exit();
}
?>
you can use JUser::bind($userData) and JUser::save($userData) for registering the user.
Expanding upon Gaurav's answer:
If you're using just the Joomla framework and you don't have a site loaded, you will still need to initialize the site.
That said, these two lines should do the trick:
$app = JFactory::getApplication('site');
$app->initialise();