Open julien51 opened 4 years ago
I had the same idea today. My thoughts were there would be a page level block settings with a checkbox. Once the checkbox is checked there would be page level lock settings underneath.
One thing could be to also allow full collections of posts to be locked (thru basically addition of a tag or category that locks them all)
I made a little progress on this.
Basically we would leverage the the_content
filter that the WP API offers and then call the existing render_block( $attributes, $content )
from the class-unlock-box-block
.
However, to do that we need to find an easy way to have $attributes
include the right info. For this I need to find a way to add a "Page" level settings in this column. There again, there should be a way to re-use the block settings.
vs
@SolomonFoskaay What about this one? Would you be interested in working on it for $300?
@julien51 Yes, if you can help adjust the price between $300-$500. Thanks!
I have agreed to $300 on that one
How are you doing on this front @SolomonFoskaay ?
How are you doing on this front @SolomonFoskaay ?
Yeah, currently working through understanding the plugin source codes and how they work they work together. I have tried about 2 methods for this which involved editing multiple of the plugin PHP file but not yet give the desired result. So, I decided to spend some time getting familiar first with all the code base. within 2 weeks time, should be able to have something for you to test out on this.
Hum. Ok. Please keep me posted frequently and regularly because we may need earlier than that and in that case I'll take care of it.
Hum. Ok. Please keep me posted frequently and regularly because we may need earlier than that and in that case I'll take care of it.
Okay, will keep you updated and added it as a higher priority. Let's see what I can have for you to check in 1 week's time.
Hum. Ok. Please keep me posted frequently and regularly because we may need earlier than that and in that case I'll take care of it.
@julien51 Have spent the last 3dys to study the about 50 code files of the Unlock plugin repo and today I have a more comprehensive understanding of it and have a more defined way to implement and fix this feature.
In the process, will surely need your support and will be posting them here. For now, see attached screenshot and help answer the following please: (1) Have tried to run the src via webpack to have it load in the browser for me to see the changes am doing in the src folder but it does not load (tried accessing it via https://localhost:3000) or do I need to set up middleware like webpack-dev-middleware to load it browser via https://localhost:8080? The server seems working fine when accessed via http with a message ({"tinylr":"Welcome","version":"1.1.1"})
(2) For now, I have the webpack build working fine and will have to always build the changes done in the scr
folder to the wp plugin and then run via localwp to see changes. that takes more time though as seen in image below.
(1) Have tried to run the src via webpack to have it load in the browser for me to see the changes am doing in the src folder but it does not load (tried accessing it via https://localhost:3000/) or do I need to set up middleware like webpack-dev-middleware to load it browser via https://localhost:8080/?
You do not need to run a server at all times. You can just use yarn run build:all
and if you use the symlink approach then the plugin should be up to date in your WP!
(1) Have tried to run the src via webpack to have it load in the browser for me to see the changes am doing in the src folder but it does not load (tried accessing it via https://localhost:3000/) or do I need to set up middleware like webpack-dev-middleware to load it browser via https://localhost:8080/?
You do not need to run a server at all times. You can just use
yarn run build:all
and if you use the symlink approach then the plugin should be up to date in your WP!
Yeah, am using the symlink method with localwp already. will just stick to that. Work still on will keep you updated
@julien51 Here comes the updates. Very sorry it coming this evening, promised morning earlier.
I have been able to achieve the full post-locking feature but with some explanation. So to make things easy will divide the full post/page content-locking issue into two parts:
PART 1: The full post/page locking/unlocking feature
PART 2: Integrating Unlock Protocol to be used for the unlocking of PART 1 above.
I have successfully achieved the PART 1 and here comes a demo (for now the locking is for the post type, the lock works on page type too but need some cleanup) to see it in action. I used an Ethereum wallet address as the unlocking, when PART 2 is integrated, then the Unlock Protocol workflow will handle the unlocking with NFT as usual.
The demo shows using the Unlock Protocol Wordpress plugin (Dev version) to add the full post content locking and unlocking.
I have spent the last 1week (70Hours+) and 90% of it went to understanding the codebase and trying to maintain the style of the existing code to integrate the new feature but I won't deceive you, it was a pain due to how the plugin class + singleton was set up which makes it tougher and harder to even see new features I added to show up after several hours and changes to it.
Thus, I decided to bypass the current codebase and within the last 24 hours, that made it possible for me to achieve the desired full post content lock/unlock. (if you watch the above demo video, you will notice at 0:26-0:45, it showed how I had to include the new "locks" folder and the PHP file used to code the full post lock/unlock feature directly in the main plugin file which allowed it to load and function well when the plugin was activated.).
Therefore, moving forward I have this proposal:
I will push to the Unlock repo the feature for the full post/page lock/unlocking as it is. Then you that already have an in-depth understanding of the complex unlock wp plugin code base could just convert it to match the class and singleton format, then integrate the PART 2 (mean integrate with the existing Unlock workflow) because as for me, it is not time and effort productive enough to continue to spend more hours on the existing codebase as it is now (just complex and less flexible to work with).
PAYMENT: You can pay me $150 - $200 from the $300 bounty price assigned to this issue since I only did PART1 and will push the code to the unlock wp plugin repo within 48hours time for you to integrate it with PART2 if you are selecting this OPTION 1.
UPDATE: @julien51 In yesterday's update above, I said that the full content lock/unlock works for post content only and am that doing some work to have it work with pages too.
Am glad to inform you that after the update, I put in some work and now have it working with pages too. See below:
Full page content lock/unlock with Lock Address ID (Ethereum wallet)
Full post content lock/unlock with Lock Address ID (Ethereum wallet)
This means I now have the PART 1: Full Post/Page Content Locking/Unlocking feature achieved and ready to be integrated with PART 2 (Unlock Protocol NFT Lock/Unlocking workflow).
So, looking forward to your response to yesterdays update for this to move on further and faster too.
This is fantastic! I am excited about seeing these screenshots! Let me respond in more details shortly! Please do open a PR as well so I can start making early feedback on the code itself!
This is fantastic! I am excited about seeing these screenshots! Let me respond in more details shortly! Please do open a PR as well so I can start making early feedback on the code itself!
@julien51 Okay, still awaiting your response on the option you concluded on going with from the above. So that we move on. Regards!
I have spent the last 1week (70Hours+) and 90% of it went to understanding the codebase and trying to maintain the style of the existing code to integrate the new feature but I won't deceive you, it was a pain due to how the plugin class + singleton was set up which makes it tougher and harder to even see new features I added to show up after several hours and changes to it.
The plugin firm was in fact created by a team that's a leading WP firm and recommended by Automattic themselves so I think it probably uses the right approach... https://rtcamp.com/
Then you that already have an in-depth understanding of the complex unlock wp plugin code base could just convert it to match the class and singleton format, then integrate the PART 2 (mean integrate with the existing Unlock workflow) because as for me, it is not time and effort productive enough to continue to spend more hours on the existing codebase as it is now (just complex and less flexible to work with).
No I am sorry, if we assign bounties is for these to be solved. If our team has to then redo the work then I am not sure I understand the point of these bounties :)
Looking forward to the price range of $1,500 - $2,000 to rewrite the full Unlock Protocol Wordpress plugin which will include a more modular easy to work with the structure that makes adding new features less of a pain for contributing developers now and in the future. It will include the following features:
I am sorry but I am really confused here. If you want to create another plugin then please go ahead... but we don't need someone to create the plugin from scratch again.
Please push your code anyway so I can make sense of it and recommend next steps?
@julien51 Okay. Will try to fix the PART 2 myself to have the unlock flow all work together just like the current block flow.
When I have the full post/page content lock feature completely integrated with the unlock flow, will push the full code to you for the check. So, kindly look forward to my PR in 1 week's time.
Regards!
Thanks great news @SolomonFoskaay ! If you want to push some code I can certainly look and give you early feedback...
Thanks great news @SolomonFoskaay ! If you want to push some code I can certainly look and give you early feedback...
@julien51 I have pushed a PR #67 so you can help check the code and provide support.
I Moved to make the full post/page content lock option show in the post/page editor within the current code base without creating other plugin flow like I did last week.
The full post/page content lock is now showing up on the post editor sidebar similar to the existing Block lock options
Admin/Author can now click "Add Lock", and it will show the "Network" dropdown list which I retrieved from the existing Network array user added via the plugin network setting page.
Lock id input box was added to allow the user to add a lock address id for locking the post.
Pending issue:
The code lock by saving the selected lock address and lock id in the input box when the post/page is published or updated in the alternative design I did in the plugin last week. But, it does not save the lock metadata attributes after I place it inside the existing code base due to the Singleton design pattern used. So, need to find a way around it.
Changing the current full post/page lock/unlock with just lock address wallet to switching it to use Unlock Protocol existing flow in the plugin. To achieve this, I need to first find a workaround to save the attributes to database in the Singleton code base, then can move to this final stage.
Even though, I do agree the initial Unlock Plugin developers were from a recommended high rank wp platform but that does not mean they did not do bad design choices (we have seen it that even big brands sometimes have flaws that even unrecognized startups avoid)
As I mentioned earlier, the Singleton design pattern adopted by the Unlock plugin developer is a complex design that is usually used for specific cases and when used, should not be used for 100% of all classes in the plugin but they used it in all. Now, it makes it difficult to introduce new features side by side with existing ones without the need to tamper with the existing code base.
A little bit of Googling will reveal to you that this is indeed a complicated design pattern which most modern plugin design do not adopt. It is hard to even see a helpful guide up to date about using Singleton for Wp plugin design that is not outdated in about 3-5 years ago.
@julien51 I have been able to fix this issue completely and pushed a new PR for it #68 .
Kindly check and let me know if there is a need for further adjustment. Though I have tried to minimize having you spend more time with errors in the code.
Meanwhile, the following was done:
Refactored the current Unlock Protocol Flow used by the plugin (removed Class And Singleton design which complicated the process of extending the plugin with new features). This makes it far more easier for contributing developers to add new features to the plugin moving forward.
Fixed issue https://github.com/unlock-protocol/unlock-wordpress-plugin/issues/4 which means the Unlock Protocol plugin can now lock full post/page content with the same Unlock protocol flow used previously for locking Gutenberg block content with Unlock-based NFTs.
Made the no1 changes without breaking the existing codebase which still allows the Gutenberg Block lock to function as before while the full post/page content lock work side by side.
Full Post Content Lock + Unlock Protocol Flow: Editor
Display
Full Page Content Lock + Unlock Protocol Flow: Editor
Display
Considering I had to refactor the existing codebase for the Unlock protocol flow, PLEASE I will appreciate it if you can consider compensation for the extra weeks spent on those extra that are not part of this issue bounty. Thus looking forward to having the bounty pushed from $300 to between $700 - $1,000.
I do appreciate your understanding and consideration in advance.
Thanks!
Hello,
Just to add, I was able to achieve locking full content post/page with custom coding built into our platform (3Pad) early version. We also implemented more customizable options for users .
Paywall
This wall all implemented to give users as much options as possible, similar to the unlock checkout builder.
Here's a video demonstrating the use https://youtu.be/HTuG-uJ_9RE?t=636
Also you can view the code here https://github.com/3Pad/3pad/blob/main/wp-content/themes/3pad/files/unlock-protocol.php#L359
These custom fields use (ACF).
I haven't tried implementing this into unlock plugin but it can be achieved . I look forward to seeing more customizable lock options for the plugin.
@julien51 Thanks and really appreciate it including the extra fixes you did on my PR too. here is my wallet for the bounty payment.
Polygon: 0x7B6DDE23a733D7a2BBb36258C03BEf796276eBa9
Thanks!
Thanks for your work on this @SolomonFoskaay ! The bounty was just paid: https://polygonscan.com/tx/0x337974ce2dd68654ac85ae3107ae3653cf14e8c441a5bb4d3d3326790512840a
Thanks for your work on this @SolomonFoskaay ! The bounty was just paid: https://polygonscan.com/tx/0x337974ce2dd68654ac85ae3107ae3653cf14e8c441a5bb4d3d3326790512840a
@julien51 Confirmed. Thanks
Our current approach is to let WP users lock "blocks" easily. We should let them also easily lock posts where by default (maybe in the template?) the content of the post is locked. This can be set with a toggle in the settings.