Forum Replies Created
-
AuthorPosts
-
Steven Zahm
Keymaster@ William
Great, do you see the minor changes that were needed to get it working?
Steven Zahm
Keymaster@ William
Here’s a working function:
function getFamilyMemberDetailsBlock( $atts, $entry ) { $defaults = array( 'container_tag' => 'ul', 'item_tag' => 'li', 'item_format' => '<%1$s class="cn-relation"><span class="cn-relation-label">%relation%</span>%separator% <span class="cn-relation-name notranslate">%name%</span></%1$s>', 'name_format' => '', 'separator' => ':', 'before' => '', 'after' => '', 'before_item' => '', 'after_item' => '', 'return' => FALSE, ); $atts = wp_parse_args( $atts, $defaults ); $html = ''; $search = array( '%relation%', '%name%', '%separator%' ); if ( $relations = $entry->getFamilyMembers() ) { // Grab an instance of the Connections object. $instance = Connections_Directory(); foreach ( $relations as $relationData ) { $relation = new cnOutput(); $replace = array(); if ( $relation->set( $relationData['entry_id'] ) ) { $replace[] = $instance->options->getFamilyRelation( $relationData['relation'] ); $replace[] = cnURL::permalink( array( 'type' => 'name', 'slug' => $relation->getSlug(), 'title' => $relation->getName( array( 'format' => $atts['name_format'] ) ), 'text' => $relation->getName( array( 'format' => $atts['name_format'] ) ), 'home_id' => $entry->directoryHome['page_id'], 'force_home' => $entry->directoryHome['force_home'], 'return' => TRUE, ) ); $replace[] = empty( $atts['separator'] ) ? '' : '<span class="cn-separator">' . $atts['separator'] . '</span>'; $row = str_ireplace( $search, $replace, empty( $atts['item_format'] ) ? $defaults['item_format'] : $atts['item_format'] ); $html .= "\t" . sprintf( $row, $atts['item_tag'] ) . PHP_EOL; } if ( $atts['show_phone_numbers'] ) { $html .= $relation->getPhoneNumberBlock( array( 'format' => $atts['phone_format'], 'type' => $atts['phone_types'], 'return' => TRUE ) ); } if ( $atts['show_email'] ) { $html .= $relation->getEmailAddressBlock( array( 'format' => $atts['email_format'], 'type' => $atts['email_types'], 'return' => TRUE ) ); } if ( $atts['show_dates'] ) { $html .= $relation->getDateBlock( array( 'format' => $atts['date_format'], 'type' => $atts['date_types'], 'return' => TRUE ) ); } } $html = sprintf( '<%1$s class="cn-relations">' . PHP_EOL . '%2$s</%1$s>', $atts['container_tag'], $html ); $html = $atts['before'] . $html . $atts['after'] . PHP_EOL; } echo $html; }Steven Zahm
Keymaster@ Campbell
Generally this issue is always caused by malformed HTML added in the note or bio field. I would suggest looking for unclosed HTML tags in those fields for both Amy Abbott and Dottie.
Hope that helps, let me know.
Steven Zahm
Keymaster@ Harold
re: There we complaints that contributors cannot upload (image) and it say HTTP error. I tried a contributor account its true. I’m wondering if its the tweak you did?
What tweak? Reviewing the thread the only change was fixing the one user’s corrupted user meta. This in no way is responsible for the error you are seeing in the Media Library.
re: thats the best using the featured image on the thumbnail set by the theme. Can’t wait for that…. I just added support. If you’d like to give a try, I can install it for you. Let me know.
I installed the update for you.
It looks ok… I think it would perhaps look better if it were laid out similar to the “Latest Posts” section on this page. If you think so too, I’d b will to make those changes. Let me know.
Steven Zahm
Keymaster@ David
It seems the Connections user meta for your user account has somehow been corrupted. But a couple things do not make sense. ON a clean WP install, there would be no Connections user meta to become corrupt. When you say “clean install” you also mean a clean db too, correct? Even still there are checks to ensure the when saving a message that it is an array. That said, looking at the code, those checks could be more robust so I made those changes which should make it impossible for these error to occur.
If you’d like me to apply the changes to your site in order to ensure that they work as expected I’ll need your login which can be posted here as a private reply.
Steven Zahm
Keymaster@ William
re: pastbin
The paste is marked as private so I can sot view it.
re: Can the tile-plus.php file be overridden like the card.php file?
Sorry, no, t can not be overridden.
re: Or is the a filter or action that can be added to include the new shortcode?
Yes, there is a filter, two actually. One to register the shortcode option and its default value and one to init it value (if needed). YOu can see how to do this right in the
tile-plus.phpfile. Look for the two line that begin withadd_filter( 'cn_list_atts_and then look at the callback functions as an example on how to do it.Hope that helps!
ps. It just occured to me… you could refer to the
../wp-content/plugins/connections/templates/members/template.phpfile as an example of how to do it too. This is a user contributed template that I included a long time ago. It is not the best code but it does have a section where it pulls in the entry details of family members.pss. I do offer customization services. If interested, contact me using the link at the very bottom of the page and we can discuss the project scope and get you a quote.
Steven Zahm
Keymaster@ David
Probably the first thing you should do, as a best practice, on a live site is to disable the PHP notices. Read this blog post to learn more on how to do this.
To get rid of the notices, you have a couple options…
- I just updated cMap to 5.2.1 which has a new check in place to prevent the PHP notices for those indexes.
- Go to the Connections : Templates admin page and click the Customize button for cMap. This will load the Template Customizer for cMap on the left and a preview on the right. Click the back arrow in the upper left of the Customizer and then click the Style panel. Make any random change to the colors and then Click the Save and Publish button. You can then undo the change and save again. This will make sure the missing values are saved and you will not longer get the PHP notices.
Hope that helps. Apologies for the trouble!
Steven Zahm
Keymaster@ Jenny
I do not see anything on the page. Did you add the
[connections]shortcode to the page. If not, please see Step 4 of the quick start tutorial for detailed instructions.Hope that helps, please let me know.
Steven Zahm
KeymasterJust as a followup for anyone else who may read this thread… I now have a tutorial posted with step by step instructions on how to get and setup the API and the required keys.
http://connections-pro.com/documentation/create-google-maps-api-keys/
Steven Zahm
Keymaster@ William
If you custom function you did add
attsvariable as a parameter and pass it from within the template to you custom function, correct? Like this:custom_family_function( $atts, $entry )Also, they are not shortcode codes, they are array key indexes. The
$attsvariable is an associative array.How about posting you code up on pastbin or creating a private gist to share?
-
AuthorPosts
