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 8 replies, 2 voices, and was last updated 9 years ago by
Steven Zahm.
-
AuthorPosts
-
09/03/2014 at 2:42 pm #302685
Tim Carpenter
ParticipantSteven,
Thank you for your continued support! I have another set of questions for you.
I searched for both questions but could not find any responses. Please direct me to them if they have already been addressed.
In preparation for this ticket I updated my connections plugin to 8.1 (from 7.9 I think).
I am now receiving this error for images:
Warning: Cannot use a scalar value as an array in /home/national/public_html/wp-content/plugins/connections/includes/entry/class.entry-data.php on line 3513
Possibly related, I am seeing this in the backend as well:
ERROR: The server does not have ImageMagick or GD installed and/or enabled. Either of these are required for WordPress to be able to resize images. Please contact your server administrator.
Will installing these on our server resolve this issue? What steps should we be taking to resolve.
————————————
My original need for a ticket was a request from my client to add a drop down for states (full state names) instead of the current text box when adding in new entries. Our website sorts all entries via states as regions and it would cut down a lot on data entry errors if all state names were pre populated.
Is this possible? If so what should file should I edit.
Thanks for your help!
Tim
09/03/2014 at 3:46 pm #302697Steven Zahm
Keymaster@ Tim
Does/Did Connections and WordPress work fine with image before updating Connections to 8.1? It is nearly impossible image that neither GD or Imagick is not installed. GD is nearly universal. WordPress uses both but needs at least one. If neither of these are truly installed, you’ll have to contact the host there’s nothing I can do about that because that is server level software. Ensure one is installed will definitely address the scalar warning.
Could I get a temp admin account, I would love to check this out myself?
As for the state drop down. That is something I was going to include this last release but it didn’t make it … maybe the next one.
You’d have to manually edit a PHP file adding it. These are the two locations you’d have to edit:
https://github.com/Connections-Business-Directory/Connections/blob/8.1/includes/class.metabox-entry.php#L1257
https://github.com/Connections-Business-Directory/Connections/blob/8.1/includes/class.metabox-entry.php#L1477You would have to change the type to
select
and add anoptions
key which would be set to an associative array with the key being the state abbr and the value being the full state name.Hope that helps!
09/03/2014 at 4:26 pm #302701Tim Carpenter
ParticipantThis reply has been marked as private.09/03/2014 at 5:17 pm #302705Tim Carpenter
ParticipantI rebuilt the apache server with GD and the error seems to have gone away for both the backend and images. Unsure how I managed to run wordpress so long without it installed if it was indeed uninstalled! Thanks!
09/04/2014 at 2:43 pm #302753Steven Zahm
Keymaster@ Tim
How odd because that error message about GD is actually triggered from core a WordPress function that checks that the are installed. I added the actual output of the message primarily for my testing.
As for the state drop downs is is actually even easier that I said. You still make the two changes.
Here’s the code for the first change:
cnHTML::field( array( 'type' => 'select', 'class' => '', 'id' => 'address[::FIELD::][state]', 'required' => FALSE, 'label' => __( 'State', 'connections' ), 'before' => '<div class="address-state">', 'after' => '</div>', 'options' => cnGEO::US_Regions(), 'return' => FALSE, ) );
Here’s the code for the second change:
cnHTML::field( array( 'type' => 'select', 'class' => '', 'id' => 'address[' . $token . '][state]', 'required' => FALSE, 'label' => __( 'State', 'connections' ), 'before' => '<div class="address-state">', 'after' => '</div>', 'options' => cnGEO::US_Regions(), 'return' => FALSE, ), $address->state );
I forgot that I already had built in the regions (states) for several countries.
Two caveats … First, unless you were adding states with their two letter abbr and in all caps, editing an entry, you have to select the correct state otherwise I think it’ll simply default to AL. Second, when the states are actually displayed, they’ll be displayed with their abbr instead of the full name. Doing the opposite would require more changes in several areas of code.
09/05/2014 at 12:03 pm #302875Tim Carpenter
ParticipantThanks! I really appreciate your swift replies.
Quick questions:
First, unless you were adding states with their two letter abbr and in all caps, editing an entry, you have to select the correct state otherwise I think it’ll simply default to AL.
Does this mean that it will no be backwards compatible with past entries? We are entering all people with full state names, so Ohio instead of OH. Does this mean Ohio would become AL because Ohio is not a state abbreviation?
Second, when the states are actually displayed, they’ll be displayed with their abbr instead of the full name. Doing the opposite would require more changes in several areas of code.
We would certainly need full state names. We have region specific pages that are easy to access via navigation that rely on full state names. Also we opt to not use state abbreviations as search results are more reliable with full state names. It sounds like US_Regions() is set to return abbreviations only. You mention that it would require edits in a few places so I imagine that the US_Regions() method is not the only place requiring changes.
You have been a great help. I do not know if you provide custom editing at your hourly rate. I would feel more comfortable having you making these changes than myself as my PHP knowledge is limited. Let me know if this would be possible!
09/05/2014 at 8:31 pm #302913Steven Zahm
Keymaster@ Tim
re: Does this mean that it will no be backwards compatible with past entries?
Yes, but only when you edit. Any existing entries will continue to show what was entered. Any new entries or entries updated would show the state abbr. The abbr is what is actually save to the DB.The array returned from
cnGEO::US_Regions()
isarray("AL"=>"Alabama","AK"=>"Alaska", ...
So, you could
array_flip( cnGEO::US_Regions() )
. That would meet your requirements, I believe. Just when editing an entry you would see a select list with the state abbr instead of the full name but the inverse would be that the full state name would be displayed and saved to the DB and would work with search too.I do have a dev I can recommend. The only issue I can see with doing this might be forward compatibility with Connections … meaning updates to Connections could break your customization.
09/09/2014 at 1:28 pm #303210Tim Carpenter
ParticipantSorry for the late reply!
I implemented the array flip version of the code and seems to work perfectly and suit our needs!
Thanks again for your continued support.
09/09/2014 at 1:42 pm #303212Steven Zahm
KeymasterNo problem!
If I have not asked and you have a moment,, I would truly appreciate a review as they really do make a difference. Many thanks in advance!
http://wordpress.org/support/view/plugin-reviews/connections -
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.