- Posts: 630
- Thank you received: 30
Member Card - Pdf name - Possible to change
- David Unwin
- Topic Author
- Offline
- Platinum Member
Less
More
1 year 5 months ago #157502
by David Unwin
Member Card - Pdf name - Possible to change was created by David Unwin
The membership card pdf name when download uses the Joomla username for the PDF Name
Is it possible to change to say the Last name and First Name of the Membership Holder?
The reason I ask is that we download and distribute cards Using the User name is a bit random.
Kind regards
David
Is it possible to change to say the Last name and First Name of the Membership Holder?
The reason I ask is that we download and distribute cards Using the User name is a bit random.
Kind regards
David
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Away
- Administrator
1 year 5 months ago #157511
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Member Card - Pdf name - Possible to change
Hi David
We use username for the filename because only username is unique (and not contains special characters)
If you need to use First Name and Last Name, you would need to customize the code
Regards,
Tuan
We use username for the filename because only username is unique (and not contains special characters)
If you need to use First Name and Last Name, you would need to customize the code
Regards,
Tuan
Please Log in or Create an account to join the conversation.
- David Unwin
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 630
- Thank you received: 30
1 year 5 months ago #157518
by David Unwin
Replied by David Unwin on topic Member Card - Pdf name - Possible to change
Hi Tuan,
I can understand your logic in that user name is unique and so we cannot get duplicate membership cards
Can you point me to where the code is. I was thinking we could replace User name with Name plus Membership No. Is Membership number also unique?
Our members using odd user names like ABC123 rather than something which reflects their real name which makes it hard to find the owner when we download the card and it has ABC123 as the file name
Kind regards
David
I can understand your logic in that user name is unique and so we cannot get duplicate membership cards
Can you point me to where the code is. I was thinking we could replace User name with Name plus Membership No. Is Membership number also unique?
Our members using odd user names like ABC123 rather than something which reflects their real name which makes it hard to find the owner when we download the card and it has ABC123 as the file name
Kind regards
David
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Away
- Administrator
1 year 5 months ago #157523
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Member Card - Pdf name - Possible to change
Hi David
Please try to look at components/com_osmembership/controller/profile.php and try to modify code from there. Look at the line 190:
Here, we append username and plan_id to generate name of PDF file. You can change it to meet your need
Tuan
Please try to look at components/com_osmembership/controller/profile.php and try to modify code from there. Look at the line 190:
Code:
$this->processDownloadFile($path, $item->username . '_' . $item->plan_id . '.pdf');
Here, we append username and plan_id to generate name of PDF file. You can change it to meet your need
Tuan
Please Log in or Create an account to join the conversation.
- David Unwin
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 630
- Thank you received: 30
1 year 5 months ago #157531
by David Unwin
Replied by David Unwin on topic Member Card - Pdf name - Possible to change
Hi Tuan,
Thanks for pointing to the right code
I tried changing the code to replace 'username' with 'last_name'
However, when I download a membership card it was still the same ie usernane-planid.pdf
I think the reason is that the PDF name for the membership card is generated when the membership is created.
So this change in code would only apply to any new memberships after the code was changed and not to existing memberships
Am I correct?
Kind regards
David
Thanks for pointing to the right code
I tried changing the code to replace 'username' with 'last_name'
However, when I download a membership card it was still the same ie usernane-planid.pdf
I think the reason is that the PDF name for the membership card is generated when the membership is created.
So this change in code would only apply to any new memberships after the code was changed and not to existing memberships
Am I correct?
Kind regards
David
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Away
- Administrator
1 year 5 months ago #157535
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Member Card - Pdf name - Possible to change
Hi David
I forgot to ask: Where you download member card? The code I'm talking about will work for the case users download member card from their user profile. Maybe you are downloading member cards from administrator area?
Tuan
I forgot to ask: Where you download member card? The code I'm talking about will work for the case users download member card from their user profile. Maybe you are downloading member cards from administrator area?
Tuan
Please Log in or Create an account to join the conversation.
- David Unwin
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 630
- Thank you received: 30
1 year 5 months ago #157538
by David Unwin
Replied by David Unwin on topic Member Card - Pdf name - Possible to change
Hi Tuan,
Yes, we are downloading cards for our members.
I assume by your question that code you changed was only for members to down load their own card?
Kind regards
David
Yes, we are downloading cards for our members.
I assume by your question that code you changed was only for members to down load their own card?
Kind regards
David
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Away
- Administrator
1 year 5 months ago #157539
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Member Card - Pdf name - Possible to change
For backend, please try to edit code in the file administrator/components/com_osmembership/controller/subscription.php. Like 1185, the same code:
Regards,
Tuan
Code:
$this->processDownloadFile($path, $item->username . '_' . $item->plan_id . '.pdf');
Regards,
Tuan
The following user(s) said Thank You: David Unwin
Please Log in or Create an account to join the conversation.
- David Unwin
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 630
- Thank you received: 30
1 year 5 months ago #157540
by David Unwin
Replied by David Unwin on topic Member Card - Pdf name - Possible to change
Tuan,
Thank you very much. I replaced 'username' with 'last_name' So Pdf name is now 'LASTNANE_Plan-id'
So now I should copy my new code to under my Template folder to TEMPLATENAME/html/com_osmembership/???
Also is Plan Name available? It would be nice to replace the digit from plan id with Plan Name.
Kind regards
David
Thank you very much. I replaced 'username' with 'last_name' So Pdf name is now 'LASTNANE_Plan-id'
So now I should copy my new code to under my Template folder to TEMPLATENAME/html/com_osmembership/???
Also is Plan Name available? It would be nice to replace the digit from plan id with Plan Name.
Kind regards
David
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Away
- Administrator
1 year 5 months ago #157542
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Member Card - Pdf name - Possible to change
Hi David
1. Unfortunately, Plan Name is not available. You need to query database to get plan title if it is really needed (base on ID of the plan_
2. For override, this is not a layout, so you cannot move it to template. Please follow instructions at membershipprodoc.joomservices.com/develo...n-a-controller-class to override that controller (please only override the method, not all method in that class)
Tuan
1. Unfortunately, Plan Name is not available. You need to query database to get plan title if it is really needed (base on ID of the plan_
2. For override, this is not a layout, so you cannot move it to template. Please follow instructions at membershipprodoc.joomservices.com/develo...n-a-controller-class to override that controller (please only override the method, not all method in that class)
Tuan
The following user(s) said Thank You: David Unwin
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
Copyright © 2024 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.