Member Card Custom Override

More
2 years 8 months ago - 2 years 8 months ago #145598 by Alvis
Member Card Custom Override was created by Alvis
Since I added some special custom fields, and I have to show it on the member card depending to some condition, I modified the function inside the site helper file 'subscription.php' to fit in my need. Is it safe? Will it change back if the extension will be updated in the future? Or is there any way it is better than what I do so?

Of course, if no other method but only override the function inside 'subscription.php' and it will be overwritten when updating, I will insert those custom codes myself every single update.

Actually, besides 'subscription.php', I also custom added some jquery validation rules in 'jquery.validationEngine.min.js'. Is it safe too?
Last edit: 2 years 8 months ago by Alvis.

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #145600 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Member Card Custom Override
Surely it will be changed back on update. Exactly what method on that file you modified? Please let me know so that I can see if it could be overriden

Tuan

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago - 2 years 8 months ago #145601 by Alvis
Replied by Alvis on topic Member Card Custom Override
At this moment, according to the need, there are two files I edited. They are 'subscription.php' and 'jquery.validationEngine.min.js'.

1) 'subscription.php'

I added some codes into the 'public static function generatePlanMemberCard($item, $config)'.
The case is that, since some of my custom fields (Group B ) are depending on another custom fields (Group A). A will decide whether B will be shown on the member card or not, I have added some special custom [TAG]s based on my custom fields to handle those conditions. Indeed, I tested the code and it worked very well.

2) 'jquery.validationEngine.min.js'

I added some extra jquery validation rules and they check the input working well too.
Last edit: 2 years 8 months ago by Alvis.

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #145607 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Member Card Custom Override
Hello Alvis

1. The change in the generatePlanMemberCard can be overridden. See membershipprodoc.joomservices.com/develo...thods-helper-methods

Although the method is not listed there due to outdated document, that method can be overridden

2. The change in the file jquery.validationEngine.min.js, unfortunately, could not be overridden. So you will need to re-do the change yourself each time you update the extension

Tuan

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #145609 by Alvis
Replied by Alvis on topic Member Card Custom Override
1) the example ' github.com/joomdonation/osmembership-ove...ster/helper/override ' is 404 now, is there any other examples for me to study?

2) Noted with thanks. I will added it back when update.

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago - 2 years 8 months ago #145613 by Alvis
Replied by Alvis on topic Member Card Custom Override
Oh, forget the part 1 in last reply. I got the solution myself.

After I study the code for a while and tried a few time, I finally found that I have to copy both 'public static function generateMemberCard($item, $config)' and 'public static function generatePlanMemberCard($item, $config)' functions rather than only the last one. The override coding in the original php states that these two functions should be used together and so should be override together too.

It now works perfectly in frontend profile page but not work in backend subscription page. If I directly hack the code by inserting what I need, it works well both in frontend and backend. However, it seems the override methods are not loading in backend, any idea?
Last edit: 2 years 8 months ago by Alvis.

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #145616 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Member Card Custom Override
Actually, you only have to override on method generatePlanMemberCard. You had to do both because of a small typo in my code, sorry

I just updated download package on server with this fix. You can access to My Downloads menu item, download latest package, upgrade it to your site. That will solve the issue with override not working for backend, too

Tuan
The following user(s) said Thank You: Alvis

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #145617 by Alvis
Replied by Alvis on topic Member Card Custom Override
Work perfectly!

Please Log in or Create an account to join the conversation.

More
2 years 8 months ago #145637 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Member Card Custom Override
Great. Thanks for confirming

Tuan

Please Log in or Create an account to join the conversation.