-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/229 - Avoid display of "Back to subscriptions" button when no subscription available to the user. #71
Conversation
* Disable back button when no subscriptions available. * Disable link at footer to also manage subscription when no subscriptions available.
Merge branch '000000-dev' of https://github.com/websharks/comment-mail-pro into feature/229
Merge branch '000000-dev' of https://github.com/websharks/comment-mail-pro into feature/229
* Add validation to display or not the message "Back to My Subscriptions" on the success dialog.
$sub = $this->sub; | ||
$_this = $this; | ||
$sub_key = $this->sub_key; | ||
$valid_sub_key = $this->plugin->utils_sub->get($sub_key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Reedyseth On this line you're querying to see if the sub key is actually associated with a subscription in the DB, but this has already been determined by $this->sub
as seen in the constructor here. So I would try to avoid making another DB query since this is already a known.
No worries. I love seeing the thought process behind the work; i.e., small commits as you work through the task at hand is very helpful to others in my view. Thanks! :-) |
* Fix issue#229 Avoid display of "Back to subscriptions" button when no subscription available to the user.
@jaswsinc
Awesome, I did a few more before finish the issue 😄 @raamdev @jaswsinc I have finish this issue wpsharks/comment-mail#229 , last commit went OK with Travis CI, the branch is at the tip of the head and ready to be merge, I apologize for the late response, I spent a lot of time working with Phing and Componser, I still not able to build the project, I left some comments on the Phing Channel 2 Slack. |
$valid_sub_key = $this->plugin->utils_sub->get($sub_key); | ||
$is_edit = $this->is_edit; | ||
$sub = $this->sub; | ||
$current_email = $this->plugin->utils_sub->currentEmail(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Reedyseth I suggest type casting this as a boolean, since the currentEmail()
method can return an empty string—we want to make sure that the empty string gets interpreted as false
here:
$current_email = (boolean) $this->plugin->utils_sub->currentEmail();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest type casting this as a boolean
Roger ! 👍
@Reedyseth I left you some feedback above. Please note that it's important that you are able to test the changes in this PR, so you'll need to get the build system working so that you can test your PR before I merge it in. |
Alright, I also added some questions, thanks ! |
@raamdev @jaswsinc Submitting my PR: 09170be. Please review when you get a chance. 😄 Updated codebase to include feedback from both @raamdev and @jaswsinc. Tested on both scenarios: User not logged in
User logged in with no subscriptions
|
@kristineds Thanks! Was this tested with users who do have subscriptions? I.e., did you confirm that the back button still works as expected when it's visible? |
@raamdev I tested this and the Back button (same with the My Comment Subscriptions link) is not working as expected, i.e. I'm seeing the "Missing subscription key" error message for a user with subscriptions who is logged in. Gonna work on this for a little bit more over the weekend. Thanks for the feedback! |
@kristineds Any update here? As I mentioned in the Comment Mail Project Status Update on Slack, I've bumped the Next Release by 1 week, putting the RC deadline at this Friday, August 5th. I'd like to have this ready to merge before then. |
@raamdev Since the error message that I'm getting (when clicking on the Back button) is because of a missing
I'm trying to fix the issue you pointed out here. #71 (comment) If I'm looking at it the wrong way, please point me to the right direction. 😄
I used this line of code (based on Israel's previous PR) on my previous PR and the issue of the Back button displaying an error message for logged-in users with subscriptions is evident, so yes. Either that, or some other line of code is causing this issue and I can't find it. 😞
|
This pull request has some improvements on the wpsharks/comment-mail#229
Using the variable
$has_subscriptions
controls the display of the back imageAnd My Comment Subscription Message
The purpose of using the
$valid_sub_key
variable is to control the display of the message Back to subscriptionsSo for some reason when I am testing
$valid_sub_key
always is null.@raamdev if you can give me some insights on this that would be very helpful 😺
By the way, I apologize for all the commits below, those are because I was keeping my repo updated.