Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
- This topic has 21 replies, 4 voices, and was last updated 8 years, 6 months ago by
Steven Zahm.
-
AuthorPosts
-
09/12/2014 at 11:42 am #303723
Christopher Radloff
ParticipantHello! I’m very impressed with this plugin, but alas and alackaday, I can’t seem to get it to hide the entries until a search has been conducted.
I installed the Snippets plugin, uploaded and activated the .xml file, changed line 69 to: array_walk( $atts, create_function( ‘&$i,$k’,’$i=”$k=\”$i\””;’ ); and installed the shortcode [connections initial_results=false] on my target page. Yet the entries still appear. Am I missing a step? Have I goofed? Any help would be greatly appreciated!
(http://www.siouxlandhba.com/members/ is the page I’m struggling with.)
09/12/2014 at 11:57 am #303726Steven Zahm
Keymaster@ Christopher
That sounds about it. I would need an admin account to see why this is not working for you … It could be the way the theme renders the page, the code in the snippet is never run. If that is the case, there is not much I’ll be able to do … but I will not know until I take a look.
09/12/2014 at 12:08 pm #303731Christopher Radloff
ParticipantBoy, I’d sure appreciate it if you could take a peek! Can you send your preferred e-mail address to chris@hippieboydesign.com and I’ll set you up with an admin account.
09/13/2014 at 6:47 pm #303860Steven Zahm
Keymaster@ Christopher
You can use any old email address that you’d like, just post the user/pass here as a private reply. Please follow-up with a regular non-private reply so I’m notified that you posted the login details.
09/13/2014 at 6:48 pm #303861Steven Zahm
Keymaster@ Christopher
You can use any old email address that you’d like, just post the user/pass here as a private reply. Please follow-up with a regular non-private reply so I’m notified that you posted the login details.
09/14/2014 at 9:11 am #303955Christopher Radloff
ParticipantThis reply has been marked as private.09/14/2014 at 9:12 am #303956Christopher Radloff
ParticipantThank you SO much! I’ve sent you a private reply. Yay!
09/14/2014 at 9:57 am #303977Steven Zahm
Keymaster@ Christopher
I just tried to login. I get an error message that the User has not been activated. Can you activate the user account? This isn’t default WordPress behavior so I’m guessing you have a plugin installed that manages this, yes?
09/14/2014 at 10:30 am #303978Christopher Radloff
ParticipantYes, my apologies. The user has indeed been activated!
09/14/2014 at 10:46 am #303979Steven Zahm
Keymaster@ Christopher
Ok, all fixed up!
For reference for anyone else who has implemented this or wants to. Here’s the updated code snippet to get it to work again.
function cn_initial_search_filter( $posts, $WP_Query ) { global $wp_query; if ( ! class_exists('cnTemplatePart') ) return $posts; $shortcode = 'connections'; $pattern = get_shortcode_regex(); // Grab the array containing all query vars registered by Connections. $registeredQueryVars = cnRewrite::queryVars( array() ); foreach ( $posts as $post ) { // If we're in the main query, proceed! if ( isset( $WP_Query->queried_object_id ) && $WP_Query->queried_object_id == $post->ID ) { /* * $matches[0] == An array of all shortcode that were found with its options. * $matches[1] == Unknown. * $matches[2] == An array of all shortcode tags that were found. * $matches[3] == An array of the shortcode options that were found. * $matches[4] == Unknown. * $matches[5] == Unknown. * $matches[6] == Unknown. */ if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches ) && array_key_exists( 2, $matches ) && in_array( $shortcode, $matches[2] ) ) { // Parse the shortcode atts. $atts = shortcode_parse_atts( $matches[3][ array_search( $shortcode, $matches[2] ) ] ); // Remove the cn-image query vars. $wp_query->query_vars = array_diff_key( (array) $wp_query->query_vars, array_flip( array( 'src', 'w', 'h', 'q', 'a', 'zc', 'f', 's', 'o', 'cc', 'ct' ) ) ); // Show the just the search form w/o showing the intial results? // If a Connections query var is set, show the results instead. if ( isset( $atts['initial_results'] ) && strtolower( $atts['initial_results'] ) == 'false' && ! (bool) array_intersect( $registeredQueryVars, array_keys( (array) $wp_query->query_vars ) ) ) { // Add return = true to $atts so template part are returned instead of echoed. $atts['return'] = true; // Enqueue the CSS and JS. We need to use the action because we're hooked // way to early in WP to use wp_enqueue_style() and wp_enqueue_script(). add_action( 'wp_enqueue_scripts', array( 'cnScript', 'enqueueStyles' ) ); // Add action to enqueue Chosen. add_action( 'wp_enqueue_scripts', 'cn_enqueue_chosen' ); add_action( 'wp_print_footer_scripts', 'cn_init_chosen', 999 ); // Passing the shortcode $atts incase there are any template part specific shortcode options set. $category = cnTemplatePart::category( $atts ); $search = cnTemplatePart::search( $atts ); $formOpen = cnTemplatePart::formOpen( $atts ); $formClose = cnTemplatePart::formClose( $atts ); // Create the final output. $replace = $formOpen . $category . $search . $formClose; // All returns and tabs should be removed so wpautop() doesn't insert <p> and <br> tags in the form output. //$replace = str_replace( array( "rn", "r", "n", "t" ), array( ' ', ' ', ' ', ' ' ), $replace ); // This needs to be wrapped in a div with an id of #cn-list so the CSS styles will be applied. $replace = '<div id="cn-list">' . $replace . '</div>'; } else { // Rewrite the $atts array to prep it to be imploded. array_walk( $atts, create_function( '&$i,$k','$i="$k=\"$i\"";' ) ); $replace = '[' . $shortcode . ' ' . implode( ' ', $atts ) . ']'; } // Replace the shortcode in the post with something a new one based on you changes to $atts. $post->post_content = str_replace( $matches[0][ array_search( $shortcode, $matches[2] ) ], $replace, $post->post_content ); } } } return $posts; } function cn_enqueue_chosen() { // If SCRIPT_DEBUG is set and TRUE load the non-minified JS files, otherwise, load the minified files. $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_script( 'jquery-chosen', CN_URL . "vendor/chosen/chosen.jquery$min.js", array( 'jquery' ), '1.1.0', true ); } function cn_init_chosen() { ?> <script type="text/javascript">/* <![CDATA[ */ jQuery('select[name^=cn-cat]').chosen(); /* ]]> */</script> <?php } add_filter( 'the_posts', 'cn_initial_search_filter', 1000, 2 );
Attachments:
You must be logged in to view attached files. -
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.