Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter Julian

    (@jolution)

    Hi, alles auf dem neusten Stand.
    Wenn man statt der Module, den Shortcode verwendet, funktioniert es.

    Thread Starter Julian

    (@jolution)

    Hi @millend,

    Shortcodes:

    The confusing thing about my code is that the shortcode for the mail section is called “favorites”. I adjusted it in the upper area of ??the Gist. Sorry for that ??

    • CF7 form: [menulist]
    • CF7 Mail: [favorites]

    Logged-out users:

    Yes, I had that problem too. If you are logged in, @takashimatsuyama uses the database (get_user_meta), otherwise the browser cache (localstorage / sanitize_text_field).
    It works for me now. Do you have the current code status?

    General:
    If you want, feel free to optimize my gist. Or if @takashimatsuy wants to, I can also push it into the core, if he wanted.

    Thanks @takashimatsuy for the plugin at this point.

    Thread Starter Julian

    (@jolution)

    I think I got it right, I still have to clean up and test, but looks good so far.

    P.s. Why can’t I delete or adjust old unanswered comments?

    Here is my actual code:
    https://gist.github.com/jolution/7e663f425e3f3286c4527855bf3a66b8

    Thread Starter Julian

    (@jolution)

    Dear takashimatsuyama, my template works when I’m logged in ??
    Unfortunately I don’t get any data if I’m not logged in :-‘/

    The source uses the $_POST variable for this, but I don’t know it in the template.
    If you want, I can make the finished script available on Github for you, if you like.

    Could you still help me how to get the localStorage data?

    Here is my actual code:
    https://gist.github.com/jolution/7e663f425e3f3286c4527855bf3a66b8

    Thread Starter Julian

    (@jolution)

    Good evening ! It’s worked out. I have adapted the code and now an output for CF7. You are very welcome to adopt the code or include it in the documentation if others could use it.

    
    // Ticket: https://www.ads-software.com/support/topic/simple-output-function-for-a-selectmenu/
    // Manual: https://contactform7.com/2015/01/10/adding-a-custom-form-tag/
    add_action('wpcf7_init', 'custom_add_form_tag_clock');
    function custom_add_form_tag_clock() {
        wpcf7_add_form_tag('menulist', 'custom_post_select', true);
    }
    
    function custom_post_select($tag) {
        $output = ccc_my_favorite_list_custom_template();
        return $output;
    }
    
    function ccc_my_favorite_list_custom_template($my_favorite_post_id = false) {
    
        // Source: https://github.com/takashi-matsuyama/my-favorites/blob/e482f31b16612949e1711bda622f97c7232030e0/assets/list.php
        if (is_user_logged_in() == false) {
            $ccc_my_favorite_post = sanitize_text_field($_POST['ccc-my_favorite_post']);
            $my_favorite_post_ids = explode(',', $ccc_my_favorite_post);
            
        } else {
            $user_favorite_post_ids = get_user_meta(wp_get_current_user()->ID, CCC_My_Favorite::CCC_MY_FAVORITE_POST_IDS, true);
            $my_favorite_post_ids = explode(',', $user_favorite_post_ids);
        }
        $my_favorite_post_ids = array_map('htmlspecialchars', $my_favorite_post_ids);
    	$output = '<label>Favoriten</label><select name="favorites" class="wpcf7-form-control wpcf7-select wpcf7-validates-as-required" aria-required="true" aria-invalid="false"><option value="">---</option>';
    
        $args = array(
            'post_type' => 'any',
            'post__in' => $my_favorite_post_ids, //$my_favorite_post_id,
            'orderby' => 'post__in',
            'posts_per_page' => - 1,
        );
        $the_query = new WP_Query($args);
    
        if ($the_query->have_posts()) {
            while ($the_query->have_posts()) {
                $the_query->the_post();
    			$output .= '<option ';
    			$output .= 'value="' . get_the_title() . '">' . get_the_title() . '</option>';
            }
        }
    	$output .= "</select>";
        return $output;
    }
    Thread Starter Julian

    (@jolution)

    good evening, thanks for the code. I had already tried the do_shortcode, but it didn’t work for me.

    With a slight adjustment, I can use your code to ensure that all posts appear, but I only needed the favorite ones. Do I have a mistake in reasoning?

    
    // Ticket: https://www.ads-software.com/support/topic/simple-output-function-for-a-selectmenu/
    	
    	// Manual: https://contactform7.com/2015/01/10/adding-a-custom-form-tag/
    	add_action('wpcf7_init', 'custom_add_form_tag_clock');
    	function custom_add_form_tag_clock() {
    		wpcf7_add_form_tag('menulist', 'custom_post_select', true);
    	}
    
    	function custom_post_select($tag) {
    		//global $post;
    		$output = ccc_my_favorite_list_custom_template();
    		return $output;
    	}
    
    	/*function custom_post_select($tag) {
    		return do_shortcode('[ccc_my_favorite_list_custom_template]');
    	}*/
    
    	// https://de.www.ads-software.com/plugins/my-favorites/
    	/*function ccc_my_favorite_list_custom_template( $my_favorite_post_id=false ) {
    		return "OUTPUT SELECT LIST WITH FAVORTIES"; //$my_favorite_post_id;
    	}*/
    
    	function ccc_my_favorite_list_custom_template( $my_favorite_post_id=false ) {
    		$output = "";
    		$args= array(
    		  'post_type' => 'any',
    		  'post__in' => $my_favorite_post_id,
    		  'orderby' => 'post__in',
    		  'posts_per_page' => -1,
    		);
    		$the_query = new WP_Query($args);
    
    		if( $the_query->have_posts() ) {
    		  while( $the_query->have_posts() ) {
    			$the_query->the_post();
    	  
    			$output .= get_the_title() . "<br>";
    	  
    		  } //endwhile
    		} //endif
    		return $output;
    
    	  } //endfunction
    Thread Starter Julian

    (@jolution)

    Thank you for your feedback. I have already discovered the post and therefore wanted to use the function. But, I only received a list of all of my contributions, not just a list of favorites.

    The part with creating the select fields would not be a problem.

    I really only need a tip on how I can expand this part so that all noted page names (including ID) are output as pure text.

    
    	// https://de.www.ads-software.com/plugins/my-favorites/
    	function ccc_my_favorite_list_custom_template( $my_favorite_post_id=false ) {
    		return "OUTPUT SELECT LIST WITH FAVORTIES"; //$my_favorite_post_id;
    	}
    Thread Starter Julian

    (@jolution)

    Thank you for your feedback @champsupertramp.
    We have just discovered that there is an integrated “Honeypot” feature under the “Login” point on the features List.
    That’s great! Does this also apply to the registration forms and others?

    Source:
    https://github.com/wp-plugins/ultimate-member/blob/master/core/um-actions-global.php

    Anti-spam measures
    The login forms automatically come with triple anti-spam protection which includes: a hidden honeypot field, time delay on submit button and WordPress nonces.

    Source: https://ultimatemember.com/features/

    Best Regards

    Thread Starter Julian

    (@jolution)

    Thanks @missveronicatv for the support.
    I’ll go through the recommendation above again. I currently deactivated it because otherwise I would no longer be able to log in to Ultimate Member. I guess I haven’t configured something correctly yet.

    Thread Starter Julian

    (@jolution)

    Thank you @missveronicatv for sharing!

    I downloaded the code and included it in the functions.php. Where exactly can I find the AdminPage for this? Didn’t fully understand this point in the readme.

    Thank you for your feedback @champsupertramp.
    We have just discovered that there is an integrated “Honeypot” feature under the “Login” point on the features List.
    That’s great! Does this also apply to the registration forms and others?

    Source:
    https://github.com/wp-plugins/ultimate-member/blob/master/core/um-actions-global.php

    Anti-spam measures
    The login forms automatically come with triple anti-spam protection which includes: a hidden honeypot field, time delay on submit button and WordPress nonces.

    Source: https://ultimatemember.com/features/

    Best Regards

    Thread Starter Julian

    (@jolution)

    Dear @nriddhi, thank you very much.

    Unfortunately, I can see that the full IPs are displayed there, which – if I’m not mistaken – are not permitted in Germany (GDPR / DSVGO).

    Is there a way to anonymize these, i.e. cut off the last bytes or even hide them legally?

Viewing 11 replies - 1 through 11 (of 11 total)