Pixelbart
Forum Replies Created
-
Forum: Plugins
In reply to: [Helpful] PHP exceptions if no votes in databaseThank you for all your feedback and also the good error messages. With this you help me!
I will put this into the next update and check the dashboard widget to see if there is any data!
I’ll write you here as soon as I have done an update. But in the next update this should be fixed!
Forum: Plugins
In reply to: [Helpful] Ability to toggle /show feedback form for user who votedFor now there is no button, but the possibility to place the feedback form with {feedback_form}.
I will build the switch as an alternative. Unfortunately I did not have the time for that at the moment, because I have to build with Javascript again and I have to check if it works everywhere.
You are welcome to send me an e-mail and we will see if we can find a solution. You can also send me an FTP access and I will test it myself. But only by email!!!!
You have to use the $session because that is where the session is stored. In my tests this worked wonderfully. Do you still have the Native PHP Sessions installed?
https://wordpress.org/plugins/wp-native-php-sessions/
It sounds to me like the server doesn’t like to work with sessions. Many hosters have this problem, that’s why the plugin is so important. It fixes many bugs with PHP Sessions.
Otherwise I can’t think of anything else. Without error messages or debug log I can’t help you.
Forum: Plugins
In reply to: [Helpful] Ability to toggle /show feedback form for user who votedThis option is available since the last update. Settings > Feedback > Already Voted.
I just ran an update. You should be able to access the session now.
The code looks like this:
/** * Fills the fields, if a session exists. * * @param array $fields submitted fields * @param array $session submitted session data * * @return array */ function custom_function( $fields, $session ) { if ( isset( $session['data'] ) && ! empty( $session['data'] ) ) { $fields['name'] = sanitize_text_field( $session['data']['data']['firstname'] . ' ' . $session['data']['data']['name'] ); $fields['email'] = sanitize_email( $session['data']['data']['email'] ); } return $fields; } /** * Extends the filter and uses PHP_INT_MAX to ensure that changes are made at the last position. */ add_filter( 'helpful_feedback_submit_fields', 'custom_function', PHP_INT_MAX, 2 );Patch Notes: https://github.com/pixelbart/helpful/releases/tag/4.3.0
The plugin works by itself in the background. I will think of a solution for your session problem and put it in. I will have a look at it right away.
Ah now I understand. The problem is not Helpful, but the session. Helpful uses Ajax to store the contents. But the session is not passed on using Ajax.
It is hard to get to the user data without wp_get_current_user. You have to create a WP_User instance with the API to get the data.
Have you ever tested the plugin? Maybe the sessions work better then:
https://wordpress.org/plugins/wp-native-php-sessions/
- This reply was modified 5 years, 8 months ago by Pixelbart.
You might want to check if the session is filled then…
Helpful does not internally check if you are an admin or a user.
add_action( 'wp_footer', function() { if ( ! isset( $_SESSION['data'] ) ) return; printf( '<pre>%s</pre>', print_r( $_SESSION['data'], true ) ); });With this: If a session exists, it is output in the footer (directly on the page).
- This reply was modified 5 years, 8 months ago by Pixelbart.
I have adapted your code a bit.
You must set return $fields outside the IF-query, otherwise no more fields will be returned.
/** * Fills the fields, if a session exists. * * @param array $fields * * @return array */ function custom_function( $fields ) { if ( isset( $_SESSION['data'] ) && ! empty( $_SESSION['data'] ) ) { $fields['name'] = sanitize_text_field( $_SESSION['data']['data']['firstname'] . ' ' . $_SESSION['data']['data']['name'] ); $fields['email'] = sanitize_email( $_SESSION['data']['data']['email'] ); } return $fields; } /** * Extends the filter and uses PHP_INT_MAX to ensure that changes are made at the last position. */ add_filter( 'helpful_feedback_submit_fields', 'custom_function', PHP_INT_MAX );sanitize is necessary so that no malicious code can be transmitted!
- This reply was modified 5 years, 8 months ago by Pixelbart.
If is_user_logged_in does not work, you can also simply check if the user is logged in.
You can easily do this with PHP. How is the user data stored? Can you send me an example so I can create an example for you.
Forum: Plugins
In reply to: [Helpful] Ability to toggle /show feedback form for user who votedCurrently I am still on vacation. I will see if I can build something there in the next two weeks.
After vacation I will surely have a lot to do at work and I have to see if I can do it in time.
But I like the idea, so it will be built in any case.
Forum: Plugins
In reply to: [Helpful] How to have “Clean Theme” display “Already voted” messageHello!
Thanks for your feedback! The Clean Theme hides the content. But you can use the following CSS:
.helpful > .helpful-content > span { display: block !important; }Demo: https://helpful-plugin.info/documentation/getting-started/
Forum: Plugins
In reply to: [Helpful] Enter start valueHello!
Helpful is actually not there to cheat votes! So this can break some things. Here you can find a code that allows you to cheat 300 votes for each post!
Since the votes are all counted for the current time, you have a huge increase in votes in the Helpful statistics.
This is not supported and not recommended by me. If you use the code and something stops working, you are responsible for it yourself!!!
The code: https://gist.github.com/pixelbart/658b5b213275cc37b01352c8c07d3eb5
Thank you for your feedback!
PS: Such a feature will not be available in the future!
Forum: Reviews
In reply to: [Helpful] Super !Merci pour vos commentaires ! Je ne connais pas le français et j’espère que le traducteur DeepL fera du bon travail !
Amusez-vous avec Helpful et restez en bonne santé !